Difference between revisions of "Auxiliary Variables"

2,924 bytes added ,  09:46, 28 April 2015
no edit summary
imported>Jazzisparis
(Created page with "The Auxiliary-Variables interface is a utility added by the [http://www.nexusmods.com/newvegas/mods/58277 JIP NVSE Plugin], and is an alternative method for dynamically storin...")
 
imported>Jazzisparis
Line 1: Line 1:
The Auxiliary-Variables interface is a utility added by the [http://www.nexusmods.com/newvegas/mods/58277 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 [[Auxiliary-Variable Functions (JIP)|a set of script commands]], and can be permanent (saved with the game), or temporary.
The Auxiliary-Variables interface is a utility added by the [http://www.nexusmods.com/newvegas/mods/58277 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 [[Auxiliary-Variable Functions (JIP)|a set of script commands]].


==Properties==
==Properties==
*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.
*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.
*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 to store either a single, or multiple values (of mixed types).
*Every AuxVar is an array by default, and can be used for storing either a single, or multiple values (of mixed types).


==Private vs. Public AuxVars==
==Duration & Accessibility==
*By default, every 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. Private AuxVars and their values are saved with the game.
'''Duration:'''
*In contrast, public AuxVars can be accessed/modified by any mod, and can be very useful for inter-mod communication. Their values are persistent in the current game session (much like constant global variables). However, they are not saved with the game, and are discarded when the game is exited. Prefixing a variable's name with an asterisk (example: "*VarName") will mark it as public.
 
An AuxVar's <i>duration</i> setting determines its "life-span", i.e. whether it is <i>permanent</i> or <i>temporary</i>. <i>Permanent</i> AuxVars, and any values they store, are saved with the game. In contrast, <i>temporary</i> AuxVars are <i>not</i> 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 <i>accessibility</i> setting determines which mods can "see" and manipulate the AuxVar. A <i>private</i> AuxVar is "private" to the mod it was created by, and can <i>only</i> 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 <i>public</i> AuxVar, on the other hand, can be accessed/modified by <i>any</i> 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:
 
 
{|border="1" cellpadding="5" cellspacing="0"
|-
! style="background:#ffdead;" | <center>Class</center>
! style="background:#ffdead;" | <center>Prefix</center>
! style="background:#ffdead;" | <center>Example</center>
! style="background:#ffdead;" | <center>Saved w/ Game</center>
! style="background:#ffdead;" | <center>Persistent</center>
<center>in Session</center>
! style="background:#ffdead;" | <center>Accessible To</center>
|-
!style="background:#ffeded;border-bottom:1px solid;"|<center>Public-Temporary</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center><nowiki>*_</nowiki></center>
!style="background:#ffeded;border-bottom:1px solid;"|<center><nowiki>"*_VarName"</nowiki></center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>No</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>Yes</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>Any mod</center>
|-
!style="background:#ffeded;border-bottom:1px solid;"|<center>Public-Permanent</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center><nowiki>_</nowiki></center>
!style="background:#ffeded;border-bottom:1px solid;"|<center><nowiki>"_VarName"</nowiki></center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>Yes</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>No</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>Any mod</center>
|-
!style="background:#ffeded;border-bottom:1px solid;"|<center>Private-Temporary</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center><nowiki>*</nowiki></center>
!style="background:#ffeded;border-bottom:1px solid;"|<center><nowiki>"*VarName"</nowiki></center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>No</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>Yes</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>Mod created by</center>
|-
!style="background:#ffeded;border-bottom:1px solid;"|<center>Private-Permanent</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>None</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center><nowiki>"VarName"</nowiki></center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>Yes</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>No</center>
!style="background:#ffeded;border-bottom:1px solid;"|<center>Mod created by</center>
|}
Anonymous user