Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- public class wormholeWC extends Script {
- @ScriptManifest(authors = "wormhole95", keywords = "Woodcutting", name = "wormholeWC", version = 0.1, description = "Just a simple autocutter")
- final int[] hatchetID = { 1351, 1349, 1353, 1361, 1355, 1357, 1359, 6739 };
- final int willowLog = 13204870;
- final int treeID = 12432;
- final RSTile[] willowsToBank = new RSTile[] { new RSTile(1234, 1234),
- new RSTile(1234, 1234) };
- final RSTile[] bankToWillows = new RSTile[] { new RSTile(1234, 1234),
- new RSTile(1234, 1234) };
- private boolean atBank() {
- RSArea area = new RSArea(new RSTile(1234, 1234), new RSTile(1234, 1234));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean atTrees() {
- RSArea area = new RSArea(new RSTile(1234, 1234), new RSTile(1234, 1234));
- return area.contains(getMyPlayer().getLocation());
- }
- private enum State {
- CHOP, WALKTOBANK, WALKTOTREES, BANK, SLEEP
- }
- private State getState() {
- if (getMyPlayer().getAnimation() != -1 && getMyPlayer().isIdle()) {
- log("State.SLEEP");
- return State.SLEEP;
- }
- // Bank
- if (atBank()) {
- if (inventory.isFull()) {
- log("State.BANK");
- return State.BANK;
- }
- }
- // Chop
- if (!inventory.isFull() && getMyPlayer().getAnimation() != -1) {
- RSObject tree = objects.getNearest(treeID);
- if (tree != null) {
- if (atTrees()) {
- log("State.CHOP");
- return State.CHOP;
- }
- }
- }
- // WalkToBank
- if (inventory.isFull()) {
- if (!atBank()) {
- log("State.WALKTOBANK");
- return State.WALKTOBANK;
- }
- }
- // WalkToTrees
- if (!inventory.isFull()) {
- if (!atTrees()) {
- log("State.WALKTOBANK");
- return State.WALKTOTREES;
- }
- }
- // Sleep
- return State.SLEEP;
- }
- public int loop() {
- if (!game.isLoggedIn()) {
- return random(600, 900);
- }
- switch (getState()) {
- case BANK:
- if (bank.isOpen()) {
- if (inventory.getCount(willowLog) > 0) {
- log("Depositing" + (inventory.getCount(willowLog)) + "Logs");
- bank.deposit(willowLog, inventory.getCount(willowLog));
- break;
- }
- log("Closing Bank");
- bank.close();
- }
- else {
- log("Opening Bank");
- bank.open();
- }
- break;
- case CHOP:
- RSObject tree = objects.getNearest(treeID);
- if(tree != null) {
- if (tree.isOnScreen()) {
- tree.doAction("Chop");
- }
- else if (!tree.isOnScreen()) {
- if (random(0, 2) == 0)
- walking.walkTileMM(tree.getLocation());
- else
- walking.walkTileOnScreen(tree.getLocation());
- }
- }
- break;
- case WALKTOBANK:
- walking.walkPathMM(willowsToBank, 3, 3);
- break;
- case WALKTOTREES:
- walking.walkPathMM(bankToWillows, 3, 3);
- break;
- case SLEEP:
- log("Sleep");
- sleep(random(300, 500));
- break;
- }
- return random(300, 500);
- }
- }
Add Comment
Please, Sign In to add comment