Package com.valhalla.sdk.api.methods
Class Dialogue
java.lang.Object
com.valhalla.sdk.api.methods.Dialogue
Reads and controls game dialogues that are visible on screen.
Use this class to read NPC and player dialogue, choose an option, or continue to the next line. Closed dialogue panels are ignored.
if (Dialogue.canContinue()) Dialogue.continueDialogue();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne visible choice in an option menu. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturnstruewhen the open dialogue is waiting for Continue.static StringRemoves colour and formatting tags from game text.static booleanContinues the open dialogue by one line, like pressing Space on desktop.static Stringdescribe()Returns a one-line summary of the open dialogue for logs.static Optional<WidgetSnapshot> Returns the visible continue prompt, or empty.static List<Dialogue.Option> Returns visible choices in menu order, or an empty list when no menu is open.Returns the NPC or player name shown in the open dialogue, or empty.getText()Returns the text of the open dialogue line or message box, or empty.static booleanReturnstruewhen an option menu is open.static booleanisOpen()Returnstruewhen any dialogue is currently visible.static booleanselectOption(int index) Selects a choice by its 1-based menu position.static booleanselectOption(String fragment) Selects the first choice whose text contains the given text, ignoring case.
-
Field Details
-
NPC_GROUP
public static final int NPC_GROUP- See Also:
-
PLAYER_GROUP
public static final int PLAYER_GROUP- See Also:
-
OPTIONS_GROUP
public static final int OPTIONS_GROUP- See Also:
-
MESSAGE_GROUP
public static final int MESSAGE_GROUP- See Also:
-
SPRITE_GROUP
public static final int SPRITE_GROUP- See Also:
-
ALL_GROUPS
-
-
Method Details
-
clean
Removes colour and formatting tags from game text. -
isOpen
public static boolean isOpen()Returnstruewhen any dialogue is currently visible.- Returns:
truewhen any dialogue is currently visible
-
getSpeaker
Returns the NPC or player name shown in the open dialogue, or empty.- Returns:
- the NPC or player name shown in the open dialogue, or empty
-
getText
Returns the text of the open dialogue line or message box, or empty.- Returns:
- the text of the open dialogue line or message box, or empty
-
getContinue
Returns the visible continue prompt, or empty.- Returns:
- the visible continue prompt, or empty
-
canContinue
public static boolean canContinue()Returnstruewhen the open dialogue is waiting for Continue.- Returns:
truewhen the open dialogue is waiting for Continue
-
continueDialogue
public static boolean continueDialogue()Continues the open dialogue by one line, like pressing Space on desktop.Dialogue.continueDialogue();- Returns:
truewhen a prompt was visible and the game accepted the request
-
getOptions
Returns visible choices in menu order, or an empty list when no menu is open.- Returns:
- visible choices in menu order, or an empty list when no menu is open
-
hasOptions
public static boolean hasOptions()Returnstruewhen an option menu is open.- Returns:
truewhen an option menu is open
-
selectOption
Selects the first choice whose text contains the given text, ignoring case.Dialogue.selectOption("Yes");- Parameters:
fragment- text to look for- Returns:
truewhen a matching choice was visible and the game accepted the request
-
selectOption
public static boolean selectOption(int index) Selects a choice by its 1-based menu position.Dialogue.selectOption(1);- Parameters:
index- 1-based menu position- Returns:
truewhen that choice was visible and the game accepted the request
-
describe
Returns a one-line summary of the open dialogue for logs.
-