robocode
Class CustomEvent
- Comparable
This event is sent to
onCustomEvent(CustomEvent)
when a custom condition is met. Be sure to reset
or remove the custom condition to avoid having it reoccuring repeatedly (see
the example for the
getCondition()
method.
- Mathew A. Nelson (original)
CustomEvent(Condition condition) - Called by the game to create a new CustomEvent when a condition is met.
|
CustomEvent(Condition condition, int priority) - Called by the game to create a new CustomEvent when a condition is met.
|
CustomEvent
public CustomEvent(Condition condition)
Called by the game to create a new CustomEvent when a condition is met.
condition
- the condition that must be met
CustomEvent
public CustomEvent(Condition condition,
int priority)
Called by the game to create a new CustomEvent when a condition is met.
The event will have the given priority.
An event priority is a value from 0 - 99. The higher value, the higher
priority. The default priority is 80.
This is equivalent to calling
Condition.setPriority(int)
on the
Condition.
condition
- the condition that must be metpriority
- the priority of the condition
getCondition
public Condition getCondition()
Returns the condition that fired, causing this event to be generated.
Use this to determine which condition fired, and to remove the custom
event.
public void onCustomEvent(CustomEvent event) {
if (event.getCondition().getName().equals("mycondition")) {
removeCustomEvent(event.getCondition());
// do something else
}
}
- the condition that fired, causing this event to be generated