Class Dialog

java.lang.Object
net.storm.sdk.widgets.Dialog

public class Dialog extends Object
Provides utility methods for interacting with in-game dialog interfaces.

Dialogs are modal interfaces that appear during NPC conversations, level-up messages, tutorial prompts, and various input requests. This class provides methods to detect, navigate, and respond to these dialogs programmatically.

The class handles several types of dialogs:

  • NPC/Player conversations: Multi-option dialogs with continue prompts
  • Input dialogs: Text, name, or amount entry fields
  • Tutorial dialogs: Special prompts during the tutorial
  • Option dialogs: Multiple choice selections

Example Usage:


 // Check if a dialog is open and handle it
 if (Dialog.isOpen()) {
     if (Dialog.canContinue()) {
         Dialog.continueSpace();
     } else if (Dialog.isViewingOptions()) {
         Dialog.chooseOption("Yes, I would like that.");
     }
 }

 // Enter an amount in an input dialog
 if (Dialog.isEnterInputOpen()) {
     Dialog.enterAmount(1000);
 }

 // Choose an option using a predicate
 Dialog.chooseOption(option -> option.contains("travel"));
 
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Checks whether the current dialog has a continue option available.
    static boolean
    chooseOption(int index)
    Chooses a dialog option by its index (0-based).
    static boolean
    chooseOption(String... options)
    Chooses a dialog option matching one of the specified strings.
    static boolean
    Chooses a dialog option matching the specified predicate.
    static void
    Continues the dialog by pressing the space key.
    static void
    Continues through tutorial dialog prompts.
    static void
    enterAmount(int input)
    Enters a numeric amount into an amount input dialog.
    static void
    Enters a chat channel name into the chat channel input dialog.
    static void
    Enters a friend's name into the friend name input dialog.
    static void
    Enters a name into a generic name input dialog.
    static void
    Enters text into a text input dialog.
    static void
    Forces the dialog interface to close.
    static void
    Forces the dialog interface to open.
    static String
    Retrieves the name of the NPC or entity speaking in the current dialog.
    static IWidget
    getOption(String option)
    Retrieves the widget for a dialog option matching the specified string.
    static IWidget
    Retrieves the widget for a dialog option matching the specified predicate.
    static List<IWidget>
    Retrieves all available options in the current dialog.
    static IWidget
    Retrieves the title widget of the current option dialog.
    static String
    Retrieves the main text content of the current dialog.
    static boolean
    hasOption(String option)
    Checks whether the dialog contains an option matching the specified string.
    static boolean
    Checks whether the dialog contains an option matching the specified predicate.
    static void
    input(int inputType, String value)
    Enters input of a specific type into the current input dialog.
    static boolean
    Checks whether an input dialog is currently open.
    static boolean
    Checks whether any dialog interface is currently open.
    static boolean
    Checks whether the dialog is currently showing multiple selectable options.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Dialog

      public Dialog()
  • Method Details

    • continueTutorial

      public static void continueTutorial()
      Continues through tutorial dialog prompts.

      This method is specifically designed for tutorial island dialogs that require special handling.

    • isOpen

      public static boolean isOpen()
      Checks whether any dialog interface is currently open.
      Returns:
      true if a dialog is open, false otherwise
    • canContinue

      public static boolean canContinue()
      Checks whether the current dialog has a continue option available.

      This typically indicates a "Click here to continue" prompt in NPC dialogs.

      Returns:
      true if the dialog can be continued, false otherwise
    • isEnterInputOpen

      public static boolean isEnterInputOpen()
      Checks whether an input dialog is currently open.

      Input dialogs are used for entering text, names, or numeric values.

      Returns:
      true if an input dialog is open, false otherwise
    • enterFriendName

      public static void enterFriendName(String input)
      Enters a friend's name into the friend name input dialog.
      Parameters:
      input - the friend's name to enter
    • enterChatChannelName

      public static void enterChatChannelName(String input)
      Enters a chat channel name into the chat channel input dialog.
      Parameters:
      input - the chat channel name to enter
    • enterName

      public static void enterName(String input)
      Enters a name into a generic name input dialog.
      Parameters:
      input - the name to enter
    • enterText

      public static void enterText(String input)
      Enters text into a text input dialog.
      Parameters:
      input - the text to enter
    • enterAmount

      public static void enterAmount(int input)
      Enters a numeric amount into an amount input dialog.
      Parameters:
      input - the amount to enter
    • input

      public static void input(int inputType, String value)
      Enters input of a specific type into the current input dialog.
      Parameters:
      inputType - the type of input expected by the dialog
      value - the value to enter as a string
    • isViewingOptions

      public static boolean isViewingOptions()
      Checks whether the dialog is currently showing multiple selectable options.
      Returns:
      true if options are being displayed, false otherwise
    • continueSpace

      public static void continueSpace()
      Continues the dialog by pressing the space key.

      This is the standard way to advance through "Click here to continue" prompts.

    • chooseOption

      public static boolean chooseOption(int index)
      Chooses a dialog option by its index (0-based).
      Parameters:
      index - the index of the option to select
      Returns:
      true if the option was successfully selected, false otherwise
    • chooseOption

      public static boolean chooseOption(String... options)
      Chooses a dialog option matching one of the specified strings.

      The comparison is case-insensitive and matches if the option contains any of the given strings.

      Parameters:
      options - the option strings to match against
      Returns:
      true if a matching option was found and selected, false otherwise
    • chooseOption

      public static boolean chooseOption(Predicate<String> option)
      Chooses a dialog option matching the specified predicate.
      Parameters:
      option - a predicate to match option text
      Returns:
      true if a matching option was found and selected, false otherwise
    • hasOption

      public static boolean hasOption(String option)
      Checks whether the dialog contains an option matching the specified string.
      Parameters:
      option - the option text to search for
      Returns:
      true if a matching option exists, false otherwise
    • hasOption

      public static boolean hasOption(Predicate<String> option)
      Checks whether the dialog contains an option matching the specified predicate.
      Parameters:
      option - a predicate to match option text
      Returns:
      true if a matching option exists, false otherwise
    • getOption

      public static IWidget getOption(String option)
      Retrieves the widget for a dialog option matching the specified string.
      Parameters:
      option - the option text to search for
      Returns:
      the option widget if found, or null if not found
    • getOption

      public static IWidget getOption(Predicate<String> option)
      Retrieves the widget for a dialog option matching the specified predicate.
      Parameters:
      option - a predicate to match option text
      Returns:
      the option widget if found, or null if not found
    • getOptionTitle

      public static IWidget getOptionTitle()
      Retrieves the title widget of the current option dialog.
      Returns:
      the title widget, or null if no option dialog is open
    • getOptions

      public static List<IWidget> getOptions()
      Retrieves all available options in the current dialog.
      Returns:
      a list of option widgets, or an empty list if no options are available
    • forceOpen

      public static void forceOpen()
      Forces the dialog interface to open.

      This can be used to programmatically trigger dialog visibility.

    • forceClose

      public static void forceClose()
      Forces the dialog interface to close.

      This can be used to dismiss dialogs programmatically.

    • getText

      public static String getText()
      Retrieves the main text content of the current dialog.
      Returns:
      the dialog text, or null if no dialog is open
    • getName

      public static String getName()
      Retrieves the name of the NPC or entity speaking in the current dialog.
      Returns:
      the speaker's name, or null if not available