Skip to main content

Widget Actions

WidgetActions (com.n3plugins.InteractionApi.actions) clicks interface components: spell icons, dialog buttons, tab panels, and CS2 components that carry no named menu action. Every method returns an InteractionResult and routes through ActionPacer.

Click by action name

interact resolves an action string to a 1-based op index, then fires it:

WidgetActions.interact(packedWidgetId, "Continue");
WidgetActions.interact(widget, "Select");
MethodTarget
interact(int widgetId, String... actions)packed widget id
interact(Widget widget, String... actions)a resolved widget

When the component exposes none of the listed actions, interact returns ACTION_NOT_FOUND and queues nothing.

Click by raw op index

Many interface components carry no named action. The action-name path fails on them, so the click never queues. clickOp fires a 1-based op directly and skips action-name resolution:

WidgetActions.clickOp(WidgetInfoExtended.BANK_CLOSE.getPackedId(), 1);
WidgetActions.clickOp(widget, 1);
MethodTarget
clickOp(int widgetId, int op)packed widget id, raw op
clickOp(Widget widget, int op)a resolved widget, raw op

clickOp guards a null or hidden widget and returns the matching failure status and returns a status. Use it when a component reacts to a click but lists no menu action. Confirm the op index against the widget inspector on a live run, since the mapping is not exposed by name. The packed ID should still be a named WidgetInfoExtended, WidgetID, ComponentID, or gameval-backed constant; raw production literals are rejected by WidgetRawIdAllowlistTest.

subAction reaches a nested menu entry on a widget:

WidgetActions.subAction(widget, "Cast", "Resurrect");
MethodDoes
subAction(Widget widget, String menu, String action)clicks action under the menu sub-menu of widget

Finding the widget first

WidgetActions acts on a widget you already resolved. To locate one, use the widget query helpers in query-helpers.md, or AutomationApi.widgets (get, search, firstByAction/firstByName/firstByText) in automation-api.md. The query name predicates strip HTML tags widget-side, so pass bare strings.

To inspect components while building a plugin, see WidgetExplorer and WidgetDescriptor in packet-debugging.md.