Class Widgets
java.lang.Object
privbot.hooks.Widgets
Interface widgets:
ctx.widgets (find by id or visible text, read text, click options).
On Impact, Elorin and SpawnPK a widget's hidden flag can lie for interfaces that closed; where the client can tell which interfaces it is drawing, visibility reads ask it instead. Interactions return dispatch acceptance; verify the interface changed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow visible text is matched.static enumWhat a confirmed widget click observed. -
Method Summary
Modifier and TypeMethodDescriptionchildTextLower(int parentPackedId, int childIndex) Lowercase text fromclient.getWidget(parentPackedId).getChild(childIndex)when the parent is non-hidden; otherwise empty string.The interface roots the client is drawing, or null where this server cannot say.net.runelite.api.widgets.Widgetnet.runelite.api.widgets.Widgetfind(String text, Widgets.MatchMode mode) net.runelite.api.widgets.WidgetgetByInspectorPath(String path) Resolves a widget using inspector path syntax (e.g.booleanQuiet read forshouldExecute: a visible widget matchesquery(text, then name, then action, then target verb; exact then contains).booleanhasExactText(String text) booleanbooleanbooleanbooleanFind a visible widget by text / name / action and click it.booleanFind byquery, then clickaction(name then action).booleanClicksoptiononwidget, using a saved menu action for it when one exists.interactConfirmed(String query, long timeoutMs) Same asinteractConfirmed(String, String, long)with the default option.interactConfirmed(String query, String option, long timeoutMs) Clicks likeinteract(String, String)and then WAITS for the client to show a response: an interface root opening or closing (the server's reply to almost every button — teleport menus, banks, shops, dialogues), the clicked widget disappearing, or a varp changing.booleaninteractInspectorPath(String path, String option) Invokesinteract(Widget, String)on the leaf reached bygetByInspectorPath(String).booleaninteractSimpleByText(String textContains, Widgets.MatchMode mode, String option) Minimal-parameter widget click for workflows: resolve by visible text, then dispatch using server-appropriate menu shape.booleaninteractSimpleByWidgetId(int widgetId, String option) Minimal-parameter widget click by flat or packed widget id (sameclient.getWidgetlookup asinteract(int, String)).booleaninteractText(String text) Clicks the visible widget whose text is exactlytext, with that text as the option.booleaninteractText(String text, String option) booleaninteractText(String text, String option, Widgets.MatchMode mode) booleaninteractWithoutSavedLibrary(net.runelite.api.widgets.Widget widget, String option) Likeinteract(Widget, String)but never consults the saved menu-action library (no saved NamedMenuAction fallback).booleanisHidden(int packedId) Whether the widget atpackedIdis missing or hidden.booleanisHidden(int groupId, int childId) booleanisVisible(int packedId) Inverse ofisHidden(int)— false when missing, hidden, or thread dispatch fails.query()Empty widget query — addWidgetQuery.root(int)/WidgetQuery.expandImmediateChildren()as needed.queryAt(int packedRootId) Query the widget at this inspector packed id (group.child) plus its immediate child layer.
-
Method Details
-
query
Empty widget query — addWidgetQuery.root(int)/WidgetQuery.expandImmediateChildren()as needed. -
queryAt
Query the widget at this inspector packed id (group.child) plus its immediate child layer. Typical use:widgets.queryAt(id).withNonEmptyName().first()or.withItemOrName().first(). -
getByInspectorPath
Resolves a widget using inspector path syntax (e.g.774.52[5]) when the packed parent id is ambiguous or the click target is a nested child — same rules asTransportRequest.WidgetPathStep.widgetInspectorPath. -
interactInspectorPath
Invokesinteract(Widget, String)on the leaf reached bygetByInspectorPath(String). -
isHidden
public boolean isHidden(int packedId) Whether the widget atpackedIdis missing or hidden. Safe from any thread (dispatches to the client thread). -
isHidden
public boolean isHidden(int groupId, int childId) - Parameters:
groupId- the interface groupchildId- the child- Returns:
- whether the widget is missing or hidden (true when unreadable)
-
isVisible
public boolean isVisible(int packedId) Inverse ofisHidden(int)— false when missing, hidden, or thread dispatch fails. -
childTextLower
Lowercase text fromclient.getWidget(parentPackedId).getChild(childIndex)when the parent is non-hidden; otherwise empty string. Client access runs on the game thread. -
hasText
- Parameters:
text- a substring, case-insensitive- Returns:
- whether a visible widget's text contains it
-
hasExactText
- Parameters:
text- the whole text- Returns:
- whether a visible widget's text equals it (case-insensitive)
-
find
- Parameters:
text- a substring of a visible widget's text- Returns:
- the first such widget, or null
-
find
- Parameters:
text- the textmode- how to match it- Returns:
- the first visible widget whose text matches, or null
-
interactText
Clicks the visible widget whose text is exactlytext, with that text as the option.- Parameters:
text- the widget's text- Returns:
- dispatch acceptance
-
interactText
-
interactText
- Parameters:
text- the widget's textoption- the menu option to use ("Continue" also tries a selectable text option)mode- how to matchtext- Returns:
- dispatch acceptance
-
has
Quiet read forshouldExecute: a visible widget matchesquery(text, then name, then action, then target verb; exact then contains). -
interact
Find a visible widget by text / name / action and click it.truemeans dispatch was accepted. -
interact
-
interactConfirmed
Clicks likeinteract(String, String)and then WAITS for the client to show a response: an interface root opening or closing (the server's reply to almost every button — teleport menus, banks, shops, dialogues), the clicked widget disappearing, or a varp changing. This is the confirmation a plugin should gate on before its next step;interact(java.lang.String)alone only proves the click was handed to the client.optionmay be null for the default option. -
interactConfirmed
Same asinteractConfirmed(String, String, long)with the default option. -
drawnRoots
-
interactWithoutSavedLibrary
Likeinteract(Widget, String)but never consults the saved menu-action library (no saved NamedMenuAction fallback). Use when the caller already resolved the widget by text and must avoid replaying calibrated library entries. -
interact
- Parameters:
packedId- the widget idoption- the menu option- Returns:
- dispatch acceptance; false when the widget does not resolve
-
interact
- Parameters:
groupId- the interface groupchildId- the childoption- the menu option- Returns:
- dispatch acceptance
-
interact
Clicksoptiononwidget, using a saved menu action for it when one exists.- Parameters:
widget- the widget (may be null)option- the menu option- Returns:
- dispatch acceptance
-
interactSimpleByText
Minimal-parameter widget click for workflows: resolve by visible text, then dispatch using server-appropriate menu shape. On SpawnPK, usesPrivBotSpawnPKWidgetType1Params(SpawnPKMenuInvoker#resolveWidgetType1MenuTuple) when registered so IF3 / target-verb rows work. -
interactSimpleByWidgetId
Minimal-parameter widget click by flat or packed widget id (sameclient.getWidgetlookup asinteract(int, String)).
-