mlrkey Posted May 23, 2015 Posted May 23, 2015 (edited) Can't seem to figure this out, I have 15 of a certain item in my inv and I want to only drop 5 of that item. Edited May 23, 2015 by mlrkey
Joseph Posted May 23, 2015 Posted May 23, 2015 public boolean dropOnlyThis(String[] blackList) throws IllegalArgumentException, InterruptedException { if (getInventory().contains(blackList)) { List<Item> list = getInventory().filter(new ContainsNameFilter<Item>(blackList)); for (Item item: list) { if (item != null) { item.interact("drop"); sleep(gRandom(400,100)); } } } return !getInventory().contains(blackList); } tell me if this helps
mlrkey Posted May 23, 2015 Author Posted May 23, 2015 public boolean dropOnlyThis(String[] blackList) throws IllegalArgumentException, InterruptedException { if (getInventory().contains(blackList)) { List<Item> list = getInventory().filter(new ContainsNameFilter<Item>(blackList)); for (Item item: list) { if (item != null) { item.interact("drop"); sleep(gRandom(400,100)); } } } return !getInventory().contains(blackList); } tell me if this helps I should have been more specific. I have 15 of a certain item in my inv and I want to only drop 5 of that item.
Flamezzz Posted May 23, 2015 Posted May 23, 2015 Smth like this? inventory.dropForFilter(item -> item.getName().equals("Item Name") && inventory.getAmount("Item Name") > 10); 10 can obv be replaced with getAmount-5 before you use this statement if you want
FrostBug Posted May 23, 2015 Posted May 23, 2015 Just do something like if(getInventory().getAmount("Item") > 10) { getInventory().drop("Item"); } If you're using a non-sequential framework, it should get repeated in every loop cycle until you've dropped 5