Variables
Last updated
Last updated
Variables are used to store choices that do not have direct consequences and can be retrieved later on for certain repercussions. For example if a character picks up a tool which might come in handy later on, this can be saved in a variable. The same applies if the protagonist makes a friend or a good deal which will be relevant later on in the script.
After a Variable is declared in the script, it is available throughout and can be set at any given time in the script.
All variables are added through the Add button located in the Menu Bar under "Document ▸ Variables…" before inserted into the script. Variables can be named freely, however, they cannot contain spaces, or begin with numbers. The users should also refrain from using a number of keywords listed below:
For more information on the coding language see Lua lexical conventions.
After a variable is added to the list, it is then assigned a type and a default value.
There are three different types of variables available in the CtrlMovie Creator App. These are: True/False, Number or Text. The values declared for these variables are the values they have when the movie starts.
Variables can be inserted into the script at any given point, to mark an event that holds an importance for the rest of the script. They are added to the ends of segments through the “Variable” button situated on the right upper corner of the screen.
After the Variable is added to the script, the value can be set through the text box in the tab on the right, under Inspect. True/false type variables are set as either true or false, a number value is given any numerical value and the text type variables have a text value. It is important to note that the inserted text value should not be put in quotation marks but only as text (ex. MayThinks = loser
would be the correct form, as opposed to; MayThinks = 'loser'
which would be wrong).
A Script is run when a more complex string needs to be entered into the script. An example of when to use script would be to express when a variable gains value (ex. MayLikesMatt = MayLikesMatt +1
).
A number type Variable can be changed incrementally by running a Script. This can be done through the Script button on the top right corner of the screen or in the Menu Bar under "Document ▸ Insert Action ▸ Run Script". These increases in the value of a variable are recorded (if in the example previously given MayLikesMatt had a value of 8, it would now be 9).
Further information on the use of Scripts, see the Lua Manual.