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

#1 2008-02-27 03:47:51

Splattafax
Scratcher
Registered: 2008-02-08
Posts: 12

Red and Orange Variables

How come only red variables show up on the (Something OF Something) block in the sensing block section, because i made seperate variables for seperate sprites, one sprite works perfectly, one sprite can only, on the (Something OF Something) block, only shows the names of the red variable blocks, why is this?


Teachin' Fools Some Basic Rules!

Offline

 

#2 2008-02-27 05:08:00

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Red and Orange Variables

The red variables are local variables that can only be changed by the sprite they "belong" too.  They are created by choosing "For this sprite only" when making a variable.  The sensor block (Something of Something) allows other sprites to see the value of these variables but not to change them. 

The yellow variables are global variables that can be changed (and seen) by all sprites directly so there is no need to have them in the sensor block. 

Hope that helps clear things up!


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-02-27 06:48:47

Splattafax
Scratcher
Registered: 2008-02-08
Posts: 12

Re: Red and Orange Variables

Thanks so much!


Teachin' Fools Some Basic Rules!

Offline

 

#4 2008-02-27 12:08:53

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Red and Orange Variables

Splatt,
It may seem like a bother to use local variables (and the "something of something", sensing block),  but locals  have some real advantages. 

Below is a link to a thread that starts out with a beginner explanation of varibles (that you could skip, though it is well written and worth a review) and ends with a discussion of local/global variables:

http://scratch.mit.edu/forums/viewtopic.php?pid=17277#p17277

-MrEd

Offline

 

Board footer