AdvancedRobot SetEventPriority Method Robocode Robot API for .NET
Sets the priority of a class of events.

Events are sent to the onXXX handlers in order of priority. Higher priority events can interrupt lower priority events. For events with the same priority, newer events are always sent first. Valid priorities are 0 - 99, where 100 is reserved and 80 is the default priority.


SetEventPriority("RobotDeathEvent", 15);

The default priorities are, from highest to lowest:
WinEvent:             100 (reserved)
                SkippedTurnEvent:     100 (reserved)
                StatusEvent:           99
                CustomEvent:           80
                MessageEvent:          75
                RobotDeathEvent:       70
                BulletMissedEvent:     60
                BulletHitBulletEvent:  55
                BulletHitEvent:        50
                HitByBulletEvent:      40
                HitWallEvent:          30
                HitRobotEvent:         20
                ScannedRobotEvent:     10
                PaintEvent:             5
                DeathEvent:            -1 (reserved)

Note that you cannot change the priority for events with the special priority value -1 or 100 (reserved) as these events are system events. Also note that you cannot change the priority of CustomEvent. Instead you must change the priority of the condition(s) for your custom event(s).

Namespace: Robocode
Assembly: robocode (in robocode.dll) Version:

public void SetEventPriority(
	string eventClass,
	int priority


Type: OnlineSystem String
The name of the event class (string) to set the priority for
Type: OnlineSystem Int32
The new priority for that event class
See Also