This wiki is a copy of the original Oblivion CS wiki created and maintained by the UESP.net. See CSwiki:Copy Notice for more info.

Difference between revisions of "Globals"

Jump to navigation Jump to search
559 bytes added ,  20:19, 15 September 2006
→‎Notes:: I discovered ( via a nast bug ) that globals will always act as floats ( within scripts, at least ). I ran a seperate experiment to verify the claims made in the edit.
imported>Scruggs
(added note)
imported>Big Brother
(→‎Notes:: I discovered ( via a nast bug ) that globals will always act as floats ( within scripts, at least ). I ran a seperate experiment to verify the claims made in the edit.)
Line 13: Line 13:
==Notes:==
==Notes:==
* In almost all cases, using a global variable is unnecessary. Variables defined in quest scripts are generally used instead, and accessed via '''questID.varName''', or '''getQuestVariable questID varName'''.
* In almost all cases, using a global variable is unnecessary. Variables defined in quest scripts are generally used instead, and accessed via '''questID.varName''', or '''getQuestVariable questID varName'''.
* It seems that, when used in scripts, global variables always act as floats regardless of what you declare them as.  This could cause issues in situations such as:
set giCoinToss to GetRandomPercent / 50 ;giCionToss is a global short
if( giCionToss == 1 )
    ;do result for heads
else
    ;do result for tails
endif
In the above situation, the only time the heads result code will run is when GetRandomPercent returns exactly 50.
Variables declared in quest scripts will behave as declared and thus are safe to use in situations like the above.


==See also==
==See also==
Anonymous user

Navigation menu