DeleteLocalInt(object, string)
Deletes oObject's integer variable sVarName.
void DeleteLocalInt( object oObject, string sVarName );
Parameters
oObject
The object storing the variable.
sVarName
Variable name to delete.
Description
Use this function to delete an object's entry for the integer defined by sVarName.
Remarks
As with all deletions, once removed, GetLocalInt returns 0. Cleaning up old variables can help CPU performance if many are stored on one object (especially a module).
Version
1.22
Example
// If the variable "nTimes" is 4 or more, we delete it, else increase it by 1. // Could go in an area enter script, or a trigger script for some purpose void main() { // Declare the entering object object oPC = GetEnteringObject(); int nTimes; // Make sure they are a PC if(GetIsPC(oPC)) { // Get nTimes nTimes = GetLocalInt(oPC, "nTimes"); // Is it 4 or more? if(nTimes >= 4) { // Delete it (resets to 0) DeleteLocalInt(oPC, "nTimes"); } else { // Add one to it and store nTimes++; SetLocalInt(oPC, "nTimes", nTimes); } } }
See Also
categories: | Local Variables Functions |
author: Michael Nork, editor: Jasperre
Send comments on this topic.