Difference between revisions of "GlobalVariable Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jlundin
 
imported>OpusGlass
(Corrected the manner for traditionally casting the SetValue function with an int argument.)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]
'''Extends:''' [[Form Script]]
'''Extends:''' [[Form Script]]


Line 19: Line 15:


== Member Functions ==
== Member Functions ==
*float Function [[GetValue - GlobalVariable|GetValue]]()
**Returns this global variable's current value.
*int Function [[GetValueInt - GlobalVariable|GetValueInt]]()
**Returns this global variable's current value cast as an int.
*float Function [[Mod - GlobalVariable|Mod]](float afHowMuch)
**Modifies this global variable's value in a more thread-safe way.
*Function [[SetValue - GlobalVariable|SetValue]](float afNewValue)
**Sets this global variable's current value.
*Function [[SetValueInt - GlobalVariable|SetValueInt]](int aiNewValue)
**Sets this global variable's current value to the specified int.


:'''Float [[GetValue - GlobalVariable|GetValue]]()'''
:*Returns this global variable's current value.
:'''Int [[GetValueInt - GlobalVariable|GetValueInt]]()'''
:*Returns this global variable's current value cast as an int.
:'''Float [[Mod - GlobalVariable|Mod]](Float ''afHowMuch'')'''
:*Modifies this global variable's value in a more thread-safe way.
:'''[[SetValue - GlobalVariable|SetValue]](Float ''afNewValue'')'''
:*Sets this global variable's current value.
:'''[[SetValueInt - GlobalVariable|SetValueInt]](Int ''aiNewValue'')'''
:*Sets this global variable's current value to the specified int.
== Notes ==
*For SetValueInt(), and GetValueInt(), it is better and faster to use traditional cast methods. As is the compiler will auto-cast them which is slower. Use GetValue() as int, and SetValue(MyInt as float) instead.
== Events ==
== Events ==
None
None
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]

Latest revision as of 23:39, 7 October 2018

Extends: Form Script

Script for the manipulation of global variable objects.

Definition[edit | edit source]

ScriptName GlobalVariable extends Form

Properties[edit | edit source]

  • float Value [read-write]: The current value of this global variable object.

Global Functions[edit | edit source]

None

Member Functions[edit | edit source]

Float GetValue()
  • Returns this global variable's current value.
Int GetValueInt()
  • Returns this global variable's current value cast as an int.
Float Mod(Float afHowMuch)
  • Modifies this global variable's value in a more thread-safe way.
SetValue(Float afNewValue)
  • Sets this global variable's current value.
SetValueInt(Int aiNewValue)
  • Sets this global variable's current value to the specified int.

Notes[edit | edit source]

  • For SetValueInt(), and GetValueInt(), it is better and faster to use traditional cast methods. As is the compiler will auto-cast them which is slower. Use GetValue() as int, and SetValue(MyInt as float) instead.

Events[edit | edit source]

None