Kode wheel segment Values
Style Specialised
Modifiers None
Primarily WHEN/DO Both
Pre-made brains that use it unknown

Values > global


You use this tile paired with a variable (number, text, boolean etc). This makes the variable and whatever value you set for it available to all brains in the world. Otherwise the variable only applies to the brain it is in. Global variables are held in the world and not in an individual brain, so you can destroy brains (objects) that reference it, without resetting the variable. If you use a local variable  (without using the [global] tile) and you destroy the object, that variable can no longer be referenced.

Example Code

In the player brain you have this variable

WHEN DO [numvar: score][=][10]

If, in another brain you tried to display the score

WHEN DO [display][numvar:score][screen top right]

It would display as 0 and not 10. This is because it is trying to find a variable value within it’s own brain, it does not know about the score variable in the player brain. Instead you use this in the player brain

WHEN DO [global][numvar:score][=][10]

and this in the other brain

WHEN DO[display] [global][numvar:score][screen top right]



Other Uses

Comments are closed.

Website Powered by

Up ↑

%d bloggers like this: