The SetPersistentVal method saves a value to the persistent storage. The value is then available the next time the script is invoked and it is also accessible to other scripts.
SetPersistentVal(key, val)
Required. String that specifies the name of the value. The string may only contain upper and lower-case A–Z, the numeric characters, 0–9, underscore, dot and colon. Length of the string is limited to 255 characters. Value names are not case sensitive.
Value to be saved. Only string and integer data types are supported. To delete a value, set it to null.
Since the persistent values are shared among all scripts, you should ensure that you use a unique name for private values. Otherwise the name can clash with another script’s private value. By convention, the private name is formed according to the scheme [script_name][dot][value_name].
To retrieve the saved value, the script uses the GetPersistentVal method.
// set public value
Salamander.SetPersistentVal("PublicValueName", 6);
// set private value
Salamander.SetPersistentVal("ScriptName.PrivateValueName", "hello");
// delete the value
Salamander.SetPersistentVal("ValueToDelete", null);