Docs · dialogue

dialogue

6 dialogue commands, generated from the engine's own registry — signatures, parameters and a worked example each. A does something command acts on the game; a needs x() one answers a confident wrong answer when its client hooks are missing.

answer does something returns bool
answer(text: string) -> bool

Picks the first option matching the text and waits for the dialogue to go. False when no dialogue is open, when nothing matches - the choices are traced when they do not - or when the dialogue was still up three seconds later.

ParameterTypeWhat it does
textrequired string the whole line or part of it
Example
if not answer("yes") { return 600 }
answerAt does something returns bool
answerAt(index: int) -> bool

Picks a line by its position and waits for the dialogue to go. For when the text is not worth matching on. A separate name from answer() on purpose: answer(0) and answer("0") meaning different things is exactly the accident a language without types makes silently.

ParameterTypeWhat it does
indexrequired int which line, counting from zero
Example
if not answerAt(0) { return 600 }
dialogueContains returns bool
dialogueContains(text: string) -> bool

True when one of the options matches.

ParameterTypeWhat it does
textrequired string the whole line or part of it
Example
if dialogueContains("buy") { answer("buy") }
dialogueIndexOf returns int
dialogueIndexOf(text: string) -> int

Where an option sits, counting from zero, or -1 when nothing matches. An exact line wins over one that merely contains the text.

ParameterTypeWhat it does
textrequired string the whole line or part of it
Example
if dialogueIndexOf("yes") >= 0 { answer("yes") }
dialogueOpen returns bool
dialogueOpen() -> bool

True while a dialogue is asking something.

Example
if dialogueOpen() { answer("yes") }
dialogueOptions returns list<string>
dialogueOptions() -> list<string>

The lines on offer, in the order the server listed them. Empty when nothing is being asked.

Example
for line in dialogueOptions() { if line == "Yes" { stop } }