Combat And Prayer Actions
CombatActions and PrayerActions contain the result-aware writes for combat
settings and prayers. Every method below returns InteractionResult. Combat
settings, individual prayer toggles, quick-prayer opening, and orb toggling use
the shared action path and can return PACED without queuing a packet.
For health, poison, wilderness, combat-session, prayer-point, and active-prayer
reads, use the combat and prayer SDK facades described in
Automation API. For target discovery, use
Query Helpers, then dispatch the attack through
CombatApi.attackNPC(...) or NPCActions.interact(...).
Combat Settings
| Method | Behavior |
|---|---|
CombatActions.toggleSpec() | Clicks the visible special-attack orb; returns COMBAT_SPEC_UNAVAILABLE when the orb is unavailable. |
CombatActions.setAttackStyle(AttackStyle) | Clicks the combat-tab button mapped to the requested style. |
CombatActions.toggleAutoRetaliate(boolean) | Idempotently converges auto-retaliate to the requested state. |
InteractionResult result = CombatActions.toggleAutoRetaliate(true);
if (result.failed() && result.getStatus() != InteractionStatus.PACED) {
log.debug("Auto-retaliate update failed: {}", result.getMessage());
}
setAttackStyle(null) returns TARGET_NULL. A missing or hidden combat-style
or auto-retaliate component returns WIDGET_NOT_FOUND. These widget mappings
are revision-sensitive and require live-client verification after a RuneLite
revision change.
Prayer State
The core prayer writes are idempotent:
| Method | Behavior |
|---|---|
PrayerActions.enable(Prayer) | Enables one prayer. |
PrayerActions.disable(Prayer) | Disables one prayer. |
PrayerActions.set(Prayer, boolean) | Converges one prayer to the requested state. |
PrayerActions.setOnly(Prayer...) | Converges toward exactly the requested active set. |
PrayerActions.disableAll() | Converges toward no active prayers. |
InteractionResult result = PrayerActions.setOnly(
Prayer.PROTECT_FROM_MELEE,
Prayer.PIETY
);
if (result.getStatus() == InteractionStatus.PACED) {
return; // retry from the next tick
}
setOnly(...) and disableAll() may need multiple ticks because each call
queues at most the next required toggle. Re-evaluate and call again until the
result succeeds with the requested state already established.
A null prayer returns TARGET_NULL. An unmapped, missing, or hidden prayer
component returns PRAYER_WIDGET_NOT_FOUND.
Quick Prayers
For the grouped facade, use PrayerApi (available as
AutomationApi.prayers):
| Method | Behavior |
|---|---|
openQuickPrayers() | Opens the quick-prayer setup interface. |
selectQuickPrayer(Prayer, boolean) | Selects or clears one prayer while setup is open. |
setQuickPrayers(Prayer...) | Converges the configured quick-prayer selection. |
toggleQuickPrayers() | Toggles the quick-prayer orb. |
InteractionResult setup = PrayerApi.setQuickPrayers(
Prayer.PROTECT_FROM_MAGIC,
Prayer.MYSTIC_MIGHT
);
if (setup.succeeded() && !PrayerApi.isQuickPrayerEnabled()) {
InteractionResult toggle = PrayerApi.toggleQuickPrayers();
}
Open the setup before calling setQuickPrayers(...). That method compares the
selection mask and queues each changed setup child directly in one call; it does
not use ActionPacer. Toggle the orb only after the configured set is observed.
The setup widget contract is live-client-sensitive.
Workflow Ownership
Combat policy such as food thresholds, target selection, potion use, retries,
and death/loot transitions belongs in CombatWorkflowBuilder or the caller's
state machine, not in these action methods. See
Automation API for that orchestration layer.
For paced tests, call ActionPacer.reset() in @Before. Source and unit tests
verify status and packet-dispatch contracts; combat-tab and quick-prayer widget
behavior still requires an observed client run.