April 24, 20187 yr 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
April 24, 20187 yr 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.
April 24, 20187 yr Author 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, 20187 yr by Tommm39
April 25, 20187 yr 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.
April 25, 20187 yr Author 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
April 25, 20187 yr 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.
April 25, 20187 yr 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?
April 25, 20187 yr 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.
Create an account or sign in to comment