May 1, 20169 yr hey there forums, I was just wondering if it would be possible to check the amount of grounditems in a stack. like arrows on the ground. then pick them up if the stack is greater than a number. i tried : GroundItem loot = getGroundItems().closest(g.item); log("test1"); if(loot.getAmount() > 3 && (!inventory.isFull() || inventory.contains(g.item))) { log("test2 in if statement"); loot.interact("Take"); sleep(random(800,1000)); } -------- and the "loot.getamount() > 3" always made my code crash.
May 1, 20169 yr if(!inventory.isFull()){ if(loot.getAmount() > 3){ loot.interact("Take"); } } Edited May 1, 20169 yr by Bradf3rd
May 1, 20169 yr what do you mean by null check.That you should nullcheck pretty much everything before interacting with it.If (thing != null) { thing.doSomething; }
Create an account or sign in to comment