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
  • Banking


    ElChapoJr

    Recommended Posts

    So I made a check to see if banking is selected and if it is it runs this code.

     

    However, the player will begin to move to the bank, but he will never make it, and the Calculations.random runs out and he returns to what he was suppose to be doing.

                        if (gui.itempref() == "Bank") {
                            if(getInventory().isFull()) {
                                getWalking().walk(getBank().getClosestBankLocation().getCenter());
                                dobanking();
                                sleepUntil(() -> (Lumbridge.contains(getLocalPlayer())), Calculations.random(35000, 40000));
                            }
                        }
    

    Here is the dobanking(); method

        private void dobanking() {
                log("Checking To See If Banking Needed");
                NPC banker = getNpcs().closest(npc -> npc != null && npc.hasAction("Bank"));
                if (banker != null && banker.interact("Bank")) {
                if(sleepUntil(() -> getBank().isOpen(), 9000)){
                    getBank().depositAllItems();
                    if(sleepUntil(() -> !getInventory().isFull(), 8000)){
                    if (getBank().close()) {
                    sleepUntil(() -> !getBank().isOpen(), 8000);
                    }
                }
            }
    
    Link to comment
    Share on other sites

    First of all on objects you should use .equals, not ==

    (strings are objects)

    I don't even know what you're trying to do, or "what he was supposed to be doing" is.

    walk does not walk you the whole way there all in one go, it clicks on the next tile in the path and returns.

     

    Overall your logic in the snippet is just not correct. You should try to avoid doing a bunch of actions all at once, and instead have it sectioned off

    if(inventory is full){
        if( not in bank){walk to bank;}
        else bank
    }
    then the loop will take care of the iteration over the logic and you'll be able to

    1. debug it more effectively as it's sectioned off

    2. it will work more reliably.

    Link to comment
    Share on other sites

    Alright, I applied what you told me to and it seemed to take care of the banking issue. Thanks for showing me :D

    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.