CRPL Syntax Reference

CRPL the Language

CRPL is a stack-based, Reverse Polish Notation language. There, now that we've said it, what does it mean?

If you have ever programmed a HP calcualtor, or used the Forth language, you will know instantly what this means. For the rest of us, here is a simple explanation. For a more detailed explanation, , see the CRPL Tutorial.

Each CRPL instruction (term) uses one or more arguments that are on a "stack". The most recent argument on the stack will be used first.

You can place arguments on the stack by typing them, or an instruction that are executed can push arguments on to the stack. So, for instance, you can type 2 4 5 and then these three numbers are on the stack.

As an illustration, imagine you want to add two of the numbers you entered above, then the instruction to perform addition is "add," If you type "add" as your next instruction, then the instruction will read the two most recent arguments on the stack (4 and 5), add then and push the sum on to the stack. After the instruction has competed, there will be two numbers oin the stack. The "2" from your original entry, and "9" - the sum of the two arguments added by the "add" instruction.

Comments

adding comments makes code easier to unserstand, and sometimes helps the programmer or another reader to grasp complex pieces of logic. Also, after an absence, it refreshes one's mind about exctly what a certain piece of code was intended to do.

Comments in CRPL can be either a whole line or a partial line. The comment terminates when a line ends.

Comments are indicated by the "hash" character (#),


#this is a comment
2 3 add # add two numbers together

Stack notation

Every CRPL operand takes one or more arguments from a "stack", pushes one or more operands onto the "stacK, or does both. In order to diagram the number of arguments consumed or produced, the following notation is included in every description following:

For instance, the instruction to add two numbers are

4 5 add

Stack notation to represent this will be:

4 5 -- 9

Note:Unless explicitly noted otherwise, all instructions are destructive stack opeartions in that they will remove as many argumants as is required for their execution from the stack and replace theose with the output from their execution. In the example above, the original two items on the stack has been replaced by the sum.

Likewise, note that the most recent item pushed on to the stack will also be the first item to be removed. This is refferred to as LIFO (Last In, First Out) processing.

The following convention is followed to represent items on the stack notation

bBoolean ; nominally a 1 or a zero, representing True or False
iInteger ; an integer. The CRPL run-time will, if possible, convert the argumant to an integer.
nTerm ; a generic argument. Any term that will be accepted by the instruction. If possible, the CRPL run-time will attempt conversion between types.
fFloat ; a floating point value. If possible, the CRPL run-time will attempt conversion between types.
x, yCoordinate ; an integer that represents a valid X- or Y-coordinate on the map.
sString ; a string of one or more text characters. If possible, numeric values will be converted at run-time.

Typographical conventions

The following typographical conventions are used in this reference document:

Normal text Used in most instances.
Instruction Refers to a CRPL language element or instruction.
Argument Refers to a an argument required for a CRPL instruction.
User Refers text that should be replaces with user-supplied values.

Editing CRPL

Any text editor can be used to edit crpl files. However, syntax hightlight and auto completion support files are provided for the freely available Notepad++ editor. Notepad++ can be obtained from here:

http://notepad-plus-plus.org/

Once Notepad++ is installed you can add syntax hightlight for the CRPL langage by downloading this file. RIGHT CLICK AND CHOOSE SAVE AS: CRPL-syntax.xml

To install into Notepad++ select Language from the menu, then click "Defined Your Language", then "import".

You can add keyword auto completion to Notepad++ by download this file. RIGHT CLICK AND CHOOSE SAVE AS: CRPL.xml

To install into Notepad++ you need to copy CRPL.xml to your Notepad++ install directory\plugins\APIs directory. Then, restart Notepad++. Next, go to the Settings/Preferences menu in Notepad++. Click the "Backup/Auto-Completion" tab. Check the "Enable auto-completion on each input" checkbox, and make sure the "Function completion" radio button is selected.

]]> $VARNAME:DEF_VAL $ -- Defines an input variable. Input variables are created at script start and assigned either the default value, or a value specified in the editor. <-VARNAME <- -- n1 An item read from VARNAME Reads the contents of the local variable VARNAME and pushes it to the stack. If VARNAME does not exist, 0 is pushed to the stack. Local variables persist across script invocations. i ]]> ->VARNAME -> Some item on the stack -- n1 Pops an item from the stack and stores it in the local variable named VARNAME. Local variables persist across script invocations. x1 20 ->y1 40 ->x2 50 ->y2 endonce ]]> -?VARNAME -? -- b1 0 or 1 depending on if VARNAME exists Checks to see if VARNAME exists (has been assigned). If so, 1 is pushed to the stack else 0. Local variables persist across script invocations. Spore endif ]]> <-! s1 -- n1 An item read from the variable named s1 Reads the contents of the local variable named s1 and pushes it to the stack. Since s1's contents can vary, this allows dynamic reading of variables. xyz # Build a string by concatenating "12" and "3". # The results is "123". Use that as the name of a var and read its contents. # The result of the read is pushed to the stack and traced. "12" "3" concat <-! trace ]]> ->! s1 n1 -- Pops a name of a variable and an item from the stack and stores the item in the variable. ! <-xyz trace ]]> -?! s1 -- b1 0 or 1 depending on if variable exists Takes a string from the stack and uses it as a variable name. Checks to see if the varialbe exists (has been assigned). If so, 1 is pushed to the stack else 0. if Cond b1 -- Evaluate the first element on the stack. If True, then execute statements that follow, up to the ehdif statement. If False, execution skips to the first statement following the endif statement. Any nonzero value is consierered True, a value of zero is False. else -- When the if statement evaluates to False, then the statements following the else, up to the endif, are executed instead. endif Cond -- Delimits the scope of an if-else-statement. Instructions between the if and endif statement are conditionally executed, depending on the results of the if evaluation. do Limit and Index i1 i2 -- The statements following the do, up to the loop statement, are executed repeatedly. Each iteration (loop), the initial value (Index) is incremented by one at the bottom of the loop and compared to Limit. When Index=Limit, excecution will proceed at the first statement following Loop. Loops can be nested, but no more than 3 deep. See also: I, J and K loop -- Terminates the Do instruction. Control flow will return to the Do instruction until the Index is equal to the Limit. I -- i1 Current loop index Current loop Index. Pushes the value of the current loop onto the stack. J -- i1 First outer loop Index First outer loop index. When loops are nested, this pushes the value of the first (or only) outer loop onto the stack. K -- i1 Second outer loop Index Outer loop index. When loops are nested, this pushes the value of the outermost loop onto the stack. while -- Beginning of a while loop. The statements between a 'while' and a 'repeat' should ultimately push a value to the stack that will determine if the loop executes the body of the 'repeat' block y #create temp varialble "y" while <-y 0 gt # is y greater than zero? repeat #repeat this section of code <-y trace <-y 1 sub ->y #subtract 1 from y so we don't end in infinite loop endwhile #rinse and repeat until y is zero. ]]> repeat An item on the stack that determines if the body executes b1 -- Pops an item from the stack. If true, execute the following statements. If false, jump to the statement following 'endwhile'. endwhle -- Returns execution to the 'while' statement. Note that endwhile is only executed, if 'repeat' evaluated to true. break -- Immediately exits the body of a 'while/repeat/endwhile' block or a 'do/loop' block. once -- Start a block of instructions that are executed once only for the lifetime of the tower the script is associated with. endonce -- Ends a block defined by once. ClearLocals -- Clears all local variables. Local variables persist across script invocations. :FUNC_NAME : (user defined) Defines the beginning of a function block. Choose a unique name for the function. Statements after a function block only execute if called by invoking the function with an '@FUNC_NAME' call. The end of a function block is either the end of the script or the beginning of another function, whichever comes first. @FUNC_NAME @ (user defined) Invokes a function. Execution passes to the function that is named, and returns to the statement after the call when the function is complete. Arguments can be passed to and received from functions via the stack. :destroyed -- Special function that is automatically called on the final invocation of the core after it's destruction. dup Some item on the stack n1 -- n1 n1 Two copies of the item on the stack Duplicates the item currently on the stack without removing the original item. dup2 Two items on the stack n1 n2 -- n1 n2 n1 n2 A duplicate of the two original items Duplicates the top two items currently on the stack without removing the original pair. swap Two items on the stack n1 n2 -- n2 n1 The original two items, in reversed order Swaps the order of the top two items on the stack. pop An item on the stack n1 -- Removes the item at the top of the stack. ClearStack -- Remove all items from the stack leaving it empty. asint An item on the stack n1 -- i1 Converted item Converts an item on the stack to an integer, and pushes it back to the stack. asfloat An item on the stack n1 -- f1 Converted item Converts an item on the stack to a floating point number and pushes it back onto the stack. gt Two Values n1 n2 -- b1 true or false (1 or 0) Top two items are popped from the stack and 'Greater Than' comparison is performed. 0 or 1 is pushed back to the stack where 1 indicates true. gte Two Values n1 n2 -- b1 true or false (1 or 0) Top two items are popped from the stack and 'Greater Than or Equal' comparison is performed. Â 0 or 1 is pushed back to the stack where 1 indicates true. lt Two Values n1 n2 -- b1 true or false (1 or 0) Top two items are popped from the stack and 'Less Than' comparison is performed. 0 or 1 is pushed back to the stack where 1 indicates true. lte Two Values n1 n2 -- b1 true or false (1 or 0) Top two items are popped from the stack and 'Less Than or Equal' comparison is performed. 0 or 1 is pushed back to the stack where 1 indicates true. eq Two Values n1 n2 -- n3 true or false (1 or 0) Top two items are popped from the stack and 'Equal' comparison is performed. 0 or 1 is pushed back to the stack where 1 indicates true. neq Two Values n1 n2 -- b1 true or false (1 or 0) Top two items are popped from the stack and 'Not Equal' comparison is performed. 0 or 1 is pushed back to the stack where 1 indicates true. eq0 One Value n1 -- i1 true or false (1 or 0) Top item is popped from the stack and Compared to 0. 0 or 1 is pushed back to the stack where 1 indicates true. neq0 One Value n1 -- b1 true or false (1 or 0) Top item is popped from the stack and Compared to not being 0. 0 or 1 is pushed back to the stack where 1 indicates true. add Two items on the stack n1 n2 -- n3 The sum of two items dds the two arguments together and pushes the result on the stack. sub Two items on the stack n1 n2 -- n3 The difference of two items Subtracts the two arguments together and pushes the result on the stack. mul Two items on the stack n1 n2 -- n3 The product of two items Multiplies the two arguments together and pushes the result on the stack. div Two items on the stack n1 n2 -- n3 The quotient of two items Divides the two arguments together and pushes the result on the stack. mod Two items on the stack n1 n2 -- n3 The division remainder of two items Calculates the remainder of the two arguments and pushes the result on the stack. abs One item on the stack n1 -- n2 The Absolute Value of the item Calculates the absolute value of the item and pushes the result on the stack. and Two items on the stack n1 n2 -- n3 The conditional AND of the two arguments Pops two items from the stack, treats them as boolean values, 'ands' them, and pushes 0 or 1 back to the stack. or Two items on the stack b1 b2 -- b3 The conditional OR of the two arguments Pops two items from the stack, treats them as boolean values, 'ors' them, and pushes 0 or 1 back to the stack. xor Two items on the stack b1 b2 -- b3 The conditional NOR of the two arguments Pops two items from the stack, treats them as boolean values, 'xors' them, and pushes 0 or 1 back to the stack. not One items on the stack b1 -- b2 The NOT of the argument Pops one items from the stack, treats it as a boolean value, 'nots' it, and pushes 0 or 1 back to the stack. TRUE -- b1 1 Pushes a 1 to the stack. FALSE -- b1 0 Pushes a 0 to the stack. AbortMove -- Aborts the current unit movement, if any. Makes the next queued movement the current movement. AddCreeper X, Y, Amt x1 y1 n1 -- Adds Amt Creeper to the coords specified by X,Y. Amt can be positive or negative. ClearQueuedMoves -- Removes all queued movements, but does not abort or remove the current movement. CreateRunner X, Y, Move, Health, Payload x1 y1 n1 -- Creates a Runner at map coordinates X,Y. Movement speed in pixels per second is specified by Move (2 would be typical). Health is number of hit points with 10 being typical. The payload is the amount of Creeper the runner carries. CreateSpore startX, startY, targetX, targetY, Health, Payload x1 y1 x2 y2 n1 n2 -- Creates a spore at map coordinates startX,startY that moves to targetX,targetY. Health is number of hit points with 1 being typical. The payload is the amount of Creeper the spore carries. If any source or target coordinate is off the map, the spore will not be created. CurrentCoords -- x1 y1 X and Y coord of unit Pushes the current unit's X coordinate and Y coordinate to the stack. CurrentX -- x1 X coord of unit Pushes the current unit's X coordinate to the stack. CurrentY -- y1 Y coord of unit Pushes the current unit's Y coordinate to the stack. SetCurrentCoords x1 y1 -- Sets the current unit's X coordinate and Y coordinates. SetCurrentX x1 -- Sets the current unit's X coordinate. SetCurrentY y1 -- Sets the current unit's Y coordinate. Delay Time n1 -- The number of game loops to wait before allowing execution to pass to the next command. Destroy Explosion Mode (0,1,2) n1 -- Destroys the current unit. WARNING: ENSURE YOU HAVE SAVED THE MAP BEFORE CALLING THIS! This call will destroy the unit and your script along with it. This call pops an int from the stack as an argument and uses that to determine whether to create an explosion. 0 means no explosion, 1 means a small soundless flash, 2 or higher means a full explosion with sound. Distance Two sets of coordinates x1,y1 x2,y2 x1 y1 x2 y2-- f1 Calculates the distance between two map points (x1,y1) to (x2,y2) and pushes the resulting floating point number to the stack. GetCommandNodeCount -- n1 Number of Command Nodes Pushes the number of landed command nodes to the stack. GetCreeper X, Y x1 y1 -- n1 Amount of Creeper at Coordinates Pushes the amount of Creeper at map coordinates X,Y. GetDigitalis X, Y x1 y1 -- n1 Amount of Digitalis at Coordinates Pushes the amount of digitalis at map coordinates X,Y. Digitalis will be between 0 and 1. 0 means no Digitalis is present and 1 means full health Digitalis is present. GetDigitalisGrowth X, Y x1 y1 -- i1 Boolean representing if Digitalis growth area is preset at X,Y Pushes a 1 if Digitalis growth is present, 0 otherwise. GetGlobalRunnerCount -- n1 Number of alive runners on the map. Pushes to the stack the number of currently alive Runners. GetQueuedMoveCount -- n1 Number of movement orders currently in the movement queue. Looks at the movement queue and returns the number of movement orders. If the queue is empty, there are no movement orders and the unit is stationary. GetRunnerCount -- n1 Number of alive runners created by this core. Pushes to the stack the number of currently alive Runners that were created by this core. GetTerrain X, Y x1 y1-- n1 Height of terrain. Pushes to the stack the height of the terrain cell. GetTimer0 -- n1 Count for timer 0. Gets the current value of timer 0. Timers are set to some value, and then decrease by 1 each game frame (even if the core is in a Delay). GetTimer1 -- n1 Count for timer 1. Gets the current value of timer 1. Timers are set to some value, and then decrease by 1 each game frame (even if the core is in a Delay). GetTimer2 -- n1 Count for timer 2 Gets the current value of timer 2. Timers are set to some value, and then decrease by 1 each game frame (even if the core is in a Delay). GetTimer3 -- n1 Count for timer 3 Gets the current value of timer 3. Timers are set to some value, and then decrease by 1 each game frame (even if the core is in a Delay). GetUnitCountInRange X, Y coordinate, and Range (radius) x1 y1 n1 -- n2 Unit Count The number of player units within range of the coordinates. Only landed units are counted. GetUpdateCount -- n1 Update Count Pushes the core's update count to the stack. The update count goes up by one for each game update and starts at 0. GetVoid X, Y x1 y1 -- i1 0 or 1. If the terrain cell is void space a 1 is pushed to the stack, 0 otherwise. GetWall X, Y x1 y1 -- i1 0 to 1 Pushes to the stack the value of the wall at the cell coordinates. 0 represents no wall and 1 represents a wall of full health. Values in between represent varying degrees of health for the wall. HideTraceLog -- Turns off the trace window. MapHeight -- n1 Height of map Pushes the map height to the stack. MapWidth -- n1 Width of map Pushes the map width to the stack. QueueMove X,Y coordinate to move to and the speed x1 y1 n1 -- X and Y are map coordinates and the speed is in pixels per second. Queued movements go into a queue and are processed one at a time. RandFloat -- f1 Random Float between 0 and 1 Pushes a random float to stack where 0 <= RandFloat < 1. RandInt Min, Max n1 n2 -- n2 Random Integer Pops Min and Max from the stack and pushes a random integer to stack where min <= RandInt < max. RandCoords -- x1 y1 Random Map X and Y coords Pushes two random integers to stack where 0 <= RandNum < Map Width. RandCoordsInRange X,Y center point and a range x1 y1 n1 -- x2 y2 Random Map X and Y coords within range of source point Pushes two random map coordinates to the stack where the coordinates are within 'range' distance from the specified X,Y coordinates. RandUnitCoords -- x1 y1 X, Y coords of a random player unit Pushes the x and y coordinate of a randomly chosen player unit. -1,-1 will be pushed if no unit is found. RandXCoord -- x1 Random Map X coord Pushes a random integer to stack where 0 <= RandNum < Map Width. RandYCoord -- y1 Random Map Y coord Pushes a random integer to stack where 0 <= RandNum < Map Height. Round A number, number of decimal places n1 n2 -- n3 Rounded off number Rounds off a number to the specified number of decimal places. Self -- n1 Unit UID for current unit Pushes the unique unit ID (an int) for the current unit to the stack. SetCreeper X, Y, Amt x1 y1 n1 -- Sets Amt of Creeper at coordinates. Positive values are Creeper and negative values are AntiCreeper. Values are clipped to the range of -2000 to 2000. SetCreeperNoLower X, Y, Amt x1 y1 n1 -- Same as SetCreeper, except the Creeper will not be lowered if the existing Creeper in the cell is currently higher than the value being set. Properly handles Creeper and AntiCreeper. SetDigitalis X, Y, Amt x1 y1 n1 -- Sets Amt of Digitalis at coordinates. An Amt of 1 means fill health Digitalis, and 0 means no Digitalis. SetDigitalGrowth X, Y, Present x1 y1 b1 -- Set Digitalis Growth at coordinates. If 'Present' is 1, growth is created. If 0, growth is removed. SetTerrain X, Y, Level x1 y1 n1 -- Sets the height of the terrain cell at X,Y. Level must be in the range of 0-9. SetTimer0 The value to set timer 0 to. n1 -- Sets the current value of timer 0. Timers are set to some value, and the decrease by 1 each game frame (even if the core is in a Delay). SetTimer1 The value to set timer 1 to. n1 -- Sets the current value of timer 1. Timers are set to some value, and the decrease by 1 each game frame (even if the core is in a Delay). SetTimer2 The value to set timer 2 to. n1 -- Sets the current value of timer 2. Timers are set to some value, and the decrease by 1 each game frame (even if the core is in a Delay). SetTimer3 The value to set timer 3 to. n1 -- Sets the current value of timer 3. Timers are set to some value, and the decrease by 1 each game frame (even if the core is in a Delay). SetVoid X, Y x1 y1 -- Sets the terrain cell at X,Y to void space. SetWall X, Y, Amt(0-1) x1 y1 b1 -- Sets wall values at specified coordinates. The amount must be in the range of 0 to 1 where 0 means no wall, and 1 means a full health wall. ShowTraceLog -- Turns on the trace window so that the user can see the trace log. ClearTraceLog -- Clears the trace log. SuspendMove Number of frames to delay movement n1 -- Pops a delay from the stack and uses it to suspend the current unit movement, if any. Movement automatically resumes after the suspension has expired. Trace String or other data n1 -- Pops an item from the stack and adds it to the trace log. The item will be treated as a string. The trace log is limited to 512 entries and will automatically purge older entries first. Trace2 Two items n1 n2 -- Pops two items from the stack and adds them to the trace log, separates by a space. The items will be treated as strings. Trace3 Two items n1 n2 n3 -- Pops three items from the stack and adds them to the trace log, separates by a space. The items will be treated as strings. Trace4 Two items n1 n2 n3 n4-- Pops four items from the stack and adds them to the trace log, separates by a space. The items will be treated as strings. Trace5 Two items n1 n2 n3 n4 n5-- Pops five items from the stack and adds them to the trace log, separates by a space. The items will be treated as strings. TraceStack -- Dumps the stack to the trace log. Does not pop anything from the stack. IsDigitalisConnected X and Y coordinate x1 y1 -- b1 Boolean (0 or 1) indicating connected state of Digitalis. Return a boolean (0 or 1) indicating if the digitalis at the specified coordiantes is connected to a structure that supports the growth of Digitalis. concat Two strings s1 s2 -- s3 A string that is the concatenated version of the two input strings. Takes two strings from the stack and concatenates them. The result is pushed back to the stack. sin A floating point angle, in radians f1 -- f2 The sine of the input angle Calculates the sine of the input angle cos A floating point angle, in radians f1 -- f2 The cosine of the input angle Calculates the cosine of the input angle tan A floating point angle, in radians f1 -- f2 The tangent of the input angle Calculates the tangent of the input angle asin A floating point number f1 -- f2 The arcsine of the input number Calculates the arcsine of the input angle acos A floating point number f1 -- f2 The arccosine of the input number Calculates the arccosine of the input angle atan A floating point number f1 -- f2 The arctangent of the input number Calculates the arctanget of the input angle atan2 A floating point number f1 f2 -- f3 The arctan of the input number Computes and returns the angle of the point y/x in radians. The return value is between positive pi and negative pi. Note that the first parameter to atan2 is always the y coordinate. PI -- f1 PI (3.14159265...) Pushes the value of PI to the stack. SetImage A unit UID, image slot, and custom unit name i1 s1 s2 -- Sets the unit image for the specified slot. Slot is an arbitrary name used to identify which image to set. The slot named "main" refers to the primary unit image (the one that can be set in the editor). The image name must refer to one of the image names that can be set on a unit. The combo box in the editor for setting the primary unit image contains a list of valid strings. SetImagePosition A unit UID, image slot, X, Y, Z coordinates i1 s1 f1 f2 f3 -- Sets the coordinates (in floating point pixel space) of the image. 0,0,0 is the exact center of the unit. Negative z values are closer to the camera. SetImagePositionX A unit UID, image slot, X coordinate i1 s1 f1 -- Sets the X coordinate (in floating point pixel space) of the image. 0,0,0 is the exact center of the unit. Leaves the Y and Z coordinate as is. SetImagePositionY A unit UID, image slot, Y coordinate i1 s1 f1 -- Sets the Y coordinate (in floating point pixel space) of the image. 0,0,0 is the exact center of the unit. Leaves the X and Z coordinate as is. SetImagePositionZ A unit UID, image slot, Z coordinate i1 s1 f1 -- Sets the Z coordinate (in floating point pixel space) of the image. 0,0,0 is the exact center of the unit. Leaves the X and Y coordinate as is. SetImageRotation A unit UID, image slot, rotation in radians i1 s1 f1 -- Sets the rotation of the image (in radians). SetImageScale A unit UID, image slot, x scale, y scale i1 s1 f1 f2 -- Sets the scale of the image. A value of 1 means to show the image at the normal size. A value of 2 would be double size, and 0.5 would be half. SetImageScaleX A unit UID, image slot, x scale i1 s1 f1 -- Sets the X scale of the image. A value of 1 means to show the image at the normal size. A value of 2 would be double size, and 0.5 would be half. SetImageScaleY A unit UID, image slot, y scale i1 s1 f1 -- Sets the Y scale of the image. A value of 1 means to show the image at the normal size. A value of 2 would be double size, and 0.5 would be half. SetImageColor A unit UID, image slot, red, green, blue i1 s1 i2 i3 i4 -- Sets the color of the light shining on the sprite. Red, Green, and Blue values are in the range of 0-255. CONST_COORDX -- i1 Integer const for Get/SetAtrribute Pushes the integer constant for getting/setting the x coordinate when using get/setattribute CONST_COORDY -- i1 Integer const for Get/SetAtrribute Pushes the integer constant for getting/setting the y coordinate when using get/setattribute CONST_HEALTH -- i1 Integer const for Get/SetAtrribute Pushes the integer constant for getting/setting the helath when using get/setattribute CONST_MAXHEALTH -- i1 Integer const for Get/SetAtrribute Pushes the integer constant for getting/setting the maximum health when using get/setattribute CONST_AMMO -- i1 Integer const for Get/SetAtrribute Pushes the integer constant for getting/setting the ammo when using get/setattribute CONST_MAXAMMO -- i1 Integer const for Get/SetAtrribute Pushes the integer constant for getting/setting the maximum ammo when using get/setattribute CONST_AMMOAC -- i1 Integer const for Get/SetAtrribute Pushes the integer constant for getting/setting the AC ammo when using get/setattribute CONST_MAXAMMOAC -- i1 Integer const for Get/SetAtrribute Pushes the integer constant for getting/setting the maximum AC ammo when using get/setattribute CONST_ISDESTROYED -- i1 Integer const for GetAtrribute Pushes the integer constant for getting the destroyed state when using getattribute. This constant has no effect when used with SetAttribute. CONST_GETATTRIBUTE Unit UID, Attribute Constant i1 i2 -- n1 The resulting value for the attribute GetAtrribute allows you to query various attributes (see CONST* commands) on different units. CONST_SETATTRIBUTE Unit UID, Attribute Constant, Some Value i1 i2 n1 -- SetAtrribute allows you to set various attributes (see CONST* commands) on different units. CreateUnit Unit Name, X, Y s1 x1 y1 -- i2 The UID of the created unit. 0 if the unit was not created. Create a unit at the X and Y coordinates. The name of the unit must be one of the following. Names are NOT case sensitive. [ CRPLCORE COLLECTOR RELAY REACTOR OREMINE SIPHON TERP GUPPY PULSECANNON MORTAR STRAFER BOMBER SPRAYER NULLIFIER SHIELD BEAM SNIPER BERTHA POWERZONE OREDEPOSIT ENERGYDEPOSIT0 ENERGYDEPOSIT1 ENERGYDEPOSIT2 ENERGYDEPOSIT3] AddScriptToUnit Unit UID, Script Name i1 s1 -- Adds a script to a unit. The script name must match (including extension) the name of a compiled script unit <-unit "Emitter.crpl" AddScriptToUnit ]]> SetScriptVar Unit UID, Script Name, Var Name, Data to set i1 s1 s2 d1 -- Sets the value of some variable on a script. Useful for setting up variables on newly created units, or for managing children units. unit <-unit "Emitter.crpl" AddScriptToUnit <-unit "Emitter.crpl" "amtToEmit" 50 SetScriptVar <-unit "Emitter.crpl" "interval" 5 SetScriptVar ]]> GetScriptVar Unit UID, Script Name, Var Name i1 s1 s2 -- d1 Some value Gets the value of some variable on a script. Useful for getting variables on newly created units, or for managing children units. unit <-unit "Emitter.crpl" AddScriptToUnit <-unit "Emitter.crpl" "amtToEmit" 50 SetScriptVar <-unit "Emitter.crpl" "interval" 5 SetScriptVar <-unit "Emitter.crpl" "interval" GetScriptVar trace ]]>