Dialogue

Methods
12
Fields
None

Getting one

ui:dialogue()

Methods

MethodReturnsDescription
isOpen()booleanWhether a dialogue is open.
kind()DialogueKind?What kind it is.
text()string?The body text.
speaker()string?Who is speaking.
title()string?The dialogue's title.
canContinue()booleanWhether a continue prompt is showing.
typedInput()TypedInputKind?Which typed-input box is up, if any.
typeAmount(number)booleanType a number into the open amount box and submit it.
clickContinue()booleanClick the continue prompt.
pressSpace()booleanPress space when an open surface answers it: a continue dialogue, or the make-X box (Skillmulti), where space makes the highlighted produ…
options(){ DialogueOption }Every option currently offered.
find(string)DialogueOption?The first option matching a pattern.

Returned by

MethodReturnsDescription
Ui.dialogueDialogueThe open dialogue.

Method details

text

text: (Dialogue) -> string?

The body text.

Returns
nil when nothing is open, or it carries no text.

speaker

speaker: (Dialogue) -> string?

Who is speaking.

Returns
nil when nobody is named.

title

title: (Dialogue) -> string?

The dialogue's title.

Returns
nil when it has none.

typedInput

typedInput: (Dialogue) -> TypedInputKind?

Which typed-input box is up, if any.

Today that is only the bank/Grand Exchange "Enter amount" box.

Returns
nil when nothing is asking for typed input.

typeAmount

typeAmount: (Dialogue, number) -> boolean

Type a number into the open amount box and submit it.

amount
The number to enter.

pressSpace

pressSpace: (Dialogue) -> boolean

Press space when an open surface answers it: a continue dialogue, or the make-X box (Skillmulti), where space makes the highlighted product. false otherwise. On an interface with no such surface (smithing, silver or gold crafting), ui:typeText(" ") presses space whatever is open.

find

find: (Dialogue, string) -> DialogueOption?

The first option matching a pattern.

pattern
Text to look for.
Returns
nil when nothing matches.
Example
local dialogue = ui:dialogue()
if dialogue:isOpen() then
    -- An option by its text, or nil when none is offered.
    local option = dialogue:find("Yes")
    if option then
        option:press()
    else
        for _, offered in dialogue:options() do
            log:info("{}: {}", offered:optionNumber(), offered:text())
        end
    end
end