Nebulae Posted August 7, 2016 Share Posted August 7, 2016 (edited) I'm making a combat script right now which kill mobs, and if the user requests it will pick up bones and bury them. I wait for the inventory to fill up and then do a check for all of the drop / banking needs of the script. I want to make a method which will work for future uses as well and you can just give it a specific item and interact option and it will iterate over each item in the inventory and execute the interact command. Currently the script has a problem where it will detect all of the bones, it will do the interact command but it gets way ahead of its self. Say if the inventory has 6 bones, it will spam click really bad on the first bone, and sometimes click the second bone and just stop. I didn't want to use a while loop checking to make sure the inventory doesn't have anymore of that item in it since I wanted to make this method as I said more robust and not just for burying bones. So I can use it for multiple commands whenever they come up besides just burying. I was wondering if there's a more elegant way of making sure the command has executed through the client vs just doing random sleeping amounts and hoping the script doesn't miss an item. Edited August 7, 2016 by Nebulae Quote Link to comment Share on other sites More sharing options...
IHB Posted August 7, 2016 Share Posted August 7, 2016 (edited) Use conditional sleeps when u bury each bone, eg store the valur of bones in inventory then click and wait until the amount of bones in invent is less than the stored value Edit; eg: if inventory contains bones oldBones = inventory.getitem("bones").getAmount(); 8nventory,".getitem("bones").interact("bury"); new ConditionalSleep(2000) { @ Override public boolean condition() throws InterruptedException { return oldBones > inventory.getitem("bones").getamount; } }.sleep(); Sry for text wrote on phone Edited August 7, 2016 by IHB 1 Quote Link to comment Share on other sites More sharing options...
Nebulae Posted August 7, 2016 Author Share Posted August 7, 2016 Use conditional sleeps when u bury each bone, eg store the valur of bones in inventory then click and wait until the amount of bones in invent is less than the stored value Wow, thanks for this can't believe I never thought of that. Quote Link to comment Share on other sites More sharing options...
RamSkulls Posted August 7, 2016 Share Posted August 7, 2016 Use conditional sleeps when u bury each bone, eg store the valur of bones in inventory then click and wait until the amount of bones in invent is less than the stored value Edit; eg: if inventory contains bones oldBones = inventory.getitem("bones").getAmount(); 8nventory,".getitem("bones").interact("bury"); new ConditionalSleep(2000) { @ Override public boolean condition() throws InterruptedException { return oldBones > inventory.getitem("bones").getamount; } }.sleep(); Sry for text wrote on phone nailed it Quote Link to comment Share on other sites More sharing options...