Skip to content
hugh greene edited this page Jun 20, 2022 · 1 revision

Globals refer to variables that are accessible and usually modifiable everywhere. If one object changes the variable, other objects will see the new value.

Some globals are read-only, in which case they can be accessed, but not modified. They are not constants, however, because their values may change. mouse_x is an example of a read-only global. It changes every time you move the mouse, and can be indirectly altered with functions like and .

Global variables come in three types: predefined, global flagged, and global dot access.

Predefined

Predefined globals are globals that are already defined and already flagged as global without any additional effort from the user. This means that you can say, for example, health -= 10 and it will work as-is.

Below is an incomplete list of globals already defined by ENIGMA and GM:

[4]

Flag

//in one object
global myvar = 10;

//in another
myvar += 10; //myvar = 20
  1. Read-only variables. The value may change or vary, but you cannot directly alter the value.
Clone this wiki locally