Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Suggestion - Add method


    Im A Baller
     Share

    Recommended Posts

    AbstractItemContainer#getSlotForNameContaining(String name) - very useful for both banking and using inventory slots for items such as Potions(4,3,2..), Waterskins(4,3,2..), Glory(6,5,4,...), Ring of dueling(8,7,6...), and the list goes on.

     

    This method would find a slot that holds any given item whose name contains the given string. If no such item is found, it would return a -1.

     

    I'm currently just using my own ghetto implementation:

    	public int getSlotForNameContaining(AbstractItemContainer<Item> container, String contained) {
    		for(int i = 0; i < 28; i++) {
    			if(container.slotNameContains(i, contained)) {
    				return i;
    			}
    		}
    		return -1;
    	}
    
    Edited by Im A Baller
    Link to comment
    Share on other sites

    Aren't you able to use a filter?

     

    Probably should have used a filter instead of the method above. Good point, though that doesn't necessarily negate the utility of this method

    Edited by Im A Baller
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.