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.

[HELP] inventory.isEmptyExcept() [NOT WORKING]

Featured Replies

So i have a method -
 

public boolean invContainsCrap(Script si) throws InterruptedException {

si.log("invContainsCrap is running");

if (!inventoryEmptyExcept(si, "item 1", "item 2")) {

return true;

}

return false;
}

 

Im using this method as a while loop while i withdraw 2 different items. 

The first item is withdraw with no problems. but soon as my inventory contains that first item. i get stuck in the loop.

 

[iNFO][bot #2][03/31 10:41:31 PM]: withdrawIngredients is running
[iNFO][bot #2][03/31 10:41:31 PM]: withdrawNeeded is running
[iNFO][bot #2][03/31 10:41:31 PM]: invContainsCrap is running <- found crap in my inv.
[iNFO][bot #2][03/31 10:41:31 PM]: depositCrap is running <- Deposits said crap.
[iNFO][bot #2][03/31 10:41:31 PM]: invContainsCrap is running 
[iNFO][bot #2][03/31 10:41:31 PM]: invContainsCrap is running
[iNFO][bot #2][03/31 10:41:32 PM]: invContainsCrap is running
[iNFO][bot #2][03/31 10:41:32 PM]: invContainsCrap is running
[iNFO][bot #2][03/31 10:41:33 PM]: invContainsCrap is running
[iNFO][bot #2][03/31 10:41:33 PM]: invContainsCrap is running
[iNFO][bot #2][03/31 10:41:34 PM]: invContainsCrap is running
[iNFO][bot #2][03/31 10:41:34 PM]: Terminating script Manifesto Wine...
[iNFO][bot #2][03/31 10:41:34 PM]: Thanks for using my script.
[iNFO][bot #2][03/31 10:41:34 PM]: Script Manifesto Wine has exited!
 
 
 
SKYPE - OSBOTManifesto || If you dont mind me asking a few questions now and then please add my skype smile.png

Edited by Manifesto

Just make your own method?

public static boolean hasJunk(Script s, String... notJunk) {
   Item[] items = s.getInventory().getItems();

   if (items == null || junks == null || junks.length <= 0)
      return false;

   for (Item item : items)
      for (String junk : junks)
         if (item != null && item.getName() != null && !item.getName().equals(junk))
            return true;

   return false;
}

Goodluck!

Edited by Khaleesi

  • Author

Just make your own method?

public static boolean hasJunk(Script s, String... junks) {
   Item[] items = s.getInventory().getItems();

   if (items == null || junks == null || junks.length <= 0)
      return false;

   for (Item item : items)
      for (String junk : junks)
         if (item != null && item.getName() != null && item.getName().equals(junk))
            return true;

   return false;
}

Goodluck!

 

I was going to attempt making one. just wanted to see i there was something i was doing wrong before i did. love you tho thanks for reply!

I was going to attempt making one. just wanted to see i there was something i was doing wrong before i did. love you tho thanks for reply!

 

I don't even try to debug methods anymore, there probs broken, and takes less time to create your own smile.png

I fucked up previous code ;)

 

Here is right code:

public static boolean hasJunk(Script s, String... notJunk) {
   Item[] items = s.getInventory().getItems();

   if (items == null || notJunk == null || notJunk.length <= 0)
      return false;

   for (Item item : items)
      for (String notJunk : notJunk)
         if (item != null && item.getName() != null && !item.getName().equals(notJunk))
            return true;

   return false;
}

Edited by Khaleesi

  • Author

 

I don't even try to debug methods anymore, there probs broken, and takes less time to create your own smile.png

I fucked up previous code wink.png

 

Here is right code:

public static boolean hasJunk(Script s, String... notJunk) {
   Item[] items = s.getInventory().getItems();

   if (items == null || notJunk == null || notJunk.length <= 0)
      return false;

   for (Item item : items)
      for (String notJunk : notJunk)
         if (item != null && item.getName() != null && !item.getName().equals(notJunk))
            return true;

   return false;
}

 

Thanks alot for your help again :)

Thanks alot for your help again smile.png

 

You could have always done

if(inventory.contains("Bones","Watermelon")

That's what I did to get around it, but it ended up still fitting in with my script, for some it wouldn't work.

 

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.