Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Dialogues - getOption() returns only first dialogue option


    Batko

    Recommended Posts

    Hi,

    New here. Started writing my  own scripts just for fun. Written a WC and a Mining script already with banking and now trying out a Tutorial Island script.

    At the start when you need to talk to the "Gielinor guide" you get to choose three options:
    "I am an experienced player."
    "I've played in the past, but not recently."
    "I am brand new! This is my first time here."

    Now when i try to get the options of the dialogue, it only returns the first one.

    Example code

    Dialogues box = getDialogues();
    if (box != null) {
      log("Found dialogue");
    
      String[] opts = box.getOptions();
      for (String o : opts)
        log("Options " + o);
    
    
    }

    only prints out the first option in the conversation.  Is it possible to  get all options, or am I doing something wrong?

    Link to comment
    Share on other sites

    Not sure why it returns only 1 option, but this is how I handle dialogues. Maybe will help:

    final String[] OPTIONS = {"Yes please, I need woad leaves.", "How about 20 coins?"};
    
    if (getDialogues().inDialogue() && !getDialogues().continueDialogue()) {
    	for(String option : OPTIONS) {
    		if (getDialogues().chooseOption(option)) {
    			break;
    		}
    	}
    }
    

     

    This code snippet finds dialogue box with player choice. Then it loops my array and chooses correct option. 

    getDialogues.chooseOption() checks for valid value so you don't need any null checks. 

    Link to comment
    Share on other sites

    5 hours ago, Batko said:

    Hi,

    New here. Started writing my  own scripts just for fun. Written a WC and a Mining script already with banking and now trying out a Tutorial Island script.

    At the start when you need to talk to the "Gielinor guide" you get to choose three options:
    "I am an experienced player."
    "I've played in the past, but not recently."
    "I am brand new! This is my first time here."

    Now when i try to get the options of the dialogue, it only returns the first one.

    Example code

    
    Dialogues box = getDialogues();
    if (box != null) {
      log("Found dialogue");
    
      String[] opts = box.getOptions();
      for (String o : opts)
        log("Options " + o);
    
    
    }

    only prints out the first option in the conversation.  Is it possible to  get all options, or am I doing something wrong?

    I believe something is a little different with the dialogues in tutorial island.

    If I recall, the options dialogue has a different layout, which changes up how the actual dialogue options how up in the widgets.

    The widget is 219,1

    You want the children of that widget, that's where you'll find the dialogue options. In normal dialogues there are extra widgets as children under that widget, which throws off how we usually find the chat options.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.