DialogueAPI
Read NPC chat, continue it and pick options.
ClassRLPlugins API
public class DialogueAPIDialogue shows over the chat box: a line from an NPC or from you with a continue prompt, or a list of options to pick from.
Example
@Subscribe
public void onGameTick(GameTick tick) {
if (DialogueAPI.isViewingOptions()) {
DialogueAPI.selectOption("Yes");
} else if (DialogueAPI.dialoguePresent()) {
DialogueAPI.continueDialogue();
}
}Members
Static methods
- booleancontinueDialogue()
Clicks the continue prompt.
- booleancontinueMuseumQuiz()
Continues the Varrock Museum quiz by selecting the correct answer based on the question.
- booleancontinueQuestHelper()
Helper method to continue a quest by selecting the highlighted option.
- booleandialoguePresent()
Whether any dialogue is open.
- StringgetDialogueHeader()
The name above the current dialogue.
- StringgetDialogueText()
The text of the current dialogue line.
- List<String>getOptions()
The options you can pick.
- booleanisViewingOptions()
Whether a list of options is open.
- voidmakeX(int)
Sends a "make X" dialogue input with the specified quantity.
- booleanoptionPresent(String)
Whether an option containing this text shows.
- voidresumeNumericDialogue(int)
Resumes a numeric dialogue.
- voidresumeObjectDialogue(int)
Resumes an object dialogue.
- voidresumePause(int, int)
Sends a resume/pause for a specific widget and option index.
- booleanselectOption(String)
Picks the first option containing this text.
- voidselectOption(int)
Selects a dialogue option based on its index.
continueDialogue()static
public static boolean continueDialogue()Clicks the continue prompt.
Returns
true if it clicked continue.
continueMuseumQuiz()static
public static boolean continueMuseumQuiz()Continues the Varrock Museum quiz by selecting the correct answer based on the question.
Returns
True if an answer was selected, false otherwise.
continueQuestHelper()static
public static boolean continueQuestHelper()Helper method to continue a quest by selecting the highlighted option.
Returns
True if an option was selected, false otherwise.
dialoguePresent()static
public static boolean dialoguePresent()Whether any dialogue is open.
Returns
true while dialogue shows.
getDialogueHeader()static
public static String getDialogueHeader()The name above the current dialogue.
Returns
The speaker, such as an NPC name or "Player"; "Select an Option" above a list of options; or "UNKNOWN".
getDialogueText()static
public static String getDialogueText()The text of the current dialogue line.
Returns
The text, or an empty string when no dialogue shows.
getOptions()static
public static List<String> getOptions()The options you can pick.
Returns
The option texts from top to bottom. Empty when no options show.
for (String option : DialogueAPI.getOptions()) {
if (option.contains("Bank")) {
DialogueAPI.selectOption(option);
break;
}
}isViewingOptions()static
public static boolean isViewingOptions()Whether a list of options is open.
Returns
true while options show.
makeX(int)static
public static void makeX(int quantity)Sends a "make X" dialogue input with the specified quantity.
Parameters
quantity- The quantity to input in the "make X" dialogue.
optionPresent(String)static
public static boolean optionPresent(String option)Whether an option containing this text shows.
Parameters
option- Text to look for. Capital letters are ignored and part of an option is enough.
Returns
true if an option matches.
resumeNumericDialogue(int)static
public static void resumeNumericDialogue(int value)Resumes a numeric dialogue.
Parameters
value- The number to input.
resumeObjectDialogue(int)static
public static void resumeObjectDialogue(int id)Resumes an object dialogue.
Parameters
id- The dialogue object ID.
resumePause(int, int)static
public static void resumePause(int widgetID, int optionIndex)Sends a resume/pause for a specific widget and option index.
Parameters
widgetID- The ID of the widget to interact with.
optionIndex- The index of the option to select within the widget.
selectOption(String)static
public static boolean selectOption(String option)Picks the first option containing this text.
Parameters
option- Text to look for. Capital letters are ignored and part of an option is enough.
Returns
true if an option matched and was picked.
selectOption(int)static
public static void selectOption(int option)Selects a dialogue option based on its index.
Parameters
option- The index of the option to select (0-based).
Also allowed
Every class has these, as in plain Java.
equals, toString