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.

How to check amount of coins in inventory?

Featured Replies

SOLVED THANKES TO

Juggles

__________________________________________________________________________________________________________

I'm making a script that involves checking the amount of coins a player has in their inventory.

 

At the moment it doesn't do anything. It doesn't even open the bank.

Here is my code

case BANK:
    if (!getBank().isOpen()){
        getBank().open();
    } else if (inventory.getAmount("Coins") < 500) {
        getBank().withdrawAll("Coins");
    } else {
        getBank().close();
    }
break;

It's pretty similar to this, so I'm not sure what I'm doing wrong.

http://osbot.org/forum/topic/68196-get-the-amount-of-items-in-inventory/

 

Thanks.

Edited by Lexhanatin

because you need to use getBank().open()  ?

I'm making a script that involves checking the amount of coins a player has in their inventory.

 

At the moment it doesn't do anything. It doesn't even open the bank.

Here is my code

case BANK:
    // If inventory contains less than 500 coins, withdraw coins
    if (inventory.getAmount("Coins") < 500) {
        getBank().withdrawAll("Coins");
    } else {
        getBank().close();
    }
break;

It's pretty similar to this, so I'm not sure what I'm doing wrong.

http://osbot.org/forum/topic/68196-get-the-amount-of-items-in-inventory/

 

Thanks.

 

You need to open the bank first.

if (getBank() == null) {
    // walk to bank
} else if (!getBank().isOpen()) {
    if (getBank().open()) {
        new ConditionalSleep(5000) {
            @ Override
            public boolean condition() throws InterruptedException {
                return getBank().isOpen();
            }
        }.sleep();
    }
} else {
    getBank().withdrawAll("Coins");
}
  • Author

because you need to use getBank().open()  ?

I had that already, I just forgot to add it into the code example.

Sorry.

  • Author

Check your state. It's probably not calling the case 

Thank you so much. You were right.

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.