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.

if (getInventory().isFull()) { Crashes script / NPE

Featured Replies

if (this.api.store.isOpen()) {
            //Close shop and open packs
            if (getInventory().isFull()) {
                this.api.store.close();
            if (!getInventory().isItemSelected()) {
                getInventory().getItem(itemPack).interact("Open");
            new ConditionalSleep(10000) {
                @Override 
                public boolean condition() {
                return (!getInventory().isFull());
                }
            }.sleep();
            }
            }

This is what im trying to implement into my script. However, (getInventory().isFull()) breaks the script and floods log with NPE error.

I've found that it does this no matter where it is placed in my script.

 

I suppose an alternative would be 

(inventory.contains(itemPack) && inventory.getAmount(itemPack) >= )

but this would limit the scripts capabilities of purchasing more than 1 item at a time.

 

 

Help:gnome:

Edited by Chris050999

Not sure if it's this but try to change

  public boolean condition() {
                return (!getInventory().isFull());
                }

to

  public boolean condition() {
                return !getInventory().isFull();
                }

AKA just remove the ( ) between the return line.

Edited by Ragboys is back

I'm assuming if you have to do

this.api.store.

then I'm guessing you also need to do

this.api.getInventory().isFull()

either way, look into this:

 

  • Author
13 hours ago, Ragboys is back said:

Not sure if it's this but try to change


  public boolean condition() {
                return (!getInventory().isFull());
                }

to


  public boolean condition() {
                return !getInventory().isFull();
                }

AKA just remove the ( ) between the return line.

Did not and should not make a difference?
Not too sure haha.

 

13 hours ago, liverare said:

I'm assuming if you have to do


this.api.store.

then I'm guessing you also need to do


this.api.getInventory().isFull()

either way, look into this:

 

You are correct and I feel like a dummy for not realizing it myself.

Still causes a crash even if i call it outside of the class that uses api though, cant figure out why. This'll do for now though, thanks 😃

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.