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
  • Try asking for help in the chatbox
  • Help w Dialogue script


    beefsteak
     Share

    Recommended Posts

    Howdy folks, I've got a script thats working perfectly except for one section of dialogue, with the customs officer in Karamja. For some reason, the script keeps looping the interaction ("Pay-Fare") with officer, and doesnt continue or choose any of the dialogue options. I have to pause the script, walk the character through the dialogue and crossing gangplank, and then it starts the next case and works fine. Amateur coder here, so any tips and comments appreciated! I'm sure this is horribly written and a pain to read haha

    if (getInventory().isFull() && (!port2Area.contains(getLocalPlayer()))) {
                        getWalking().walk(port2Area.getRandomTile());
                        sleepUntil(() -> !getLocalPlayer().isMoving(),
                                randomNum(1000, 2000));
                    }
                if (getInventory().isFull() && officer != null) {
                    officer.interact("Pay-fare");
                    sleepUntil(() -> getDialogues().inDialogue(), 8000);  // GETS STUCK HERE, spams "Pay fare"<--- 
                      if (getDialogues().canContinue() == true || getLocalPlayer().getInteractingCharacter() != null) {            
                            getDialogues().spaceToContinue();
                            getDialogues().chooseOption("Can I journey on this ship?");
                            getDialogues().chooseOption("Search away, I have nothing to hide.");
                            getDialogues().chooseOption("Ok.");
                        getGameObjects().closest(plank -> plank != null && plank.hasAction("Cross"));      
                        GameObject plank = getGameObjects().closest(gameObject -> gameObject != null
                                            && gameObject.getName().equals("Gangplank")
                                            && (gameObject.getID() == 2082));
                                            plank.interact("Cross");
                            sleep(randomNum(1000,2000));    
                        getWalking().walk(bankArea.getRandomTile());                
                sleep(500,1000); 
                }
                }
                break;
     

    Link to comment
    Share on other sites

    Well, you're saying that if the inventory is full and if the officer is there then interact with him, and since that will always return true, it will just repeat that one line. Instead you should put something like:

    if (getInventory.isFull() && officer !=null){
           if (getDialogues.inDialogue){
                     do all dialogue here
          } else {
               officer.interact
             }
    }

    Link to comment
    Share on other sites

    thanks @wettofu that fixed it! only issue now is that it gets stuck on crossing the gangplank.. tried moving some things around but cant seem to fix it, any tips?

    btw i love wetquests that shit is a life saver

    if (getInventory().isFull() && officer != null) {
                    if (getDialogues().inDialogue()){            
                            getDialogues().spaceToContinue();
                            getDialogues().chooseOption("Can I journey on this ship?");
                            getDialogues().chooseOption("Search away, I have nothing to hide.");
                            getDialogues().chooseOption("Ok.");
                            getDialogues().clickContinue();
                            sleep(randomNum(7000,10000));              // Wait for sailing animation 
                            getDialogues().clickContinue();            // "The ship arrives at Port Sarim"
                            sleep(randomNum(1000,2000));
                            getGameObjects().closest(plank -> plank != null && plank.hasAction("Cross"));      
                            GameObject plank = getGameObjects().closest(gameObject -> gameObject != null
                                            && gameObject.getName().equals("Gangplank")
                                            && (gameObject.getID() == 2082));
                                            plank.interact("Cross");
                            sleep(randomNum(1000,2000));    
                        getWalking().walk(bankArea.getRandomTile());                
                sleep(500,1000); 
                    } else {
                        officer.interact("Pay-fare");
                        sleepUntil(() -> getDialogues().inDialogue(), 8000); 
                }
                }
                break;

    Link to comment
    Share on other sites

     getGameObjects().closest(plank -> plank != null && plank.hasAction("Cross"));      
     GameObject plank = getGameObjects().closest(gameObject -> gameObject != null
                                            && gameObject.getName().equals("Gangplank")
                                            && (gameObject.getID() == 2082));
                                            plank.interact("Cross");

    Seems like you're defining plank after trying to use it? What does the debug console in your script say?

     

    A better way might be 

    GameObject plank = getGameObjects.closest("Gangplank");
    if (plank != null) plank.interact("Cross");

     

    Link to comment
    Share on other sites

    Alright, what that if statement does is check whether you are in a dialogue or not, if that statement is false, it will then talk to the officer, because you're saying that if you are in dialogue then click the plank to move on but in actuality, you're no longer in a dialogue so that is no longer repeated. 

    so just say that if officer is null then interact with the gangplank else, do everything else 

    also do what lousy said, its just way easier than what you're trying to do :) 

    Edited by wettofu
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • 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.