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.

Adding a bank failsafe

Featured Replies

I've edited a script to do what I like, but sometimes when it walks back to the bank tile it'll stand idle until I move my character, where it'll then interact with the bank chest. My bank code is as follows:

public void handleBank() throws InterruptedException {
    if (!getBank().isOpen()){ //If the bank is not open
        getBank().open(); //Opens bank chests, booths, etc.
        if (getBank().isOpen()) {
            getBank().depositAll();
            if (getBank().close()) {
                Sleep.sleepUntil(() -> !getBank().isOpen(), 4000);
            }
        }
    }
}

 

I know nothing about scripting but I'd like to add some sort of failsafe to re-check it can use the bank chest somehow?

  • Author
19 minutes ago, Gunman said:

@UkBenHNeed more code, and post it on https://pastebin.com/ 

EDIT: Also the if's are nested and will get stuck if the bank is already open

https://pastebin.com/M3QpyfX3

 

This is the full thing. I had to change the bank method to use the chest that's nearby as it was set up to use a depositbox. Now sometimes it'll walk to the bank area and stand idle 

 

Edit: It idles when you run out of energy mid-way to the bank

Edited by UkBenH

4 minutes ago, UkBenH said:

https://pastebin.com/M3QpyfX3

 

This is the full thing. I had to change the bank method to use the chest that's nearby as it was set up to use a depositbox. Now sometimes it'll walk to the bank area and stand idle 

My guess is it's getting stuck because of web walking. Web walking by default will complete if a tile off. But I would just change the position to an area which I think the same area you're walking to is in the Banks API. I would probably restructure it like this
 

private void handleBank() throws InterruptedException {
    if (getBank().isOpen()) {
        currentState = "Depositing";
        if (getBank().depositAll()) {
            Sleep.sleepUntil(() -> getInventory().isEmpty(), 4000);
        }
    } else if (!getBank().open()) {
        currentState = "Navigating to bank";
        getWalking().webWalk(Banks.HOSIDIUS_HOUSE);
    }
}

And the first if in the onLoop I would change to just this

if (getInventory().isFull()) {
    handleBank();
}

If Banks.HOSIDIUS_HOUSE isn't the right location create an area where yours is.

  • Author
2 hours ago, Gunman said:

My guess is it's getting stuck because of web walking. Web walking by default will complete if a tile off. But I would just change the position to an area which I think the same area you're walking to is in the Banks API. I would probably restructure it like this
 


private void handleBank() throws InterruptedException {
    if (getBank().isOpen()) {
        currentState = "Depositing";
        if (getBank().depositAll()) {
            Sleep.sleepUntil(() -> getInventory().isEmpty(), 4000);
        }
    } else if (!getBank().open()) {
        currentState = "Navigating to bank";
        getWalking().webWalk(Banks.HOSIDIUS_HOUSE);
    }
}

And the first if in the onLoop I would change to just this


if (getInventory().isFull()) {
    handleBank();
}

If Banks.HOSIDIUS_HOUSE isn't the right location create an area where yours is.

Thank you - this helped!

10 minutes ago, UkBenH said:

Thank you - this helped!

In addition to what @Gunman said you can do .getRandomPosition() so that when walking to the bank it will be random every time.

getWalking().webWalk(Banks.HOSIDIUS_HOUSE.getRandomPosition());

You can also use the Bank class to open the bank with a method called .open(). You can read more about that here in the OSBot API Docs.

Quote

Searches for the best bank, based on type and distance from player. This method will only interact with RS2Objects.

 

  • Author
3 hours ago, ExtraBotz said:

In addition to what @Gunman said you can do .getRandomPosition() so that when walking to the bank it will be random every time.


getWalking().webWalk(Banks.HOSIDIUS_HOUSE.getRandomPosition());

You can also use the Bank class to open the bank with a method called .open(). You can read more about that here in the OSBot API Docs.

 

Thank you. I literally just knew how to change the areas it was using; but I'm trying to pick things up. Appreciate your comment.

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.