Class Dialogue

java.lang.Object
com.valhalla.sdk.api.methods.Dialogue

public final class Dialogue extends Object
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();
 
  • Field Details

  • Method Details

    • clean

      public static String clean(String text)
      Removes colour and formatting tags from game text.
    • isOpen

      public static boolean isOpen()
      Returns true when any dialogue is currently visible.
      Returns:
      true when any dialogue is currently visible
    • getSpeaker

      public static Optional<String> 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

      public static Optional<String> 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

      public static Optional<WidgetSnapshot> getContinue()
      Returns the visible continue prompt, or empty.
      Returns:
      the visible continue prompt, or empty
    • canContinue

      public static boolean canContinue()
      Returns true when the open dialogue is waiting for Continue.
      Returns:
      true when 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:
      true when a prompt was visible and the game accepted the request
    • getOptions

      public static List<Dialogue.Option> 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()
      Returns true when an option menu is open.
      Returns:
      true when an option menu is open
    • selectOption

      public static boolean selectOption(String fragment)
      Selects the first choice whose text contains the given text, ignoring case.
      
       Dialogue.selectOption("Yes");
       
      Parameters:
      fragment - text to look for
      Returns:
      true when 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:
      true when that choice was visible and the game accepted the request
    • describe

      public static String describe()
      Returns a one-line summary of the open dialogue for logs.