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 window_mouse_set(x,y) and display_mouse_set(x,y).
Global variables come in three types: predefined, global flagged, and global dot access.
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:
- ↑ 1.0 1.1 1.2 Read-only variables. The value may change or vary, but you cannot directly alter the value.
|This section is of low quality and may not be factual. Please fix it.|
global myvar = 10;
myvar += 10; //myvar = 20