Variables

Edward Updated by Edward

Variables can be defined and used in macros.  Once defined, the value of a variable may be set or altered as part of the macro or via the command line.  Variable names should not conflict with the normal command words used by NEO.  See Command Reference for a list of reserved words.

Creating/editing Variables

To create new variables or edit existing ones, click on the “Variables” tab.  To create a new variable, click on the “Add Variable” button.  A new line with the name “New Variable” will be added to the bottom of the list.  Click or double-click on each field to alter the value.  In addition to the name, the following can be set:

 

  • §  Value – Enter the value for a fixed variable or the initial value for an incremental variable.
  • §  Min & Max Values – Defines the range of an incremental variable.
  • §  Increment – Defines the value that will be added to (positive) or subtracted from (negative) the variable when it is referenced. 

 

Using Variables

Once a variable has been defined, it can be referenced and manipulated within a macro.  The value of a variable may be set or altered as follows:

 

  • §  {variable name} = {value} – Set the variable to an absolute value
  • §  {variable name} = RANDOM({value}) – Set the variable randomly between 0 and value
  • §  {variable name} = CHANNEL({number}) – set the variable to the value of the specified channel number
  • §  {variable name} = SUB({number}) – set the variable to the value of the specified submaster
  • §  {variable name} =+ {increment] – Add the increment value to the current value
  • §  {variable name} =- {decrement} – Subtract the decrement value from the current value

 

The macro “Channel Check” illustrates some uses for variables.  The first line initializes the variable “Checkchan” to the value set in “Startchan”.  Line 5 is a channel command where the value in “Checkchan” is the channel number and the value in “Level” is used to set the channel level.

 

If a variable has an increment value set, each time the variable is referenced it will be added to or subtracted from by the value.  For example, if “Checkchan” is equal to 1 when Line 5 is executed, it will be incremented by 1 after so if it is referenced again, it will have the value of 2, etc.  This is useful when used inside a loop (see below) to step incrementally through a set of values, such as channel number in this example.

 

How did we do?

Macro Editor

Conditional Events

Contact