Milasoft 202 Share Posted September 5, 2018 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 More sharing options...
sp3cpk 0 Author Share Posted September 6, 2018 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 More sharing options...
Milasoft 202 Share Posted September 6, 2018 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.