June 16, 201312 yr I don't understand why your code is on one line it's rather silly. Not sure if it's the website but I've structured the code. @ScriptManifest(name = "DraynorChopperPro", author = "Maxi", version = 1.0D, info="") class DraynorChopperPro extends Script { int bankId = 2213; int[] treeIds = [5551, 5552, 5553, 1308]; enum State { IDLE, CHOPPING, WALK_TO_BANK, PIN, BANKING, WALK_TO_WILLOWS }; def state = State.IDLE; def currentTree = null; void onStart() { if (client.getInventory().isFull()) state = State.WALK_TO_BANK; } int onLoop() { switch (state) { case State.IDLE: return onIdle(); case State.CHOPPING: return onChopping(); case State.WALK_TO_BANK: return walkToBank(); case State.BANKING: return bank(); case State.WALK_TO_WILLOWS: return walkToWillows(); } return 3000 + random(2000); } int onIdle() { if (client.getInventory().isFull()) { state = State.WALK_TO_BANK; return 800 + gRandom(800, 400); } currentTree = closestObject(treeIds) if(currentTree != null) { log("Closest willow tree : (${currentTree.getX()}, ${currentTree.getY()})"); selectEntityOption(currentTree, "Chop down", "Willow"); if (random(5) == 0) { client.moveCameraToEntity(currentTree); sleep(700 + gRandom(500, 200)); } } return 1500 + gRandom(2000, 500); } int onChopping() { if (client.getInventory().isFull()) { state = State.WALK_TO_BANK; return 800 + gRandom(800, 400); } if (random(30) == 0 && currentTree != null && currentTree.exists()) client.moveCameraToEntity(currentTree); if (currentTree == null) { state = State.IDLE; log("Chopped down Willow!"); return 500 + gRandom(1000, 500); } if (!currentTree.exists()) { state = State.IDLE; currentTree = null; log("Chopped down Willow!"); } return 500 + gRandom(1000, 500); } int walkToBank() { selectEntityOption(closestObject(bankId), "Bank", "Bank booth") if (myX() <= 3087 && myX() >= 3096 && myY() >= 3248 && myY() <= 3240) { return 800 + gRandom(500, 200); } sleep(1000 + gRandom(300, 50)); if (client.getBank().isOpen()) state = State.BANKING; return 500 + gRandom(1000, 400); } int bank() { client.getBank().depositAll(); state = State.WALK_TO_WILLOWS; def tree = closestObject(treeIds); return 500 + gRandom(700, 300); } int walkToWillows() { log("Walking to Willow Trees"); currentTree = closestObject(treeIds); if (currentTree != null) { log("Closest willow tree : (${currentTree.getX()}, ${currentTree.getY()})"); selectEntityOption(currentTree, "Chop down", "Willow"); client.moveCameraToEntity(currentTree); } return 2000 + gRandom(800, 300); } void onMessage(String message) { if (message == "You swing your axe at the tree.") { log("Chopping down tree!"); state = State.CHOPPING; } else if (message == "You get some logs.") { state = State.IDLE; } else if (message == "Your inventory is too full to hold any more logs.") { state = State.WALK_TO_BANK; } } }
January 7, 201412 yr Outdated. If the author wishes to update, they can PM. I'm closing the thread and moving it to the outdated scripts section.