IAdvancedRobotPeer 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:
<see cref="T:Robocode.BattleEndedEvent" />:     100 (reserved)
              <see cref="T:Robocode.WinEvent" />:             100 (reserved)
              <see cref="T:Robocode.SkippedTurnEvent" />:     100 (reserved)
              <see cref="T:Robocode.StatusEvent" />:           99
              Key and mouse events:  98
              <see cref="T:Robocode.CustomEvent" />:           80 (default value)
              <see cref="T:Robocode.MessageEvent" />:          75
              <see cref="T:Robocode.RobotDeathEvent" />:       70
              <see cref="T:Robocode.BulletMissedEvent" />:     60
              <see cref="T:Robocode.BulletHitBulletEvent" />:  55
              <see cref="T:Robocode.BulletHitEvent" />:        50
              <see cref="T:Robocode.HitByBulletEvent" />:      40
              <see cref="T:Robocode.HitWallEvent" />:          30
              <see cref="T:Robocode.HitRobotEvent" />:         20
              <see cref="T:Robocode.ScannedRobotEvent" />:     10
              <see cref="T:Robocode.PaintEvent" />:             5
              <see cref="T:Robocode.DeathEvent" />:            -1 (reserved)

Note that you cannot change the priority for events with the special priority value -1 or 100 (reserved) as these event 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.RobotInterfaces.Peer
Assembly: robocode (in robocode.dll) Version:

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