164 Working with Macros
FXDeko User’s Guide
OBJECTS
An object is a data structure created by a command. Typical objects in FXDeko
include colors, shaders, ellipses, rectangles, fonts and looks.
The elements of an object correspond exactly with the parameters of the
command that created it. Consider the rgb command, which creates a color:
rgb red= green= blue=
The parameters represent the amounts (from 0 to 100) of red, blue and green that
make up the color created by the rgb command.
You can assign an object to a variable:
$yellow = rgb 100 100 0
It is not necessary to assign objects to variables before passing them to other
commands. You can specify an object parameter with an embedded command,
indicated by parentheses:
ramp top_left=(rgb 100 100 0)
You can access any element of an object with the element operator (:), to edit the
element’s value or to assign it to a variable for use elsewhere.
To edit $yellow to make it a little less green:
$yellow:green = 80.
The green level of $yellow was 100. It is now 80.
To assign the green element of $yellow to the variable $grn:
$grn = $yellow:green
To determine the data type of an object, use the objtype command:.
objtype object=
DATA TYPE CONVERSIONS
You may encounter situations in which you must convert a value of one data
type to another data type. Use the following processes to convert various types
of data.
To convert an integer value to a real value:Add the integer to 0.0 or multiply it by 1.0.
$a = 123
$b = $a*1.0
$b equals 123.0
To convert a real value to an integer value:1. Use the command: integer
2. FXDeko truncates the real number. To round numbers accurately,
add .5 to the real number.
$a = 12.7