Booleans YAY Posted April 1, 2017 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.
Night Posted April 1, 2017 Posted April 1, 2017 This already exists. I'm recommend reading the API. 2
Chris Posted April 1, 2017 Posted April 1, 2017 try using ConditionalSleep or find explv's snippet in the snippet section or create your own method.
Booleans YAY Posted April 1, 2017 Author 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?
IDontEB Posted April 1, 2017 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();
Hel Posted April 1, 2017 Posted April 1, 2017 You could also even just use a while function while(myPlayer().isAnimating()){ sleep(random(400, 500)); }
Reveance Posted April 1, 2017 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
harrypotter Posted April 1, 2017 Posted April 1, 2017 I suggest reading @Explv's Scripting 101 Tut: All this plus a lot more useful info can be found there.
Booleans YAY Posted April 1, 2017 Author 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.
Team Cape Posted April 1, 2017 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
Alek Posted April 1, 2017 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.
IDontEB Posted April 1, 2017 Posted April 1, 2017 28 minutes ago, Imateamcape said: no. Is there something wrong with it im not seeing?
Alek Posted April 1, 2017 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
IDontEB Posted April 1, 2017 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
Alek Posted April 1, 2017 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.