This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-03-26 19:38:30

qwerty2357
Scratcher
Registered: 2010-07-06
Posts: 11

Variables without using the fallible Scratch variable system - how?

If you're making a game that involves cash/gold, etc. how do you show your wealth or show another variable without using a variable? They have a really bad tendency to go to the default location if they need to be hidden/shown. I've seen many people do this and it really confuses me. I suppose I could see this if you make a sprite with 100 different costumes and a $99 limit, but this seems really inefficient.

Offline

 

#2 2011-03-26 20:14:02

GraemeK
Scratcher
Registered: 2010-06-14
Posts: 73

Re: Variables without using the fallible Scratch variable system - how?

When you save the project, make sure that all of the variables are showing. They will stay in their allocated position this way. Hope this helps.

GraemeK


http://internetometer.com/image/13865.png

Offline

 

#3 2011-03-26 20:25:01

qwerty2357
Scratcher
Registered: 2010-07-06
Posts: 11

Re: Variables without using the fallible Scratch variable system - how?

No, not after you upload a project. Then everything seems to get messed up. After that, about every other time you open it up, the variables get messed up if they are not showing when you open it.

Offline

 

#4 2011-03-27 02:21:57

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Variables without using the fallible Scratch variable system - how?

Well, you could have 1 sprite with 10 costumes, each with a digit 0-9 (in that order). Then make the following script:

forever:
go to x: 10
switch to costume: item (1) of (variable) - 1
go to x: 20
switch to costume: item (2) of (variable) - 1
etc.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#5 2011-03-27 04:06:00

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Variables without using the fallible Scratch variable system - how?

Hardmath123 wrote:

switch to costume: item (1) of (variable) - 1

switch to costume: item (2) of (variable) - 1

DOES THAT WORK?

BREAKTHROUGH!


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#6 2011-03-27 05:21:34

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Variables without using the fallible Scratch variable system - how?

You guys Didn't know about that? You make the digit numbers and then you can stamp out the score at the top of the stage. If you want to use Panther, it has the a block to set the screen coordinates for a variable watchers as well as the watcher type (small, slider or large) and using this block by nXIII (block 22) you can actually change the watcher background to match the colour scheme of the game or even show a changing colour between red and green when something is loading!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#7 2011-03-28 20:57:58

qwerty2357
Scratcher
Registered: 2010-07-06
Posts: 11

Re: Variables without using the fallible Scratch variable system - how?

I didn't know this!! Thanks!

Offline

 

#8 2011-03-28 21:09:02

qwerty2357
Scratcher
Registered: 2010-07-06
Posts: 11

Re: Variables without using the fallible Scratch variable system - how?

Hardmath123 wrote:

forever:
go to x: 10
switch to costume: item (1) of (variable) - 1
go to x: 20
switch to costume: item (2) of (variable) - 1
etc.

item (1) of (variable) - 1 doesn't exist. there is, however, an item ( ) of (list)

Offline

 

#9 2011-03-29 01:16:27

floppy_gunk
Scratcher
Registered: 2008-11-14
Posts: 500+

Re: Variables without using the fallible Scratch variable system - how?

qwerty2357 wrote:

Hardmath123 wrote:

forever:
go to x: 10
switch to costume: item (1) of (variable) - 1
go to x: 20
switch to costume: item (2) of (variable) - 1
etc.

item (1) of (variable) - 1 doesn't exist. there is, however, an item ( ) of (list)

I think that is what Hardmath meant.


http://img163.imageshack.us/img163/1917/2856lg.jpg Get it now!  smile

Offline

 

#10 2011-03-29 08:20:25

qwerty2357
Scratcher
Registered: 2010-07-06
Posts: 11

Re: Variables without using the fallible Scratch variable system - how?

GraemeK wrote:

When you save the project, make sure that all of the variables are showing. They will stay in their allocated position this way. Hope this helps.

GraemeK

Qwerty2357 wrote:

No, not after you upload a project. Then everything seems to get messed up. After that, about every other time you open it up, the variables get messed up if they are not showing when you open it.

Well, I guess your suggestion was actually valid. What I meant was that not all of the variables could be shown at the same time in my game. I suppose I could rewrite it a bit so all of the variables are showing at the beginning of a game until you press the green flag.

Thank you for your efforts  smile

Offline

 

#11 2011-03-29 08:25:23

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Variables without using the fallible Scratch variable system - how?

floppy_gunk wrote:

qwerty2357 wrote:

Hardmath123 wrote:

forever:
go to x: 10
switch to costume: item (1) of (variable) - 1
go to x: 20
switch to costume: item (2) of (variable) - 1
etc.

item (1) of (variable) - 1 doesn't exist. there is, however, an item ( ) of (list)

I think that is what Hardmath meant.

Or maybe letter (1) of (variable) - 1
smile

Offline

 

#12 2011-03-29 08:36:12

qwerty2357
Scratcher
Registered: 2010-07-06
Posts: 11

Re: Variables without using the fallible Scratch variable system - how?

floppy_gunk wrote:

qwerty2357 wrote:

Hardmath123 wrote:

forever:
go to x: 10
switch to costume: item (1) of (variable) - 1
go to x: 20
switch to costume: item (2) of (variable) - 1
etc.

item (1) of (variable) - 1 doesn't exist. there is, however, an item ( ) of (list)

I think that is what Hardmath meant.

Unfortunately, I can't figure out how to make a variable show each digit in a list, i.e. if the number is 1,500,000, make a list:
List:
1
5
0
0
0
0
0

If I could do this, then it would probably work, but Idk how to.

Offline

 

#13 2011-03-29 08:48:12

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Variables without using the fallible Scratch variable system - how?

qwerty2357 wrote:

floppy_gunk wrote:

qwerty2357 wrote:


item (1) of (variable) - 1 doesn't exist. there is, however, an item ( ) of (list)

I think that is what Hardmath meant.

Unfortunately, I can't figure out how to make a variable show each digit in a list, i.e. if the number is 1,500,000, make a list:
List:
1
5
0
0
0
0
0

If I could do this, then it would probably work, but Idk how to.

You will need a list called list, and a variable called count.

Code:

set [count] to [0]
go to x: {start x} y: {start y}
repeat (length of [list])
   change [count] by (1)
   switch to costume (item (count) of [list])
   change x by {width of costume}
   stamp

The costumes will have to be ordered 1-9, with 0 at the end. Anytime there is a {text}, replace text with the value.

Did that work?  smile

Offline

 

Board footer