Booleans YAY Posted April 1, 2017 Share Posted April 1, 2017 Can we get a functional sleep that sleeps until event complete so like for firemaking sleepUntil(!myPlayer.isAnimating)); or like gaining experience, etc.. Something like that to have clean easy to use code would be awesome, rather than creating abstract, redundant task handlings for it. Would really appreciate this function for numerous things. Quote Link to comment Share on other sites More sharing options...
Night Posted April 1, 2017 Share Posted April 1, 2017 This already exists. I'm recommend reading the API. 2 Quote Link to comment Share on other sites More sharing options...
Chris Posted April 1, 2017 Share Posted April 1, 2017 try using ConditionalSleep or find explv's snippet in the snippet section or create your own method. Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted April 1, 2017 Author Share Posted April 1, 2017 I haven't really looked through the API's conditional sleep until animation is reset to stand index. Can someone show me a snippet for conditional sleep till animation is reset please? Quote Link to comment Share on other sites More sharing options...
IDontEB Posted April 1, 2017 Share Posted April 1, 2017 34 minutes ago, Booleans YAY said: I haven't really looked through the API's conditional sleep until animation is reset to stand index. Can someone show me a snippet for conditional sleep till animation is reset please? new ConditionalSleep(1000, 3000) { public boolean condition() throws InterruptedException { return getInventory().contains("item"); } }.sleep(); Quote Link to comment Share on other sites More sharing options...
Hel Posted April 1, 2017 Share Posted April 1, 2017 You could also even just use a while function while(myPlayer().isAnimating()){ sleep(random(400, 500)); } Quote Link to comment Share on other sites More sharing options...
Reveance Posted April 1, 2017 Share Posted April 1, 2017 (edited) new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return !myPlayer().isAnimating(); } }.sleep(); Sleeps for max 10 seconds or until the player is not animating anymore Edited April 1, 2017 by Reveance 1 Quote Link to comment Share on other sites More sharing options...
harrypotter Posted April 1, 2017 Share Posted April 1, 2017 I suggest reading @Explv's Scripting 101 Tut: All this plus a lot more useful info can be found there. Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted April 1, 2017 Author Share Posted April 1, 2017 I also haven't tried the conditional sleep with animation check since i wrote my first few scripts which one was a firemaking one. I'll review this stuff another day when I get the time. I appreciate the over haul responses from the community. Quote Link to comment Share on other sites More sharing options...
Team Cape Posted April 1, 2017 Share Posted April 1, 2017 16 hours ago, IDontEvenBot said: new ConditionalSleep(1000, 3000) { public boolean condition() throws InterruptedException { return getInventory().contains("item"); } }.sleep(); no. 1 Quote Link to comment Share on other sites More sharing options...
Alek Posted April 1, 2017 Share Posted April 1, 2017 16 hours ago, Slut said: You could also even just use a while function while(myPlayer().isAnimating()){ sleep(random(400, 500)); } Random is unnecessary and while loops like this should have a timeout. Quote Link to comment Share on other sites More sharing options...
IDontEB Posted April 1, 2017 Share Posted April 1, 2017 28 minutes ago, Imateamcape said: no. Is there something wrong with it im not seeing? Quote Link to comment Share on other sites More sharing options...
Alek Posted April 1, 2017 Share Posted April 1, 2017 1 minute ago, IDontEvenBot said: Is there something wrong with it im not seeing? Read the ConditionalSleep documentation, your sleep won't do anything. 2 Quote Link to comment Share on other sites More sharing options...
IDontEB Posted April 1, 2017 Share Posted April 1, 2017 5 minutes ago, Alek said: Read the ConditionalSleep documentation, your sleep won't do anything. Whoooops never actually read what Sleeptime was and assumed it was sleep randomly between X - X LMAO! Thank you for enlightening me. 1 Quote Link to comment Share on other sites More sharing options...
Alek Posted April 1, 2017 Share Posted April 1, 2017 3 minutes ago, IDontEvenBot said: Whoooops never actually read what Sleeptime was and assumed it was sleep randomly between X - X LMAO! Thank you for enlightening me. Don't feel bad, even scripters were screwing this up for a while. Quote Link to comment Share on other sites More sharing options...