Skip 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.

need help with inventory.isFull() & inventory.isEmptyExcept(xx)

Featured Replies

EDIT; Guys, I still need help, please scroll down and help me please :s

so what im trying to do is return a state for banking once the inventory becomes full and the same thing for if its empty even tho its containing 2 different items, here is my code

	private enum State {
		ERROR, WALKBACK, BANK, WAIT,
	};
	
	private State getState() {
		if (!inventory.contains(563) || !equipment.contains(1381))
		{
			log("State ERROR returned");
			return State.ERROR;
		}
		
		}
		if (inventory.isEmptyExcept(563, 555) || inventory.isEmptyExcept(563))
		{
			log("State WALKBACK returned");
			return State.WALKBACK;
		}
		if (inventory.isFull())
		{
			log("State BANK returned");
			return State.BANK;
		}
		return State.WAIT;
	}

idk if im doing this right but shouldnt it log out my text if my inventory is full/isEmptyExcept(xx)? its not working but all of my other getStates are working just fine

 

so im obviously missing something or using the wrong methods

Edited by cjeee

so what im trying to do is return a state for banking once the inventory becomes full and the same thing for if its empty even tho its containing 2 different items, here is my code

	
isEmptyExcept();

is broken.

A fix along the lines of:

 

 boolean inventoryEmptyExcept(final int...ints){
        return !inventory.contains(new Filter<Item>() {
            @Override
            public boolean match(Item item) {
                return item != null && !Arrays.asList(ints).contains(item.getId());
            }
        });
    }

Could be edited to strings ect

  • Author
isEmptyExcept();

is broken.

A fix along the lines of:

 

 boolean inventoryEmptyExcept(final int...ints){
        return !inventory.contains(new Filter<Item>() {
            @Override
            public boolean match(Item item) {
                return item != null && !Arrays.asList(ints).contains(item.getId());
            }
        });
    }

Could be edited to strings ect

 

Im getting these errors in my code when i put them in:

 

"The method contains(List<Item>) in the type ItemContainer is not applicable for the arguments (new Filter<Item>(){})"

 

Also

 

getting an error under "match(Item item)

public boolean match(Item item)

"The method match(Item) of type new Filter<Item>(){} must override or implement a supertype method"

 

im sorry i am a noob at this but im always willing to learn! biggrin.png

 

EDIT: I added the import and im getting a warning message under all of the code you send me now

"Type safety: A generic array of Filter<Item> is created for a varargs parameter"

 

Edited by cjeee

 

import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.model.Item;
import java.util.Arrays;

these ones?

 

  • Author
import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.model.Item;
import java.util.Arrays;

these ones?

 

 

yessir!

 

EDIT: When i added the code:

if (inventoryEmptyExcept(563, 555) || inventoryEmptyExcept(563))
		{
			log("State WALKBACK returned");
			return State.WALKBACK;
		}

along with the warning below, i still don't receive a log back when those conditions are met.

can somebody please help me? sad.png

 

Edited by cjeee

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.