Pinnacle Speakers FXDEKO User Manual

Page 163

Advertising
background image

Macro Programming Language

163

FXDeko User’s Guide

The following macro creates, then runs the macros “boy” and “girl” as
subroutines.

command boy

type "It’s a boy!"

end

command girl

type "It’s a girl"

end

if $name == "Amy"

girl

elseif $name == "Meg"

girl

elseif $name == "Mickey"

boy

end

The subroutines “boy” and “girl” are local to this macro. When the macro ends,
the subroutines, like the variables, vanish.

R

ETURN

V

ALUES

The return command directs FXDeko to stop the current macro or subroutine
and return the value of its expression parameter to the macro that called it.

return [expression=]

For example, you might have a simple command called test that returns 1 if
successful, or 0 if not:

command test

if $name == "Amy"

return 1

else

return 0

end

The subroutine test can then be called from another macro:

$result = test

if $result == 1

type "It’s a girl"

end

Here are a few examples of FXDeko commands that return values:

$squareroot = sqrt 4.

sqrt

returns the real value 2.

$test = file_open

"moon over miami"

file_open

returns 1 if FXDeko successfully opens "moon over miami", or 2 if

not.

$color = rgb 0 0 100

The rgb command creates and returns a color object that is then assigned to the
variable $color.

Advertising