Imthabawse Posted April 14, 2019 Share Posted April 14, 2019 (edited) Having trouble making a ConditionalSleep for my catchKebbit method and retrieveKebbit method. Any suggestions? Just got standard sleep(randoms) for now which works but wouldn't wanna run to long this way. Perhaps for such a standard script it wont really matter though..? Also for dropping method is there a way to drop items from top to bottom instead of always left to right? Or just randomize it better? Also realizing the bot will go for another players falcon as well so will only work in an empty world as it sits Code: private Area huntingArea = new Area(2365, 3596, 2393, 3575); private void catchKebbit() throws InterruptedException { NPC spottedKebbit = getNpcs().closest("Spotted kebbit"); NPC falcon = getNpcs().closest("Gyr Falcon"); if (!myPlayer().isAnimating() && !myPlayer().isMoving() && getEquipment().isWearingItemThatContains(EquipmentSlot.WEAPON, "Falconer's glove") && !getInventory().isFull() && spottedKebbit != null && falcon == null) { log("Catching Kebbit..."); spottedKebbit.interact("Catch"); sleep(random(2500, 3000)); } } private void retrieveKebbit() throws InterruptedException { NPC caughtKebbit = getNpcs().closest("Gyr Falcon"); if (!myPlayer().isAnimating() && !myPlayer().isMoving() && !getInventory().isFull() && caughtKebbit != null) { log("Retrieving Kebbit..."); caughtKebbit.interact("Retrieve"); sleep(random(2500, 3000)); } } private void dropAll() { if(getInventory().isFull() && !myPlayer().isAnimating() && !myPlayer().isMoving()) { log("Inventory FULL.. dropping fur's and bones..."); getInventory().dropAllExcept("Dramen staff","Varrock teleport","Stamina potion(4)","Coins"); } } @Override public int onLoop() throws InterruptedException { if(huntingArea.contains(myPlayer())) { catchKebbit(); retrieveKebbit(); dropAll(); }else{ stop(); } return 1000; } } Edited April 15, 2019 by Imthabawse Quote Link to comment Share on other sites More sharing options...
dreameo Posted April 16, 2019 Share Posted April 16, 2019 I'm guessing this is hunting - don't really know much about it. I'm not sure the difference between catching and receiving a kebbit. But in any case, you want to create a conditional sleep such that you sleep until you're inventory contains x + 1 kebbits. So you would need a variable representing the previous count, X, and sleep until getCurrentKebbitCount() == X + 1. 1 Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted April 17, 2019 Author Share Posted April 17, 2019 9 hours ago, dreameo said: I'm guessing this is hunting - don't really know much about it. I'm not sure the difference between catching and receiving a kebbit. But in any case, you want to create a conditional sleep such that you sleep until you're inventory contains x + 1 kebbits. So you would need a variable representing the previous count, X, and sleep until getCurrentKebbitCount() == X + 1. When you "Retrieve" a Kebbit in this case Spotted Kebbit you get a bone and a fur in your inventory so you got me thinking on the right path just gotta figure out how to write it. Something along the lines of sleep until getInventory.contains +1 bones +1furs Quote Link to comment Share on other sites More sharing options...