Pengu 23 Share Posted December 17, 2017 First try on making a script with states Its a progressive wc up to willows.i tested on a acc with lvl 20 wc, so it should use the oak area.It walks to the correct area but dosent do anything when its thereI tried to fill the inventory with logs and oak logs to check if it dropped them correctly, wich it did. Here is the code: public class Main extends AbstractScript{ Area treeArea = new Area(3158, 3418, 3172, 3399); Area oakArea = new Area(3271, 3438, 3287, 3411); Area willowArea = new Area(2970, 3192, 2972, 3190); public void onStart(){ log("Starting script"); } private enum State { TREE, OAK, WILLOW, DROP, WAIT } private State getState(){ if (getInventory().isFull()) return State.DROP; if (getSkills().getRealLevel(Skill.WOODCUTTING) < 15) return State.TREE; if (getSkills().getRealLevel(Skill.WOODCUTTING) < 30) return State.OAK; if (getSkills().getRealLevel(Skill.WOODCUTTING) < 60) return State.WILLOW; return State.WAIT; } @Override public int onLoop() { switch (getState()){ case WAIT: if (getLocalPlayer().isAnimating()){ int random = Calculations.random(1, 5); if (random == 1){ if (getMouse().isMouseInScreen()){ getMouse().moveMouseOutsideScreen(); } } } break; case DROP: log("Dropping all logs"); if (getInventory().isFull()){ getInventory().dropAll("Logs", "Oak logs", "Willow logs"); } sleep(100, 500); break; case TREE: if (!treeArea.contains(getLocalPlayer())){ getWalking().walk(treeArea.getCenter().getRandomizedTile()); }else { if (!getLocalPlayer().isAnimating()){ GameObject tree = getGameObjects().closest("Tree"); if (tree != null){ tree.interact("Chop down"); } } } break; case OAK: if (!oakArea.contains(getLocalPlayer())){ getWalking().walk(oakArea.getCenter().getRandomizedTile()); }else { if (!getLocalPlayer().isAnimating()){ GameObject oak = getGameObjects().closest("Oak tree"); if (oak != null){ oak.interact("Chop down"); } } } break; case WILLOW: if (!willowArea.contains(getLocalPlayer())){ getWalking().walk(willowArea.getCenter().getRandomizedTile()); }else { if (!getLocalPlayer().isAnimating()){ GameObject willow = getGameObjects().closest("Willow tree"); if (willow != null){ willow.interact("Chop down"); } } } break; } return 1000; } } Link to comment Share on other sites More sharing options...
LogicSoup 92 Share Posted December 17, 2017 Are you sure they are called 'x tree' and not 'x' Link to comment Share on other sites More sharing options...
Pengu 23 Author Share Posted December 17, 2017 Are you sure they are called 'x tree' and not 'x' I feel stupid now, thanks:) Link to comment Share on other sites More sharing options...
LogicSoup 92 Share Posted December 18, 2017 I feel stupid now, thanks:) No problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.