Pinnacle Speakers FXDEKO User Manual

Page 155

Advertising
background image

Macro Programming Language

155

FXDeko User’s Guide

V

ARIABLES

In FXDeko, a variable name can include any upper or lower case alphanumeric
character as well as the special character, underline (_). The first character is
always a dollar sign ($), and the character immediately after the dollar sign cannot
be a number.

To make macros easier to read and understand, it’s a good idea to use variable
names that are readily associated with the values they represent. For example, it’s
easy to guess what these variables are used for:

$age

$name

$phone

You do not explicitly declare a variable’s data type; the data type is determined
when a value is assigned to the variable.

These examples illustrate how variable assignment determines data type:

$i = 1

Integer

$XY = 3.5

Real

$message = "Goodbye Cruel World"

String

If you try to use an uninitialized variable, FXDeko stops executing the command
or macro and displays an error prompt.

A variable may be an element of an array, in which case its name is the name of
the array followed by a subscript that identifies its location in the array. A
subscript must be an integer or an expression that returns an integer.

For example, an array named $table might include these elements:

$table[3]

$table[42]

$table[$count+1]

$table[9999]

FXDeko allocates array elements as needed. The subscripted variables in the
above example will occupy only four variable slots, not ten thousand.

By default, most variables are local variables. A local variable is allocated
temporarily during macro playback, then deleted automatically when the macro
stops. One macro cannot reference a second macro’s local variables, even if the
second macro is a subroutine of the first.

Global variables must be declared with the global command, and can be
shared among multiple macros. Once declared, a global variable remains until you
either delete it by using the free command, or exit FXDeko.

FXDeko has a set of built-in global variables, known as system variables, which
provide information about the state of your system. System variables are
preceded by the at-sign symbol (@), and are often referred to as at-sign
variables
.

Some system variables are read-only; you cannot change their values. Examples
of read-only system variables are @lines and @dots, which describe the
current video standard, and the pre-defined colors @red, @blue and @green.

Advertising