- Thread Author
- #1
Anyone have one?
I have old code from one before maybe someone can work off of it
-------------------------------------------------------------------------------------------------
I have old code from one before maybe someone can work off of it
-------------------------------------------------------------------------------------------------
- public void onStart() {
- if(!getInventory().contains(1735)){
- log("SCRIPT STOPPED: YOU NEED SHEARS IN INVENTORY!!");
- stop();
- }
- // new Tile(3212, 3258, 0),new Tile(3193, 3276, 0)
- sheepArea = new Area(new Tile(3194, 3258, 0), new Tile(3212, 3274, 0));
- state = State.SHEARING;
- inventorySize = getInventory().count(1737);
- startTime = System.currentTimeMillis();
- }
- public enum State {
- SHEARING, WALKTOBANK, WALKTOSHEEP, WAITING, BANK, OPENGATE;
- }
- public void onExit() {
- log("Goodbye scrub shearers");
- }
- @Override
- public int onLoop() {
- int timeout = 0;
- switch (state) {
- case SHEARING:
- NPC sheep = getNpcs().closest(2794, 2801, 2800, 2795, 2796, 2802);
- // System.out.println((sheepArea.contains(sheepPos)));
- inventorySize = getInventory().count(1737);
- if (sheepArea.contains(sheep)) {
- sheep.interact("Shear");
- } else {
- List<NPC> sheeps = new ArrayList<NPC>();
- sheeps.addAll(getNpcs().all(2794, 2801, 2800, 2795, 2796, 2802));
- boolean found = false;
- for (NPC n : sheeps) {
- if (sheepArea.contains
&& !found) {
- n.interact("Shear");
- found = true;
- }
- }
- }
- state = State.WAITING;
- break;
- case WAITING:
- int newInv = getInventory().count(1737);
- if (getInventory().isFull()) {
- state = State.WALKTOBANK;
- } else if (newInv > inventorySize) {
- state = State.SHEARING;
- } else if (!getLocalPlayer().isMoving()) {
- sleep(Calculations.random(300, 400));
- if (!getLocalPlayer().isMoving())
- state = State.SHEARING;
- }
- break;
- case WALKTOBANK:
- getWalking().walk(new Tile(3209, 3261, 0));
- do {
- sleep(Calculations.random(400, 600));
- } while (getWalking().getDestinationDistance() > 2);
- GameObject[] gateZone = getGameObjects().getObjectsOnTile(
- new Tile(3213, 3262));
- GameObject gate = null;
- for (GameObject g : gateZone) {
- if (g.getID() == 12987 || g.getID() == 12986)
- gate = g;
- }
- if (gate != null)
- gate.interact("Open");
- do {
- timeout++;
- if (timeout > 4) {
- gate.interact("Open");
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getGameObjects().closest(12989, 12988) == null);
- getWalking().walk(new Tile(3216, 3261, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3216, 3261, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3216, 3254, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3216, 3254, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3219, 3246, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3219, 3246, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3224, 3237, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3224, 3237, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3231, 3231, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3231, 3231, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3231, 3231, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3231, 3231, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3224, 3218, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3224, 3218, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3217, 3218, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3217, 3218, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getLocalPlayer().isMoving());
- getWalking().walk(new Tile(3215, 3210, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3215, 3210, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getLocalPlayer().isMoving());
- getWalking().walk(new Tile(3207, 3209, 0));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3210, 3211, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getLocalPlayer().isMoving());
- GameObject stairs = getGameObjects().closest(16671);
- stairs.interact("Climb-up");
- do {
- timeout++;
- if (timeout > 4) {
- stairs.interact("Climb-up");
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getGameObjects().closest(16672) == null);
- sleep(Calculations.random(500, 600));
- stairs = getGameObjects().closest(16672);
- stairs.interact("Climb-up");
- do {
- timeout++;
- if (timeout > 4) {
- stairs.interact("Climb-up");
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getGameObjects().closest(16673) == null);
- getWalking().walk(new Tile(3208, 3219, 2));
- sleep(Calculations.random(500, 600));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3208, 3219, 2));
- timeout = 0;
- }
- } while (getWalking().getDestinationDistance() > 2);
- sleep(Calculations.random(500, 600));
- state = State.BANK;
- break;
- case BANK:
- woolAmount = woolAmount + getInventory().count(1737);
- log("Wool gathered: \t" + woolAmount);
- long profit = woolAmount * woolPrice;
- log("Proft: \t" + profit);
- long currentTime = System.currentTimeMillis();
- long timeTaken = currentTime - startTime;
- timeTaken = (timeTaken / (1000 * 60)) % 60;
- log("Time taken: \t" + timeTaken + " minutes");
- getBank().open();
- sleep(Calculations.random(800, 1000));
- do {
- sleep(Calculations.random(800, 1000));
- getBank().open();
- } while (!getBank().isOpen());
- getBank().depositAll(1737);
- do {
- sleep(Calculations.random(800, 1000));
- getBank().depositAll(1737);
- } while (getInventory().contains(1737));
- sleep(Calculations.random(500, 600));
- getBank().close();
- state = State.WALKTOSHEEP;
- break;
- case WALKTOSHEEP:
- GameObject[] stairsZone = getGameObjects().getObjectsOnTile(
- new Tile(3205, 3208, 2));
- GameObject stairs2 = null;
- for (GameObject g : stairsZone) {
- if (g != null)
- if (g.getID() == 16673)
- stairs2 = g;
- }
- if (stairs2 != null)
- stairs2.interact("Climb-down");
- timeout = 0;
- do {
- timeout++;
- if (timeout > 4) {
- stairs2.interact("Climb-down");
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getGameObjects().closest(16672) == null);
- stairs2 = getGameObjects().closest(16672);
- stairs2.interact("Climb-down");
- do {
- timeout++;
- if (timeout > 4) {
- stairs2.interact("Climb-down");
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getGameObjects().closest(16671) == null);
- getWalking().walk(new Tile(3207, 3209, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3207, 3209, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3215, 3210, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3215, 3210, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3217, 3218, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3217, 3218, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3224, 3218, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3224, 3218, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3233, 3222, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3233, 3222, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3231, 3231, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3231, 3231, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3224, 3237, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3224, 3237, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3219, 3246, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3219, 3246, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3216, 3254, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3216, 3254, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- getWalking().walk(new Tile(3215, 3260, 0));
- do {
- timeout++;
- if (timeout > 4) {
- getWalking().walk(new Tile(3215, 3260, 0));
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getWalking().getDestinationDistance() > 2);
- GameObject[] gateZone2 = getGameObjects().getObjectsOnTile(
- new Tile(3213, 3262));
- GameObject gate2 = null;
- for (GameObject g : gateZone2) {
- if (g.getID() == 12987)
- gate2 = g;
- }
- if (gate2 != null)
- gate2.interact("Open");
- do {
- timeout++;
- if (timeout > 4) {
- if (gate2 != null)
- gate2.interact("Open");
- timeout = 0;
- }
- sleep(Calculations.random(500, 600));
- } while (getGameObjects().closest(12989) == null);
- getWalking().walk(new Tile(3208, 3261, 0));
- do {
- } while (getWalking().getDestinationDistance() > 2);
- state = State.SHEARING;
- break;
- default:
- break;
- }
- return Calculations.random(500, 600);
- }
- public void deadFunc() {
- GameObject stairs = getGameObjects().closest(16671);
- stairs.interact("Climb-up");
- sleep(Calculations.random(300, 400));
- stairs = getGameObjects().closest(16672);
- stairs.interact("Climb-up");
- sleep(Calculations.random(300, 400));
- getWalking().walk(new Tile(3208, 3219, 0));
- }
- }