May 30, 20178 yr So, as most people posting in this section seem to be, I'm pretty new. In my attempt to make my first script, I combined the 'Tea Stealer' tutorial (Top post of this section) with some information from Explv's tutorial in order to attempt to make a basic woodcutting script. My basic edits to 'Tea stealer' went down without a htich, as the script comfortably locates trees and selects 'Chop down'. However, the issue is that it just spam clicks them which I estimate would take 12 minutes to get me banned. As such, I found Explv's tutorial which included information on 'ConditionalSleep' which prevents this. So I copy&pasted his sleep code into the seemingly-appropriate section and... it didn't do anything. The script just carries on exactly like this snippet of code doesn't exist. Quote @Override public int onLoop() throws InterruptedException { switch (getState()) { case STEAL: final RS2Object tree = getObjects().closest("Tree"); if (tree != null && tree.interact("Chop down")) { new ConditionalSleep(5000) { @Override public boolean condition() { return myPlayer().isAnimating() || !tree.exists(); } }.sleep(); } break; case DROP: inventory.dropAll(); break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } That's the affected part of my code, the onLoop bit. Can anyone see what the issue is? I'll also include my imports incase that could be an issue: Quote import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; Cheers for any assistance. Also, does anyone have any good ways to get into this? I've completed the CodeAcadamy course on JavaScript as well as looked extensively at both tutorials previously mentioned and a lot of the time I'm struggling to make the links. I understand the core language as a result of the CodeAcadamy course so I know what if statements and all that is, but there's still so much I just don't and there doesn't really seem to be anywhere that I can bridge the gap. For example, I don't know what public void, private void, the difference between them, what void even if, what 'final' means (For example, see onLoop code under 'Case steal'.
May 30, 20178 yr Works as intended. you are calling isAnimating() which returns true once you start the tree chop animation it will stop the conditional sleep once it returns true. What you need is a logic check. if (!isAnimating()) chopTree();
May 30, 20178 yr Author 5 minutes ago, Chris said: Works as intended. you are calling isAnimating() which returns true once you start the tree chop animation it will stop the conditional sleep once it returns true. What you need is a logic check. if (!isAnimating()) chopTree(); Ah that seems simple enough, Basically what's happening is the sleep is ending whenever I'm in an animation since that's what it's set to. It should be !isAnimating so that the sleep ends when the player is not animating. Cheers! Edited May 30, 20178 yr by A Cool Lad