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.

Item isn't in inv

Featured Replies

if (!getInventory().contains("Lobster pot")) {
            if (!getBank().open()) {
                getBank().open();
                if (getBank().contains("Lobster pot"))
                    getBank().getItem("Lobster pot");
                    System.out.println("Taken a lobster pot out of the bank to fish with.");
                while (!getBank().isOpen()) {
                    sleep(random(200, 300));
                    localWalker.walkPath(backFishing);
                }
                    return 2000;
                }
            }

I'm not sure why but this doesn't seem to work..

 

If my inv doesn't contain the item lobster pot, open bank and get the item out and then it should go fish...

 

It opens the bank but just closes it and walks away.. ?

bank.withdraw("Lobster pot", 1);

Edited by blm95

There are quite a few logical flaws in this code :|

 

first off

if (!getBank().open()) {

You will only enter this if-statement if the attempt to open the bank fails. Did you mean !getBank().isOpen() ?

Even if that is the case, doing something only if the bank is not open is a strange way to proceed.

next:

getBank().open();
if (getBank().contains("Lobster pot"))

getBank().open() will only do the interaction. It will not wait for the actual bank widget to appear. So odds are the bank is still not open when you check for the lobster pot.

getBank().getItem("Lobster pot");

This simply gets the item instance. It does not withdraw an item from the bank. To withdraw an item, use the withdraw methods.

while (!getBank().isOpen()) {
     sleep(random(200, 300));
     localWalker.walkPath(backFishing);
}

Not sure what to even say to this part. You walk back to the finishing spot in an eternal loop until the bank is open again? How is walking back to the fishing spot ever going to result in the bank opening?
I can only see this piece of code locking the script

 

Try to revise it a bit; generally you should avoid doing multiple interactions in the same loop cycle, and also avoid potentially infinite loops.

getBank().withdraw("Lobster pot", 1);

if (!getInventory().contains("Lobster pot")) {
            if (!getBank().open()) {
                getBank().open();
                if (getBank().contains("Lobster pot"))
                    getBank().getItem("Lobster pot");
                    System.out.println("Taken a lobster pot out of the bank to fish with.");
                while (!getBank().isOpen()) {
                    sleep(random(200, 300));
                    localWalker.walkPath(backFishing);
                }
                    return 2000;
                }
            }

I'm not sure why but this doesn't seem to work..

 

If my inv doesn't contain the item lobster pot, open bank and get the item out and then it should go fish...

 

It opens the bank but just closes it and walks away.. ?

 

 

You should take a look at using a state based system for your scripts.

 

That code could potentially have some bugs in it. For example, what happens if the bank opening process gets interrupted?

Your script will just walk back to the fishing spot without having retrieved a lobster pot.

 

 

 

I won't spoon feed you the answer, but your logic should be structured similarly to this:

IF inventory does not contain lobster pot
--IF bank is open
----IF bank contains lobster pot
------DO withdraw one lobster pot
----ELSE
------DO stop script
--ELSE IF in bank
----DO open bank
ELSE
DO some fishing

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.