Difference between revisions of "Globals"
Jump to navigation
Jump to search
imported>MadCat221 |
imported>JOG |
||
Line 1: | Line 1: | ||
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. | |||
==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== | |||
[[List of Global Variables]] | |||
[[Category:Gameplay Menu]] | [[Category:Gameplay Menu]] | ||
[[Category:Scripting]] | |||
[[Category:Variables]] |
Latest revision as of 15:52, 4 March 2011
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.
Notes:[edit | edit source]
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.