January 10, 20179 yr I'm trying to create a basic edgeville yew cutting script just to learn a little bit, package edgeChopper; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.input.mouse.MiniMapTileDestination; import org.osbot.rs07.api.map.Area; import java.awt.*; @ScriptManifest(name = "edgeYews", author = "Mumble", version = 1.0, info = "", logo = "") public class edgeChopper extends Script { public final int ALIVE_YEW=38755; private Area BANK_AREA = new Area(3098, 3488, 3092, 3498); private Area CHOP_AREA = new Area(3089, 3468, 3085, 3482); private enum State { CHOP, WALK_TO_BANK, BANK, WALK_TO_CHOP }; private State getState() { if (inventory.isFull() && CHOP_AREA.contains(myPlayer())) return State.WALK_TO_BANK; if (!inventory.isFull() && BANK_AREA.contains(myPlayer())) return State.WALK_TO_CHOP; if (inventory.isFull() && BANK_AREA.contains(myPlayer())) return State.BANK; return State.CHOP; } @[member=Override] public void onStart() { //Code here will execute before the loop is started log("hopefully this fucking works"); } @[member=Override] public void onExit() { //Code here will execute after the script ends } @[member=Override] public int onLoop() throws InterruptedException { switch (getState()) { case CHOP: if (!myPlayer().isAnimating()) { RS2Object tree = objects.closest(ALIVE_YEW); if (tree != null) { if (tree.interact("Chop")) sleep(random(1000, 1500)); } } break; case WALK_TO_BANK: getWalking().webWalk(BANK_AREA); sleep(random(1500, 2500)); break; case WALK_TO_CHOP: getWalking().webWalk(CHOP_AREA); sleep(random(1500, 2500)); break; case BANK: RS2Object bankBooth = objects.closest("Bank booth"); if (bankBooth != null) { if (bankBooth.interact("Bank")) { while (!bank.isOpen()) sleep(250); bank.depositAll(); } } break; } return 100; //The amount of time in milliseconds before the loop starts over } @[member=Override] public void onPaint(Graphics2D g) { //This is where you will put your code for paint(s) } } In the onLoop() section I'm confronted with an Unhandled exception type error and I'm not sure how to fix it. Thanks for any help.
January 10, 20179 yr to save time, which line does the unhandled exception occur at? could you show what is on these lines?
January 10, 20179 yr drink a cup of chammomile tea an hr before bed don't use any backlit devices an hr before bed Why are you trolling in the scripter section?
January 10, 20179 yr Surround your sleeps with try and catch, for example wherever you have a sleep: try { sleep(random(1000, 2000)); } catch (InterruptedException e) { e.printStackTrace(); }
January 10, 20179 yr what lol add my skype, probably save more time: precise.scripting Surround your sleeps with try and catch, for example wherever you have a sleep: try { sleep(random(1000, 2000)); } catch (InterruptedException e) { e.printStackTrace(); } no need since onLoop throws Interrupted Exception
January 10, 20179 yr Author what lol add my skype, probably save more time: precise.scripting no need since onLoop throws Interrupted Exception Turns out I just needed to save the program so it would update. Thanks to this guy I've managed to fix this issue.
Create an account or sign in to comment