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 "Reference Variables"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>JOG
imported>Millinghordesman
m
Line 5: Line 5:
</pre>
</pre>


You can use a reference variable anywhere you could use an [[Object_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 can use a reference variable anywhere you could use an [[Object_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.
 
A reference variable whose object is not in memory (such as a static object after the player leaves that object's cell) is treated as uninitialized.


You set reference variables using the set command, like other variables. Normally, you will want to use a [[reference variable function]], which returns a [[formID]]. For example:
You set reference variables using the set command, like other variables. Normally, you will want to use a [[reference variable function]], which returns a [[formID]]. For example:

Revision as of 08:49, 8 April 2006

Like other variables, reference variables must be declared before they can be used:

ref   refVarName  

You can use a reference variable anywhere you could use an 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.

A reference variable whose object is not in memory (such as a static object after the player leaves that object's cell) is treated as uninitialized.

You set reference variables using the set command, like other variables. Normally, you will want to use a reference variable function, which returns a formID. For example:

set myRef to GetContainer  

Like other variables, you can set a reference variable on another scripted object:

 set BobRef.myRef to GetSelf   

To check if a ref variable is unset:

if myReferenceVariable == 0

To check if a ref variable is set:

if myReferenceVariable != 0

To check if a ref variable is another reference (in this example the player):

if myReferenceVariable == player

Or not another reference:

if myReferenceVariable != player