Swizzbeat Posted July 6, 2014 Share Posted July 6, 2014 (edited) Since I think it's important scripters do this instead of adding static sleeps here's a basic guide on how to use them. The ConditonalSleep interface takes a timeout parameter as well as a condition method that requires overriding. When the sleep() method is invoked on the instantiated anonymous implementation it will sleep until either the timeout argument is met or the condition returns true. The condition method will return true if the condition was met before the specified timeout or false if the timeout has passed. For example the following code will sleep until either 5000 milliseconds has passed or the condition method returns true, then return the value. return new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return sI.myPlayer().isAnimating(); } }.sleep(); Edited July 6, 2014 by Swizzbeat 1 Link to comment Share on other sites More sharing options...
Single Core Posted July 6, 2014 Share Posted July 6, 2014 I use the Timer class and do this, which is the same thing I assume. xd time.reset(); while(time.isRunning() && script.myPlayer().isAnimating()) { MethodProvider.sleep(50); } Link to comment Share on other sites More sharing options...
Swizzbeat Posted July 6, 2014 Author Share Posted July 6, 2014 (edited) I use the Timer class and do this, which is the same thing I assume. xd time.reset(); while(time.isRunning() && script.myPlayer().isAnimating()) { MethodProvider.sleep(50); } Not really needed since the API already provides this in many different ways: Edited July 6, 2014 by Swizzbeat Link to comment Share on other sites More sharing options...