Difference between revisions of "Global"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Scornett-Bot
m (Script running global find and replace: Category:Object Classes for Category:Objects)
 
imported>Jog
Line 10: Line 10:
** If checked, the '''Value''' of this Global is not expected to change during gameplay, and will not be saved with save game data.
** If checked, the '''Value''' of this Global is not expected to change during gameplay, and will not be saved with save game data.
** If unchecked, the '''Value''' is expected to change, and will be saved.
** If unchecked, the '''Value''' is expected to change, and will be saved.
==Accessing Global Variables==
===Scripting===
To access global variables in Papyrus scripts, one needs to use the functions [[GetValue]] and [[SetValue]]
set myhour to GameHour.Getvalue()
GameHour.Setvalue(10)
===Console===
In the Console global variables can be adressed directly:
set GameHour to 10


[[Category:Miscellaneous]]
[[Category:Miscellaneous]]
[[Category:Object Classes]]
[[Category:Object Classes]]

Revision as of 10:54, 20 February 2012

A Global Variable is a numeric value stored by the game. Globals are often used to pass data between Scripts and Condition Functions or other code-driven systems.

Global Dialog

  • ID: The Form's Editor ID.
  • Variable Type: The data type used to store the value (Short, Long, or Float).
    • Internally, all Globals are stored as 32-bit floating-point numbers. There is no difference between Short and Long.
    • The technical implementation of floating-point numbers means that they are inaccurate at very large or very small values (for example, all numbers from 2000000000 to 2000000064 are stored as 2000000000).
  • Value: The initial value of the Global.
  • Constant:
    • If checked, the Value of this Global is not expected to change during gameplay, and will not be saved with save game data.
    • If unchecked, the Value is expected to change, and will be saved.


Accessing Global Variables

Scripting

To access global variables in Papyrus scripts, one needs to use the functions GetValue and SetValue

set myhour to GameHour.Getvalue()
GameHour.Setvalue(10)

Console

In the Console global variables can be adressed directly:

set GameHour to 10