SetLocalString(object, string, string)
Store a string as a local variable within an object.
Target object to store local variable in.
Unique variable name.
Variable being stored in local object.
Stores sValue as a local string 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.
Caution should be used when setting a string on an object that has just been created. Instead of just using SetLocalString(object, string, string), one should use ActionDoCommand(SetLocalString(object, string, string)) to force the command to be added to the created creature's action queue. This ensures the string will be set, even on a freshly created object. Speculation suggests that this problem occurs because the "spawning initialization process" is still finishing on a newly created object, and it is difficult to determine exactly when "spawning initialization process" will complete.
Alternatively, whenever possible, set the local variable directly on the creature in the Toolset (available since version 1.59).
As with all locals, there seems to be no size limit to sVarName, however, anything over 50 characters is probably a bit extreme.
None (see Discussion)
// using something similar to:
// string sValue = GetLocalString(OBJECT_SELF, "foo");
object oThis = OBJECT_SELF;
string sKey = "foo";
string sValue = "some string";
SetLocalString(oThis, sKey, sValue);
author: Daniel Beckman, editors: Jasperre, Mistress additional contributors: Xepherys, Graziano Lenzi, Lilac Soul, Fireboar