Tommm39 Posted April 24, 2018 Share Posted April 24, 2018 Kind of based on this old thread I found When you have a conditional sleep statement: new ConditionalSleep(10000) { public boolean condition() { return !tree.exists() || myPlayer().isAnimating(); } }.sleep(); The osbot API states that the bot will sleep until the condition is false or the timeout expires. I get that you want the bot to sleep until the tree no longer exists since it will be cutting it in the meantime but I don't really understand why you must say myPlayer().isAnimating() and not !myPlayer().isAnimating(). Why would you want the bot to stop sleeping once the player starts animating (i.e. chopping the tree)? If someone could explain in pseudo code that would be great Just starting scripting today so please be kind Many thanks Quote Link to comment Share on other sites More sharing options...
liverare Posted April 24, 2018 Share Posted April 24, 2018 return !tree.exists() || myPlayer().isAnimating(); "tree doesn't exist OR we are not animating" Keyword: "OR" If the tree exists, then we check whether we're chopping it. If we're not chopping it, aka. "animating", then we should probably 'wake up' and get back to chopping it. Quote Link to comment Share on other sites More sharing options...
Tommm39 Posted April 24, 2018 Author Share Posted April 24, 2018 (edited) 4 minutes ago, liverare said: return !tree.exists() || myPlayer().isAnimating(); "tree doesn't exist OR we are not animating" Keyword: "OR" If the tree exists, then we check whether we're chopping it. If we're not chopping it, aka. "animating", then we should probably 'wake up' and get back to chopping it. That's what I don't get though, we have the ! operator in front of the first condition to state that the tree doesn't exist, why don't we have it in front of the isAnimating() condition? Like you said tree DOESN'T exist or we are NOT animating, so they're both false but only one of them uses the ! operator Am I missing something obvious.. Don't you want to end the sleep if !tree.exists() || myPlayer().isNOTAnimating() i.e. !myPlayer().isAnimating() Edited April 24, 2018 by Tommm39 Quote Link to comment Share on other sites More sharing options...
Taylorr Posted April 25, 2018 Share Posted April 25, 2018 I see your confusion with using the ! Operator once or twice for the statement. I had the same question before I saw you even asked lol. Following this thread for the answer. Quote Link to comment Share on other sites More sharing options...
Tommm39 Posted April 25, 2018 Author Share Posted April 25, 2018 1 hour ago, Taylorr said: I see your confusion with using the ! Operator once or twice for the statement. I had the same question before I saw you even asked lol. Following this thread for the answer. I'm sure I'm missing something obvious but I think it's weird that you're sleeping until the tree doesn't exist or your character isn't animating but you only use the ! for the former Quote Link to comment Share on other sites More sharing options...
d0zza Posted April 25, 2018 Share Posted April 25, 2018 With a conditional sleep, it sleeps until the condition is true, not false, or until the timeout expires. What your condition is solely relies on the rest of your code. In this case we are sleeping until myPlayer().isAnimating() because presumably the script won't try to cut another tree when the player is animating. Quote Link to comment Share on other sites More sharing options...
Antonio Kala Posted April 25, 2018 Share Posted April 25, 2018 3 minutes ago, d0zza said: With a conditional sleep, it sleeps until the condition is true, not false, or until the timeout expires. What your condition is solely relies on the rest of your code. In this case we are sleeping until myPlayer().isAnimating() because presumably the script won't try to cut another tree when the player is animating. How often is the condition checked to see if it's true? Quote Link to comment Share on other sites More sharing options...
d0zza Posted April 25, 2018 Share Posted April 25, 2018 25 minutes ago, Antonio Kala said: How often is the condition checked to see if it's true? Every 25 milliseconds from memory, I'm pretty sure you can also modify this value by adding another argument to ConditionalSleep. Quote Link to comment Share on other sites More sharing options...