Another thing I just remembered from my first days of scripting:
The Set page is focused on numerical variables and is kind of poor on explanations/examples on setting a ref variable. (the 'punch line' does not even mention it)
I wrote the text below to illustrate what I think is missing. If you agree to add something along these lines, please feel free to correct and rephrase the text at will (I am not good with creating text, even in my native language)
- - - - - - - - - - - - - - -
Main line:
Sets a local or global variable to a specified value. This value can be a number, an expression
, a Reference or a Base Object.Notes:
?You can set a reference variable to a Base Object and use that variable in later functions:
Ref MyAppleSet MyApple to ApplePlayer.AddItem MyApple 1
?You can also set a reference variable to a Reference.
To be used in a script, the Reference must be a persistent item added in the CS (non-dynamic)
Supposing you added an apple to a cell in CS, marked it as persistent and named it Apple01:
Ref MyAppleSet MyApple to Apple01
?Reference variable can be set to References or Base Objects returned by script functions:
ref selfref myBaseset self to getSelfset myBase to self.getBaseObject
?The Set command can also be used to set a variable to a variable in another script
Short CountRef ItemSet Count to MyScriptedObject.Count Set Item to MyScriptedObject.Item