Scene Interaction Actions
Four action classes click the things in your scene: NPCActions,
ObjectActions, PlayerActions, and TileItemActions. They share one shape.
You name a target (by string, id, predicate, or a resolved reference) and the
menu actions to match; each returns an InteractionResult.
All four live under com.n3plugins.InteractionApi.actions, are static, and route
their click through ActionPacer. A blocked call returns
InteractionStatus.PACED; a missing target returns TARGET_NOT_FOUND.
Name, ID, and predicate overloads resolve the nearest reachable match by path.
Resolved-reference overloads act on exactly the entity supplied by the caller.
NPCActions
NPCActions.interact("Banker", "Bank", "Talk-to"); // first match of the listed actions
NPCActions.interact(3094, "Talk-to"); // by NPC id
NPCActions.interact(npc -> npc.getName().equals("Goblin"), "Attack"); // by predicate
NPCActions.interact(npc, "Attack"); // by resolved NPC
NPCActions.interactIndex(0, "Talk-to"); // by menu index, skip action-name resolution
| Method | Picks |
|---|---|
interact(String name, String... actions) | nearest NPC matching the name |
interact(int id, String... actions) | nearest NPC with that id |
interact(Predicate<? super NPC> predicate, String... actions) | nearest NPC matching the test |
interact(NPC npc, String... actions) | the NPC you pass |
interactIndex(int index, String... actions) | fires the raw 1-based menu index |
ObjectActions
Same overloads against TileObject:
ObjectActions.interact("Bank booth", "Bank");
ObjectActions.interact(10583, "Open");
ObjectActions.interact(o -> o.getId() == GATE_ID, "Open");
ObjectActions.interact(tileObject, "Climb-down");
| Method | Picks |
|---|---|
interact(String name, String... actions) | nearest object matching the name |
interact(int id, String... actions) | nearest object with that id |
interact(Predicate<? super TileObject> predicate, String... actions) | nearest object matching the test |
interact(TileObject object, String... actions) | the object you pass |
PlayerActions
Same shape against Player:
PlayerActions.interact("Zezima", "Trade with");
PlayerActions.interact(p -> p.getCombatLevel() > 100, "Follow");
PlayerActions.interact(player, "Trade with");
| Method | Picks |
|---|---|
interact(String name, String... actions) | nearest player matching the name |
interact(Predicate<? super Player> predicate, String... actions) | nearest player matching the test |
interact(Player player, String... actions) | the player you pass |
TileItemActions
Ground items. The resolved-reference overload adds a control-click flag:
TileItemActions.interact("Coins", "Take");
TileItemActions.interact(995, "Take");
TileItemActions.interact(i -> i.getQuantity() > 100, "Take");
TileItemActions.interact(tileItem, true, "Take"); // ctrlDown = true
| Method | Picks |
|---|---|
interact(int id, String... actions) | nearest ground item with that id |
interact(String name, String... actions) | nearest ground item matching the name |
interact(Predicate<? super ETileItem> predicate, String... actions) | nearest ground item matching the test |
interact(ETileItem item, boolean ctrlDown, String... actions) | the item you pass, with a control-click flag |
Choosing an overload
- String name for the common case. The name match strips HTML tags, so pass
bare strings (see
query-helpers.md). - int id when a name is ambiguous across revisions.
- Predicate when you filter on state the name cannot express (quantity, combat level, animation).
- Resolved reference when you already hold the target from a query and want to skip the lookup.
NPCActions.interactIndexwhen the component carries no named action and you need the raw menu index, the NPC analogue ofWidgetActions.clickOp(seewidget-actions.md).
Reading vs acting
These classes act. To find or count targets first, use the query layer
(NPCQuery, PlayerQuery, TileObjectQuery, TileItemQuery) in
query-helpers.md, or the grouped AutomationApi.npcs/objects/players/groundItems
in automation-api.md. Reach for an action class when you want the
InteractionResult status; reach for AutomationApi when a boolean suffices.