Class Dialogue
All detection is fully dynamic — no hardcoded widget group IDs. Every method
uses an inspector-style traversal over client.getWidgetRoots(),
scanning visible widgets by text, name, and actions. This works across OSRS, RSPS,
and any RuneLite-based client regardless of widget layout differences.
Usage:
if (ctx.dialogue.isOpen()) {
if (ctx.dialogue.contains("Give me a task")) {
ctx.dialogue.select("Give me a task");
} else if (ctx.dialogue.canContinue()) {
ctx.dialogue.clickContinue();
}
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA dialogue read: the root widget id it came from, plus the stitched, normalised text. -
Method Summary
Modifier and TypeMethodDescriptionThe on-screen text group that most reads like a dialogue message, or null.booleanReturns true if any visible widget has a "Continue" action — the universal signal for a click-through dialogue.booleanClicks the first visible widget with a "Continue" action.booleanclose()Elorin's dialogue close action is Escape (the installed client API explicitly selects it).booleanReturns true if any visible widget's text, name, or actions contain the given string.Returns all visible option strings by finding widgets whose children contain multiple selectable text entries (the option/multi-choice pattern).getText()Returns the text content from the first visible widget found by searching all widget roots for non-empty text that isn't a common UI label.booleanbooleanGuard Continue while a native entry prompt owns the chatbox.booleanisOpen()Returns true if a dialogue is open.booleanA choice surface, distinct from NPC speech with a Continue prompt.Whether a "Continue" surface is shown, or UNREADABLE when the read could not be made (canContinue()answers false for that).Whether an enter-amount / enter-text prompt owns the chatbox, or UNREADABLE when that cannot be read.Whether a dialogue is open, or UNREADABLE when the read could not be made.voidLogs the on-screen dialogue if there is one, for callers that want the log WITHOUT asking a question about dialogue state.EVERY on-screen text group that reads like a dialogue message, best-scoring first.booleanSelects a dialogue option by preferring an exact text match first, then falling back to case-insensitive contains matching.booleanselectByInspectorPath(String path) Same asselectPacked(int)but resolvesgroup.child[index]...paths when packed ids are ambiguous (e.g.booleanselectContains(String optionText) Selects a dialogue option by case-insensitive contains matching only.booleanselectExact(String optionText) Selects a dialogue option by exact normalized text match only.booleanselectOption(int oneBasedIndex) Selects a choice by its 1-based index:1is the first choice the menu offers.booleanselectPacked(int packedWidgetId) Activates a widget by inspector packed id (group << 16 | child).
-
Method Details
-
close
public boolean close()Elorin's dialogue close action is Escape (the installed client API explicitly selects it). This sends a bounded press/release to the game's listener-bearing canvas; acceptance still requires the caller to observe the dialogue closing. Other profiles remain unsupported. -
isEnterInputOpen
public boolean isEnterInputOpen()Guard Continue while a native entry prompt owns the chatbox. The installed Elorin predicate is input mode 1 or 2, or messagePromptRaised (client-names cD/cG -> native yg/YK). The existing profile-backed amount reader exposes these facts without guessing fields. An unavailable read blocks Continue; regular API clients use the full input widget (162:42). -
isOpen
public boolean isOpen()Returns true if a dialogue is open. On RuneLite-API/RSPS clients (Orion etc.) the chatbox dialogue widget 162:559 is the authoritative signal. On Impact the widget table is FLAT (ids 0..60000, notgroup<<16|child), so the packed 162:559 lookup never resolves — so we fall back to the dynamic signals that work over the real widget tree: an NPC/message dialogue text line in a known group, or a visible "Continue" / "Click here to continue" widget found by tree-walk (findContinueWidget()). That walk usesclient.getWidgetRoots(), which is populated on Impact, soDIALOG_OPEN(and conditions gated on it) now fire on Impact as on Orion. -
isActualDialog
public boolean isActualDialog()- Returns:
- whether an NPC/player chat-head dialogue (groups 231/219) is visible; false when unreadable
-
contains
Returns true if any visible widget's text, name, or actions contain the given string. Walks every widget root. -
getText
Returns the text content from the first visible widget found by searching all widget roots for non-empty text that isn't a common UI label.Prefers widgets that also have a sibling/child with "Continue" nearby, as that's the strongest signal for dialogue text. Returns null if no dialogue text is found.
-
getOptions
-
isViewingOptions
public boolean isViewingOptions()A choice surface, distinct from NPC speech with a Continue prompt. -
canContinue
public boolean canContinue()Returns true if any visible widget has a "Continue" action — the universal signal for a click-through dialogue. Scans all widget roots dynamically. -
clickContinue
public boolean clickContinue()Clicks the first visible widget with a "Continue" action. Returns true if a continue widget was found and clicked. -
select
Selects a dialogue option by preferring an exact text match first, then falling back to case-insensitive contains matching. Returns true if the option was found and clicked. -
selectExact
Selects a dialogue option by exact normalized text match only. Returns true if the option was found and clicked. -
selectContains
Selects a dialogue option by case-insensitive contains matching only. Returns true if the option was found and clicked. -
selectPacked
public boolean selectPacked(int packedWidgetId) Activates a widget by inspector packed id (group << 16 | child). When the widget has a parent, uses the sameMenuAction.WIDGET_CONTINUEshape as text option selection; otherwise invokes the first non-blank component action, or a bare continue on the widget. -
selectByInspectorPath
Same asselectPacked(int)but resolvesgroup.child[index]...paths when packed ids are ambiguous (e.g.820.49[44]— seeWidgets.getByInspectorPath(java.lang.String)). -
selectOption
public boolean selectOption(int oneBasedIndex) Selects a choice by its 1-based index:1is the first choice the menu offers. The menu's title line ("Select an Option", or a question such as "Select Gauntlet type:") is never counted, soselectOption(n)clicksgetOptions().get(n - 1). Preferselect(String)when the option's text is known: the text does not move when a server reorders its menu. Returns true if the option was clicked. -
pollDialogueLog
public void pollDialogueLog()Logs the on-screen dialogue if there is one, for callers that want the log WITHOUT asking a question about dialogue state.Exists because the logger below is only reached from
isOpen()andcontains(String)— so despite reading as "always-on", it only ever fired when a plugin happened to poll dialogue. On a server where nothing polls it, it produced nothing at all. The event bridge calls this once per tick so the log is genuinely always-on. -
bestProseGroup
The on-screen text group that most reads like a dialogue message, or null.Public because the AntiBan handler needs the SAME read the logger prints — a bot check the log can see but the solver cannot is worse than useless. One implementation, two consumers.
-
proseGroups
EVERY on-screen text group that reads like a dialogue message, best-scoring first.Exists because "which group is best" is the wrong question for a consumer hunting for one SPECIFIC message. On Elorin a group's text stays readable after its interface closes (the same lie
isHiddentells), so the login welcome at root 4900 stays a strong candidate for the rest of the session and can outscore the dialogue that is really on screen.A consumer looking for a particular message must therefore iterate this and test each candidate, not test only the winner.
-
observedOpen
Whether a dialogue is open, or UNREADABLE when the read could not be made.isOpen()answers false for that (its read is dropped when the game thread does not answer in time).Where the client says which interface its chat area shows (Elorin), this answers from that outright; the other servers answer from the widget heuristics
isOpen()uses. Neither answers "open" from chat history text (seecontains(String)).- Returns:
- TRUE / FALSE, or UNREADABLE
-
observedCanContinue
Whether a "Continue" surface is shown, or UNREADABLE when the read could not be made (canContinue()answers false for that).- Returns:
- TRUE / FALSE, or UNREADABLE
-
observedEnterInputOpen
-