Globals

From GECK
Jump to: navigation, search

A global variable is available for any script or condition to reference without being linked to a particular quest or object.

Global variables are declared in the main menu under Gameplay -> Globals


  • EditorID: The name of the variable. No spaces or special characters are allowed.
  • Variable Type: Short and Long are actually the same thing. Both are integer formats. Float is a real number format.
  • Value: The default value for the global variable. This affects the variable only when the plugin was just installed. After that the value is stored in the savegame.
  • Constant: When this box is checked, the variable will be reset to its default value when a savegame is loaded. Note that changing the variable via script from the Main Menu (MenuMode 4) will change the "default" value of the global for the session.

User Interface

<globals></globals> is also a user interface XML directive

Notes:

Internally all types of global variables are stored as floating point. The technical implementation of this variable-format causes inaccuracies at very high or low values. (e.g all numbers from 2000000000 to 2000000064 are stored as 2000000000) and the results of divisions will almost always have decimal places, thus checks like "if global == x" will usually fail after a division.

In most cases, variables defined in quest script are the better choice.

See also