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
  • Storing items help


    sp3cpk

    Recommended Posts

    8 minutes ago, sp3cpk said:

    this is what I have so far            

    List<Item> bankItems = getBank().getBankHistoryCache();
                if(bankItems.stream().anyMatch(lol -> lol.getName().contentEquals("Coins"))){
                    getKeyboard().type("2");
                }

    as soon as the bank is closed it'll stop spamming "2".

     

    If you put that in your onLoop it will reset the list everytime it loops and if the bank is closed it will set it to empty. So you could add a check if the list is empty then get the cache.

    Link to comment
    Share on other sites

    1 hour ago, Milasoft said:

    If you put that in your onLoop it will reset the list everytime it loops and if the bank is closed it will set it to empty. So you could add a check if the list is empty then get the cache.

    I'm pretty sure it returns the items from the last time the bank was open. So even if it's onloop it shouldn't be empty. 

    Also i tried your suggestion, still having trouble x.x

    Link to comment
    Share on other sites

    57 minutes ago, sp3cpk said:

    I'm pretty sure it returns the items from the last time the bank was open. So even if it's onloop it shouldn't be empty. 

    Also i tried your suggestion, still having trouble x.x

    Sorry, I should have just written the full code from the beginning.

    public class Test extends AbstractScript {
    
    	List<Item> bankItems = new ArrayList<Item>();
    
    	@Override
    	public int onLoop() {
    		if(getBank().isOpen()) {
    			bankItems = getBank().all();
    		}
    		if(bankItems.stream().anyMatch(i -> i.getName().equals("Coins"))) {
    			log("Have coins");
    		} else {
    			log("No coins");
    		}
    		return 600;
    	}
    
    }

     

    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.