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
  • Suggestion - Add method


    Im A Baller

    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;
    	}
    
    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.