Variables

<< Click to Display Table of Contents >>

Navigation:  Advanced Features > Scripting >

Variables

Use a variable for recurring tasks and assign a value to it.

Global variables are listed in the project explorer.

Local variables are only used in a single script.

Use variables in script commands instead of fixed numbers.

Global Variables

Creating a Variable:

Go to MAIN MENU -> CREATE -> Variable

A new section is created in the project explorer called Variables.

This is where the newly created variable is listed.

variable_project-explorer_zoom75

Assign a Value

The current value of a variable can be assigned in the inspector:

variable_inspector_zoom75

Of course, you can assign values to a variable via script commands in any scripting field or in the command section of the status bar:
 

VariableName.Value = ##

Variable1.Value = 10

Use a Variable
 
Use a variable in script commands instead of the expected value:
 
Without Variable

Playback2.MixLevel.FadeValue 1, 10

With Variable

Playback2.MixLevel.FadeValue 1, Variable1.Value

 

You are allowed to rename a variable from default name to let's say FadeInTime.
If renamed, you can use either Variable1.Value or FadeInTime.Value in script commands.

Local Variables

Local Variables are only valid in a single script.

You can assign a value to your local variable and use it on different lines in a script.

Create a Variable in a Script Command

All the information about syntax can be found here: Script Command - Local Variables

Local variables are only valid in their particular script. Unlike global variables, it is impossible to use them in other scripts or with other script commands.

The variable's name is only valid for this particular script.

 

Script Parameters

It is possible assign parameters to a script.

These parameters can be used as local variables in the script.

Read more about parameters for scripts: Run a Script with Parameters.