Class Dialog
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks whether the current dialog has a continue option available.static booleanchooseOption(int index) Chooses a dialog option by its index (0-based).static booleanchooseOption(String... options) Chooses a dialog option matching one of the specified strings.static booleanchooseOption(Predicate<String> option) Chooses a dialog option matching the specified predicate.static voidContinues the dialog by pressing the space key.static voidContinues through tutorial dialog prompts.static voidenterAmount(int input) Enters a numeric amount into an amount input dialog.static voidenterChatChannelName(String input) Enters a chat channel name into the chat channel input dialog.static voidenterFriendName(String input) Enters a friend's name into the friend name input dialog.static voidEnters a name into a generic name input dialog.static voidEnters text into a text input dialog.static voidForces the dialog interface to close.static voidForces the dialog interface to open.static StringgetName()Retrieves the name of the NPC or entity speaking in the current dialog.static IWidgetRetrieves the widget for a dialog option matching the specified string.static IWidgetRetrieves the widget for a dialog option matching the specified predicate.Retrieves all available options in the current dialog.static IWidgetRetrieves the title widget of the current option dialog.static StringgetText()Retrieves the main text content of the current dialog.static booleanChecks whether the dialog contains an option matching the specified string.static booleanChecks whether the dialog contains an option matching the specified predicate.static voidEnters input of a specific type into the current input dialog.static booleanChecks whether an input dialog is currently open.static booleanisOpen()Checks whether any dialog interface is currently open.static booleanChecks whether the dialog is currently showing multiple selectable options.
-
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
Enters a friend's name into the friend name input dialog.- Parameters:
input- the friend's name to enter
-
enterChatChannelName
Enters a chat channel name into the chat channel input dialog.- Parameters:
input- the chat channel name to enter
-
enterName
Enters a name into a generic name input dialog.- Parameters:
input- the name to enter
-
enterText
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
Enters input of a specific type into the current input dialog.- Parameters:
inputType- the type of input expected by the dialogvalue- 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
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
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
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
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
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
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
Retrieves the title widget of the current option dialog.- Returns:
- the title widget, or null if no option dialog is open
-
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
Retrieves the main text content of the current dialog.- Returns:
- the dialog text, or null if no dialog is open
-
getName
Retrieves the name of the NPC or entity speaking in the current dialog.- Returns:
- the speaker's name, or null if not available
-