68
edits
imported>Jog |
(Revise Keyword Redirects (in this case, add a link)) |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
<small>For the use in functions, see [[Function_Reference#Function_Header|Function Reference]]</small> | |||
A [[Global]] Variable is a numeric value stored by the game. Globals are often used to pass data between [[:Category:Papyrus|Scripts]] and [[:Category:Condition_Functions|Condition Functions]] or other code-driven systems. | A [[Global]] Variable is a numeric value stored by the game. Globals are often used to pass data between [[:Category:Papyrus|Scripts]] and [[:Category:Condition_Functions|Condition Functions]] or other code-driven systems. | ||
==Global Dialog== | ==Global Dialog== | ||
Globals can be found in an Object Window under ''Miscellaneous / Global''. | |||
*'''ID:''' The Form's Editor ID. | *'''ID:''' The Form's Editor ID. | ||
*'''Variable Type:''' The data type used to store the value (Short, Long, or Float). | *'''Variable Type:''' The data type used to store the value (Short, Long, or Float). | ||
Line 10: | Line 13: | ||
** 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== | ==Accessing Global Variables== | ||
===Scripting=== | ===Scripting=== | ||
To access global variables in Papyrus scripts, one needs to use the functions [[GetValue]] and [[SetValue]] | To access global variables in Papyrus scripts, the global variable must be passed into the script as a property. Then one needs to use the functions [[GetValue]] and [[SetValue]] | ||
float myhour = GameHour. | |||
GameHour. | GlobalVariable Property GameHour auto | ||
float myhour = GameHour.GetValue() | |||
GameHour.SetValue(10) | |||
===Console=== | ===Console=== | ||
In the Console global variables can be adressed directly: | In the Console global variables can be adressed directly: | ||
set GameHour to 10 | set GameHour to 10 | ||
GetGlobalValue GameHour | |||
show GameHour ; same effect as GetGlobalValue GameHour | |||
{{languages|Global}} | |||
[[Category:Miscellaneous]] | [[Category:Miscellaneous]] | ||
[[Category:Object Classes]] | [[Category:Object Classes]] |
edits