Auxiliary Variables

From the Fallout3 GECK Wiki
Jump to navigation Jump to search

The Auxiliary-Variables interface is a utility added by the JIP NVSE Plugin, and is an alternative method for dynamically storing and managing game-data. Auxiliary-Variables (abbreviated as AuxVars) are a special type of variables that, unlike generic script variables, exist in the game's memory and are not part of, and are not pre-declared in any game-script. AuxVars are created, accessed, modified and deleted using a set of script commands.

Properties[edit | edit source]

  • An AuxVar is defined by a Name (string, case-insensitive) and an Object (object reference/base form) that "owns" it. This Object:Name pair must, therefore, be unique. Note that different Objects may "own" a variable with the same Name and still count as a unique pair. Any Object may "own" any number of variables.
  • AuxVars can store either numeric, reference/form, or string values. They have no explicit, fixed value-type - their type changes dynamically, according to the type of value assigned to them.
  • Every AuxVar is an array by default, and can be used for storing either a single, or multiple values (of mixed types).

Duration & Accessibility[edit | edit source]

Duration:

An AuxVar's duration setting determines its "life-span", i.e. whether it is permanent or temporary. Permanent AuxVars, and any values they store, are saved with the game. In contrast, temporary AuxVars are not saved with the game. Instead, they are persistent (retain their values) for the duration of the current game session (much like constant global variables) but are discarded when the game is exited.

Accessibility:

The accessibility setting determines which mods can "see" and manipulate the AuxVar. A private AuxVar is "private" to the mod it was created by, and can only be accessed/modified by scripts originating in that mod. This allows different mods to use the same variable names, associated with the same objects, without overwriting each other. A public AuxVar, on the other hand, can be accessed/modified by any mod. This is an effective method for inter-mod communication and exchange of data, without any master-dependencies.


Enabling each property is done by adding a special prefix to the AuxVar's name. The two properties, and their combinations, define four classes of AuxVars, as summarized in the following table:


Class
Prefix
Example
Saved w/ Game
Persistent
in Session
Accessible By
Temporary-Public
*_
"*_VarName"
No
Yes
Any mod
Permanent-Public
_
"_VarName"
Yes
No
Any mod
Temporary-Private
*
"*VarName"
No
Yes
Creating mod
Permanent-Private
None
"VarName"
Yes
No
Creating mod