Command Reference: Special Variables

What are Special Variables?

In order to make it easier to work with images, your scripts have access to a set of "special" variables. These variables behave like any other variable in your scripts, but they cannot be changed or set directly. Other languages would call variables like these "constants" or "environment variables".

These variables provide information about the editor, the current image, or just help keep things simple.

List of Special Variables

.ALPHA

This is a special color value that's used to represent a transparent pixel. Use this to make pixels transparent, or to exchange transparent pixels with another color.

 

.WIDTH
.HEIGHT

These provide the current width and height of the image, in pixels. You can change the dimensions of the current image using the IMAGE.RESIZE or IMAGE.SCALE commands.

 

.FG
.BG

These provide the currently selected foreground and background colors. Your scripts cannot change them, but you can usually provide another color to use instead (eg, FILTER.SWAP ).

 

.RESULT

This variable always holds the result of the last command. For example, MATH.ADD 2 2 sets .RESULT to 4. If you don't need to use this value, you can freely ignore it.

Project Hosted by
Download Mike\'s Sprite Editor