Skip to main content

Action Resolver

ActionResolver centralizes menu action matching for packet wrappers, query filters, and high-level actions.

Current menu-entry snapshots for diagnostics live in Menu Entries. Keep this page focused on matching and one-based action-index resolution.

Behavior:

  • Strips RuneLite text tags.
  • Trims whitespace.
  • Ignores null and empty actions.
  • Matches requested actions case-insensitively.
  • Returns one-based RuneLite action indexes.

Example:

int index = ActionResolver.findActionIndex(widget.getActions(), "Withdraw-10");
if (index <= 0) {
return InteractionResult.fail(InteractionStatus.ACTION_NOT_FOUND, "No withdraw action");
}

Use ActionResolver.hasAction(...) inside query predicates; do not manually loop over action arrays.

Multiple Accepted Actions

Pass the actions in preference order when a caller can accept more than one menu verb. The returned index is the first matching action in the widget or entity action array, not the first requested action.

int index = ActionResolver.findActionIndex(
item.getActions(),
"Wear",
"Wield",
"Equip"
);

if (index > 0) {
WidgetPackets.queueWidgetActionPacket(index, item.getId(), item.getIndex(), item.getItemId());
}

Query Predicate Usage

Use hasAction when filtering query results. It handles tag stripping and case-insensitive matching consistently with the action classes.

Optional<Widget> teleport = Inventory.search()
.filter(item -> ActionResolver.hasAction(item.getActions(), "Teleport"))
.first();

Failure Messages

describeRequested is useful when reporting failed action resolution without repeating raw caller input.

String requested = ActionResolver.describeRequested("Withdraw-10", "Withdraw-5");
return InteractionResult.fail(
InteractionStatus.ACTION_NOT_FOUND,
"Missing action: " + requested
);