In the previous sessoin you saw how to assign values to NWN2 Local Variables. In this session you will see how to get the values from previously declared and defined NWN2 Local Variables.
NWN2 Local Variables General Form
To get a value from a previously declared and assigned NWN2 Local Variable:
GetLocakType(Object, "Identifier");
Where:
Type is one of three allowed data types of: Int, Float, or String.
Object is any legal NWN2 object.
Identifier is the token used to identify the variable, this may be any string that has previously been assigned to the given Obejct
NWN2 local Variable Examples:
The following program illustrates examples of getting values from previously declared and assigned NWN2 Local Variables assigned to the PC, with the three different NWN2 Local Variable data types.
Keyword for getting a value from a NWN2 Local Variable of data type Integer (int).
oSelf
Identified object. In this case the local variable is associated with the PC.
"MyFLoat"
The variable identifier. Note that it is of data type string and must be enclosed in quotes.
intValue
The variable that will receive the previously assigned value. Note that this must be a data type int.
For the GetLocalFLoat()
Term
Meaning
GetLocalFloat
Keyword for getting a value from a NWN2 Local Variable of data type Float (float).
oSelf
Identified object. In this case the local variable is associated with the PC
"MyFloat"
The variable identifier. Note that it is of data type string and must be enclosed in quotes.
fltValue
The variable that will receive the previously assigned value. Note that this must be of data type float
For the GetLocalString()
Term
Meaning
GetLocalString
Keyword for getting a value from a NWN2 Local Variable of data type String (string.)
oSelf
Identified object. In this case hte local variable is associated with the PC.
"My String"
The variable identiifer. Note that it is of data type string and must be enclosed in quotes.
"stgValue"
THe variable that iwll receive the previously assigned value. Note that thi smust be of data type string.
Where do we go from here?
This concludes the section on NWN2 Global and Local variables.
Nwn2Scripting provides material for training only. We do not warrant the correctness of its contents.
The risk from using it lies entirely with the user.
While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 2008 by Adamson House, Ltd. All Rights Reserved.