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
  • Bank.withdraw(filter, amt) failing to withdraw items


    wefwefwef222

    Recommended Posts

    Hi, this is my code to withdraw a ring of dueling, using a ROD filter:

                log("2");
    
                if (!Equipment.contains(ROD_FILTER)) {
                    if (!Inventory.contains(ROD_FILTER) && Bank.withdraw(ROD_FILTER, 1)) {
                        sleep(50, 200);
                    }
                    log("5");
                    Keyboard.closeInterfaceWithESC();
                    if (sleepUntil(() -> !Bank.isOpen() && Inventory.contains(ROD_FILTER), 3000)) {
                        if (Inventory.interact(ROD_FILTER, "Wear")) {
                            sleepUntil(() -> Equipment.contains(ROD_FILTER), 2000);
                        }
                    }
                    return 50;
                }

    And this is my ROD filter:

        private static final Filter<Item> ROD_FILTER = item -> item != null && item.getName().contains("ing of dueling");

     

    What actually happens:

    spacer.png

     

    The client hits the "2" logger, followed by the "5" logger, meaning that this code has been hit:

                    if (!Inventory.contains(ROD_FILTER) && Bank.withdraw(ROD_FILTER, 1)) {

    I've even tried removing the Inventory.contains() check, just in case that was returning false. However, even just doing Bank.widthdraw(ROD_FILTER,1) alone by itself is not withdrawing any items.

    Link to comment
    Share on other sites

    3 minutes ago, Pandemic said:

    Hey there, you need to open the bank before trying to withdraw/deposit items. You can do so with Bank.open() or Bank.openClosest().

    Maybe the gif doesn't really show it well, but the bot is clicking on the bank chest, waiting for it to open, then runs that code above. It is open. This is the full code:

                if (!Bank.isOpen()) {
                    GameObject bank = GameObjects.closest(4483);
                    if (bank != null && bank.isOnScreen()) {
                        if (bank.interact("Use")) {
                            sleepUntil(() -> {
                                if (rectangle != null && !rectangle.contains(Mouse.getPosition()) && Equipment.contains(ROD_FILTER)) {
                                    Mouse.move(rectangle);
                                }
                                return Bank.isOpen();
                            }, 4000);
                        }
                    } else {
                        Bank.openClosest();
                    }
                }
                log("1");
    
                if (Bank.isOpen() && (!Bank.contains(ItemID.PURE_ESSENCE) || !Bank.contains(ItemID.WILLOW_LOGS) || !Bank.contains(ROD_FILTER))) {
                    Client.getInstance().getScriptManager().stop();
                    return 0;
                }
                log("2");
    
                if (!Equipment.contains(ROD_FILTER)) {
                    if (!Inventory.contains(ROD_FILTER) && Bank.withdraw(ROD_FILTER, 1)) {
                        sleep(50, 200);
                    }
                    log("5");
                    Keyboard.closeInterfaceWithESC();
                    if (sleepUntil(() -> !Bank.isOpen() && Inventory.contains(ROD_FILTER), 3000)) {
                        if (Inventory.interact(ROD_FILTER, "Wear")) {
                            sleepUntil(() -> Equipment.contains(ROD_FILTER), 2000);
                        }
                    }
                    return 50;
                }

     

    Since I'm getting "2" in the logs.. I'm positive that the bank is open.

    Link to comment
    Share on other sites

    2 hours ago, wefwefwef222 said:

    Since I'm getting "2" in the logs.. I'm positive that the bank is open.

    why? its outside any if statement to check if it is open. it looks like it should be open at that point but that log will print regardless.

    2 hours ago, wefwefwef222 said:
                    GameObject bank = GameObjects.closest(4483);
                    if (bank != null && bank.isOnScreen()) {
                        if (bank.interact("Use")) {
                            sleepUntil(() -> {
                                if (rectangle != null && !rectangle.contains(Mouse.getPosition()) && Equipment.contains(ROD_FILTER)) {
                                    Mouse.move(rectangle);
                                }
                                return Bank.isOpen();
                            }, 4000);
                        }
                    } else {
                        Bank.openClosest();
                    }
    

    what the fuck? is this an antiban thing or for opening the chest in castle wars? does the dreambot bank location not work? idk if that causes an issue i just think its strange.

     

    2 hours ago, wefwefwef222 said:
                if (Bank.isOpen() && (!Bank.contains(ItemID.PURE_ESSENCE) || !Bank.contains(ItemID.WILLOW_LOGS) || !Bank.contains(ROD_FILTER))) {
                    Client.getInstance().getScriptManager().stop();
                    return 0;
                }
                log("2");
    
                if (!Equipment.contains(ROD_FILTER)) {
                    if (!Inventory.contains(ROD_FILTER) && Bank.withdraw(ROD_FILTER, 1)) {
                        sleep(50, 200);
                    }
    

    if i understand correctly this checks if ur out of req items, if you are out stop then withdraw ur items, why not just wrap this in if (bank.openclosest()) then have else on the end of !Equipment.contains(rod_filter) for closing  & equipping then onto next task or whatever, probably solve ur woes 

    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.