SetLocalInt(object, string, int)

Store a number as a local variable within an object.

void SetLocalInt(
    object oObject,
    string sVarName,
    int nValue
);

Parameters

oObject

Target object to store local variable in.

sVarName

Unique variable name.

nValue

Variable being stored in local object.


Description

Stores nValue as a local number within oObject using the variable name sVarName. The parameter sVarName is a unique string identifying a single local variable. Using the same value for sVarName in subsequent calls will overwrite the original value.



Known Bugs

Setting a value to a newly created object has some particular nuances. See SetLocalString(object, string, string) for more information.

Alternatively, whenever possible, set the local variable directly on the creature in the Toolset (available since version 1.59).


Version

1.61

Example

void main()
{
     object oThis = OBJECT_SELF;
     string sKey = “foo”;
     int iValue = 2;
     // sets the value of 2 tied to the key "foo" on the caller.
     // this value can be later retrieved using GetLocalInt.
     SetLocalInt(oThis, sKey, iValue);
}

See Also

functions: GetLocalInt | SetLocalArrayInt
categories: Local Variables Functions


 author: Daniel Beckman, editor: Lilac Soul, additional contributor(s): Xepherys, Graziano Lenzi, Lilac Soul
 Send comments on this topic.