Accessing object elements, Variables – Pinnacle Speakers DEKO500 User Manual

Page 121

Advertising
background image

Macro Programming Language

119

Deko500 User’s Guide

The

font

parameter specifies an object created by the

font

command, and the

look

parameter specifies an object created by the

look

command.

You create an object with a command. For example, the

rgb

command creates a

color object:

rgb red= green= blue=

The elements of an object correspond exactly with the of the command that created it.
The parameters of the

rgb

command represent the amounts of red, blue and green

that make up the color.

You can assign an object to a variable:

$gold = rgb 100 100 0

You can specify an object parameter with an embedded command, using parentheses:

ramp top_left=(rgb 60 60 0)

Accessing Object Elements

To access an element to edit its value or to assign it to a variable for use elsewhere,
use the element operator.

To edit

$gold

to re-specify the amount of green:

$gold:green = 80

To assign the green element of

$gold

to the variable

$grn

:

$grn = $gold:green

List

A list parameter, also known as a repeating parameter, specifies a list of one or
more values. Depending on the command, the values on the list may or may not be of
the same type. A command can have no more than one list parameter, which is
usually the last parameter.

The

message

command has a list parameter that specifies a list of

strings to output on the Status Bar:

message list=

message

"

Enter

" "

file

" "

name

" "

of

"

$song

V

ARIABLES

In Deko500, 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:

Advertising