Robot instructions reference

All robot instructions take their arguments on the user stack, and returns any information on the user stack. Remember to pop off any values returned even if you don't use them.

Instruction Arguments Return value Description
setspeed speed Sets the speed to speed. It will take a certain ammount of time until the actual speed reaches that specified using this instruction. The time depends on the acceleration power or brake power.
getspeed speed Returns the current speed.
setheading heading Sets the heading. The robot will start turning towards this heading. The speed depends on the robots turn speed.
getheading heading Returns the current heading.
getxcoordinate x-coordinate Returns the robots x coordinate.
getycoordinate y-coordinate Returns the robots y coordinate.
getmaxspeed max-speed Returns the robots maximum speed
getscannerstatus status Returns the current scanner status. You can't use the scanner until this value is 0.
uptime time Returns the time since the game started.
scan direction,width status Scan for other robots. The the scanner looks in a width wide arc at the angle direction. The scanner status before the scan is returned. That is, if the return value is greater than 0 then the scan was not perfomed.
wallscan direction,range status Not yet documented.
fire direction status Fire the weapon. The weapon status before firing is returned. That is, if the return value is greater than 0 then the weapon was not fired.
send dest,id,len,msgptr status Send a message to a channel. dest is the channel to which this message is sent, id is the message id, len is the length of the message, msgptr is the address where the message is stored. The number of robots that received the message is returned.
receieve msgptr Receieve a message.
discard Discard a message from the list of pending messages.
setchannel newchan Selects the channel on which to listen for messages.
addtimer attime id Sets a timer to expire in attime updates. Returns a unique timer id.
deltimer id Deletes the timer with id id.