Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Bank - Withdraw - Bug, ore just me failing.

Featured Replies

Hello, guys.

Recently I have encountered strange behaviour. 

I have a script, where I iterate through items in bank (i need to withdraw only some, based on my data). As soon as i iterate through withdrawAll(item), the bank gets closed. Do you have any idea, what am i doing wrong? Or is it just some bug? Script is not getting me any message/any error/exception, it just closes the bank.

 

PS: This happens only if bank is opened for the first time during the script run. 

for (Item item : items) {
        int sellPrice = getItemSellPrice(item.getName());

        if (script.inventory.isFull()) {
            script.log("INV IS FULL");
            break;
        }

        if (helper.in_array(item.getName(), saveAll)) {
            script.log("Item to save");
            continue;
        }

        if (helper.in_array(item.getName(), restrictedItems)) {
            script.log("Restricted item");
            continue;
        }

        if (getItemSellPrice(item.getName()) * item.getAmount() < 3000) {
            script.log("Too cheap shit");
            continue;
        }

        if (helper.in_array(item.getName(), saveOne) && item.getAmount() == 1) {
            script.log("Have only one, saving");
            continue;
        } else if(helper.in_array(item.getName(), saveOne)) {
            if(noteWithdrawAllButOne(item.getName())) {
                continue;
            }

            script.log("Withdrawing all except one");
        } else {
            script.log("Withdraw all");
            if(noteWithdrawAll(item.getName())) {
                continue;
            }
        }

        Sleep.sleep((int) (math.gRandom(2500, bot.rVariation) * bot.rTime));
        script.log("NEEEEXT");
    }

    if (script.inventory.isEmpty()) {
        script.log("Inventory still empty after withdraw, ending this shit");
        //endJobAndKill();
    }

    //script.log("Close bank");
    //script.bank.close();
    action = "sale";
}

(noteWithdrawAll is just help method, worked fine till now)

public boolean noteWithdrawAll(String item) {
    if (!script.getBank().isBankModeEnabled(Bank.BankMode.WITHDRAW_NOTE)) {
        script.getBank().enableMode(Bank.BankMode.WITHDRAW_NOTE);
        Sleep.sleepUntil(() -> script.getBank().isBankModeEnabled(Bank.BankMode.WITHDRAW_NOTE), 3000, 600);
    }

    int itemCount = (int) itemCount(item);
    script.getBank().withdrawAll(item);
    Sleep.sleepUntil(() -> itemCount(item) > itemCount, 3000, 600);

    return true;
}

Edited by azuresuN

7 hours ago, azuresuN said:

PS: This happens only if bank is opened for the first time during the script run. 

I've noticed that if you call a bank method too soon after the first time of opening the bank it will cause unexpected results. Try to add a sleep after opening the bank.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.