Macro Programming Language 128
Deko500 User’s Guide
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 b efore 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 whi c h you must convert a value of one da t a 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. Deko500 truncates the real number. To round numbers accurately, add
.5 to the real number.
$a = 12.7
$b = integer $a+.5
$b equals 13
To convert a number value to a string:
Do one of the following:
Use the command: num2str