(Redirected from () (Variable block))
- This article is about the variables block. For the list block used to report list values, see () (List block).
The () block is a Variables block and a Reporter block. The block simply holds its variable. Whenever a variable is created, a version of the block appears with the variable's given name on it — this results in a version of this block for every variable. Each version of the block holds its 'assigned' variable. This block can be displayed as a Stage monitor.
- Main article: List of Block Workarounds
A global variable can be accessed with
([global variable v] of [Stage v])
A private variable can be accessed with
([private variable v] of [Sprite v])
However, this workaround does not work on clones. It will always report the main sprite's value.
If a sprite has a private variable, clones of that sprite will have independent 'versions' of that variable. These versions can be changed independently of the main variable. When a clone tries to change the private variable, it will change its own version instead. Those separate versions will be initially set to the main sprite's variable was when the clone was made.
Variables could never be used if there were no blocks that held them—this is the block that holds all variables. Additionally, variables' Stage monitors can be used as a display for text. It is easier to use than to create sprites and program them to be a display.
The block can be used to:
- Save information
ask [What's your name?] and wait set [name v] to (answer)
- Recall information
say (join [Hi, ] (join (name) [!]))
- Display information
forever say (random speech)
No specific uses can be given for the () block, as it merely holds a variable. The only proper use is when the block has not been taken onto the scripting area, when you click on the little box to show the variable or hide it again. But this use has no scripting use, as there is already a Hide Variable block for scripting, so this use is probably only for testing games, interactive projects etc.