The following table includes all Robot Battle events, the system variables that trigger the events, and the commands used to register and control events. Robots can handle events either by using the registration commands to establish event handler sections, or by manually examining the trigger variables and running code directly when the triggers change. Triggers can be manually reset using the clear command.

When an event handler is called, it always executes to either the last line of code in that section, or until a return statement is run. This does not mean execution will always go directly from the first to the last line of a handler section. Handlers may be preempted by higher priority events. If an event occurs that has a higher priority than the current event, the new higher priority event handler will be called immediately. The lower priority handler will not continue running until the higher priority handler completes.

When an event handler completes, the event that it handled is reset. This is done to prevent the same event handler from running continuously. The event handler will not be called again until the event it handles occurs again. There are two ways for events to be reset. Some events are simply either on or off, while other events count the number of occurrences. For on/off events, the event is turned off when its handler completes. For counted events, the event count is reduced by one when its handler completes. If the event count is greater than zero after the handler completes, the event is still occurring.

Event Trigger Registration Control
core automatic regcore coreevents
cookie detection _dtccookie regdtccookie dtccookieevents
mine detection _dtcmine regdtcmine dtcmineevents
robot detection _dtcrobot regdtcrobot dtcrobotevents
wall detection _dtcwall regdtcwall dtcwallevents
cookie collision _cldcookie regcldcookie cldcookieevents
mine collision _cldmine regcldmine cldmineevents
missile collision _cldmissile regcldmissile cldmissileevents
robot collision _cldrobot regcldrobot cldrobotevents
wall collision _cldwall regcldwall cldwallevents
radio message _radio regradio radioevents
radar ping _ping regping pingevents
auto scan _moving regascan ascanevents
custom boolean expression regcustom customevents

See Also

clear, event description