A variable is a symbol that holds and represents a value. Variable symbols are names such as x, MyVariable, or lcd.backlight. Variables can hold numbers (such as 3 or 12.7) or strings (such as Hello World).
CueServer uses two different kinds of variables: User Variables and System Variables. User variables can be any combination of printable letters, numbers, the underscore (_) or hyphen (-). System variables are similar, but must contain a dot (.) character. The dot character is how the CueServer distinguishes between User and System variables.
Assigning Values to Variables
There are two ways to assign a value to a variable. The first is with the Assign (=) command. Here are a few examples:
"x" = 3 |
Sets variable x to the number 3 |
"MyVariable" = 42 |
Sets variable MyVariable to the number 42 |
"Message" = "Hello World" |
Sets variable Message to the string “Hello World” |
"y" = ('x' + 3) |
Sets variable y to the result of the expression ‘x’ + 3 |
"caption" = ("Press " + 'y' + " to Start") |
Sets variable caption to the string Press 6 to Start |
"caption" = "Press ${y} to Start" |
Sets variable caption to the string Press 6 to Start |
The second way to assign a value to a variable is with the Set command. Here are a few examples:
Set x 3 |
Sets variable x to the number 3 |
Set MyVariable 42 |
Sets variable MyVariable to the number 42 |
Set Message "Hello World" |
Sets variable Message to the string “Hello World” |
Set y ('x' + 3) |
Sets variable y to the result of the expression ‘x’ + 3 |
Set caption ("Press " + 'y' + " to Start") |
Sets variable caption to the string Press 6 to Start |
Set caption "Press ${y} to Start" |
Sets variable caption to the string Press 6 to Start |
These examples are the same as above, except that the Set command is used instead of using the Assign command.
Using Variable Values
To use variables in CueScript commands, enclose the variable name in single quotes ( 'MyVariable' ).
For example, using the variable values set from above, the following variable substitutions would be made:
Cue 'x' Go |
Executes Cue 3 |
Macro 'MyVariable' |
Runs Macro 42 |
Set lcd.top 'Message' |
Displays “Hello World” on the top line of the LCD |
Log 'y' |
Writes “6” to the System Log |
Write COM1 'caption' |
Sends “Press 6 to Start” to the RS-232 port |
Using Variable Values as Commands
To use variables values in CueScript as commands, enclose the variable name in accent quotes ( `myCommand` ).
The following example script shows how to assign a string that contains valid CueScript text to the variable myCommand. On the second line of script, if the variable x is greater than 3, then the commands in myCommand will be executed.
"myCommand" = "Cue 1 Go"
If ('x' > 3) Then `myCommand`
Using System Variables
Special System Variables are used to set the properties of hardware devices, or to change internal behaviors of the CueServer. All system variables include a dot ( . ) in their name, for example lcd.backlight, or universe.priority.
The following example changes the brightness of the front-panel LCD display to 50%:
Set lcd.backlight 50
See the section on System Variables for a detailed listing of available system variables and how they are used.

