Difference between revisions of "Reference variables"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Cipscis
(" != 0" not necessary)
imported>Odessa
(Moved page to ref variable, to avoid confusion since they may also store base forms)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Like other variables, reference variables must be declared before they can be used:
#Redirect [[Ref Variable]]
 
<pre>
ref  refVarName 
</pre>
 
You can use a reference variable anywhere you could use an [[Reference|object reference]]. Uninitialized reference variables act as if they referred to the scripted object itself; otherwise a reference variable acts just like any other reference.
 
You set reference variables using the set command, like other variables. Normally, you will want to use a [[:Category:Reference_Variable_Functions|reference variable function]], which returns a [[formID]]. For example:
<pre>
set myRef to GetContainer 
</pre>
 
Like other variables, you can set a reference variable on another scripted object:
 
<pre>
set BobRef.myRef to GetSelf 
</pre>
 
To check if a ref variable is unset:
<pre>
if myReferenceVariable == 0
</pre>
 
To check if a ref variable is set:
<pre>
if myReferenceVariable
</pre>
 
To check if a ref variable is another reference (in this example the player):
<pre>
if myReferenceVariable == player
</pre>
 
Or not another reference:
<pre>
if myReferenceVariable != player
</pre>
[[Category:Commands]]

Latest revision as of 05:58, 14 August 2014

Redirect to: