Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Intel Yew Chopper [Draynor Village]

Featured Replies

Noticed that Yew Scripts were lacking in this section,

taking advice, thanks!

 

Start:

 

-In draynor bank or Yew Trees west of Lumbridge Castle

-Rune axe in inventory

 

Source:

import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.Area;

import java.awt.*;
import java.util.Random;
import java.util.concurrent.TimeUnit;


@ScriptManifest(name="Intelligent Yew Chopper",
                author="Acinate",
                info="Chops Yews West of Lumbridge Castle",
                version=1.2,
                logo="WoodCutting")

public class VarrockYewChopper extends Script {

    private Random random;
    private int i = 1;
    private int cameraPitch = ((i + 1) );

    private long timeOut;
    private long timeBegan;
    private long timeRan;
    private long startTime;

    private String ft(long duration)
    {
        String res = "";
        long days = TimeUnit.MILLISECONDS.toDays(duration);
        long hours = TimeUnit.MILLISECONDS.toHours(duration)
                - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
        long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
                - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
        long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
                - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
        if(days == 0) {
            res = (hours + ":" + minutes + ":" + seconds);
        } else {
            res = (days + ":" + hours + ":" + minutes + ":" + seconds);
        }
        return res;
    }

    private Position[] bankPath = {
            new Position(3148,3232,0), new Position(3142,3229,0), new Position(3133,3227,0),
            new Position(3124,3222,0), new Position(3120,3215,0), new Position(3115,3220,0),
            new Position(3109,3224,0), new Position(3102,3230,0), new Position(3099,3238,9),
            new Position(3092,3243,0)
    };

    private Position[] treePath = {
            new Position(3100,3238,0), new Position(3098,3231,0), new Position(3104,3226,0),
            new Position(3113,3221,0), new Position(3120,3215,0), new Position(3125,3223,0),
            new Position(3134,3227,0), new Position(3143,3229,0), new Position(3149,3231,0)
    };

    public Area YEW_AREA = new Area(3172,3215,3148,3236);
    public Area BANK_AREA = new Area(3091,3239,3098,3247);

    public Area YEW1_AREA = new Area(3149,3234,3155,3228);
    public Area YEW2_AREA = new Area(3163,3223,3171,3215);

    public long getElapsed(long startTime){
        return System.currentTimeMillis() - startTime;
    }

    public void onStart() {
        log("Script has Started");
        random = new Random();

        timeBegan = System.currentTimeMillis();
        timeRan = System.currentTimeMillis() - this.timeBegan;
    }
    public enum State {IN_DIALOG, CHOP, LOST, WALK_BANK, BANK, WALK_TREES, IDLE,}

    public State getState() {
        if(getDialogues().isPendingContinuation())
            return State.IN_DIALOG;
        if(YEW_AREA.contains(myPlayer())&& !getInventory().isFull())
            return State.CHOP;
        if(!BANK_AREA.contains(myPlayer()) && getInventory().isFull())
            return State.WALK_BANK;
        if(BANK_AREA.contains(myPlayer()) && !getInventory().isEmptyExcept("Rune axe"))
            return State.BANK;
        if(!YEW_AREA.contains(myPlayer()) && getInventory().isEmptyExcept("Rune axe"))
            return State.WALK_TREES;
        return State.IDLE;
    }

    public int onLoop() throws InterruptedException {
        switch (getState()) {


            case IN_DIALOG:
                if (getDialogues().isPendingContinuation()) {
                    getDialogues().clickContinue();
                }
            case CHOP:
                if(!myPlayer().isAnimating()) {
                    Entity Yew = getObjects().closest(YEW_AREA, "Yew");

                    if (Yew != null) {
                        log("Chop");
                        Yew.interact("Chop down");
                        sleep(random.nextInt(1000) + 1500);
                        if (myPlayer().isMoving()) {
                            fixCam();
                            Yew.hover();
                        }
                    }
                }
                if (myPlayer().isAnimating()) {
                    log("CHOPPING:");
                    int rSleep = random.nextInt(2) + 2;
                    log(rSleep);
                    sleep(random.nextInt(1000) + 1500);
                    if (YEW1_AREA.contains(myPlayer())) {
                        getCamera().moveYaw(0);
                        getCamera().movePitch(60);
                    }
                    if (YEW2_AREA.contains(myPlayer())) {
                        getCamera().moveYaw(190);
                        getCamera().movePitch(45);
                    }
                    if (rSleep != 1) {
                        getMouse().moveOutsideScreen();
                        log(rSleep);
                        if (rSleep == 2) {
                            log("ZZzz. .");
                            sleep(random.nextInt(10000) + 1000);
                            checkXP();
                        } else {
                            log("ZZzz. .");
                            sleep(random.nextInt(20000) + 1000);
                            checkXP();
                        }
                    }
                }

                break;

            case WALK_BANK:

                if(YEW_AREA.contains(myPlayer())) {
                    getLocalWalker().walk(YEW1_AREA,true);
                    sleep(random.nextInt(500) + 600);
                    if(YEW1_AREA.contains(myPlayer())) {
                        getLocalWalker().walkPath(bankPath);
                    }
                }

                if(!YEW_AREA.contains(myPlayer())) {
                    if (!myPlayer().isMoving() && !myPlayer().isAnimating()) {
                        if (getElapsed(startTime) >= 30000) {
                            getLocalWalker().walk(BANK_AREA, true);
                            log("MIA");
                            startTime = System.currentTimeMillis();
                        }
                    }
                }
                break;
            case BANK:
                Entity bankBooth = getObjects().closest(BANK_AREA,"Bank Booth");
                if(getBank().isOpen()) {
                    bank.depositAllExcept("Rune axe");
                    sleep(random.nextInt(100) + 250);
                } else {
                    bankBooth.interact("Bank");
                }
                break;
            case WALK_TREES:

                if(BANK_AREA.contains(myPlayer())) {
                getLocalWalker().walkPath(treePath);
                }
                if(!YEW_AREA.contains(myPlayer())) {
                    if (!myPlayer().isMoving() && !myPlayer().isAnimating()) {
                        if (getElapsed(startTime) >= 30000) {
                            getLocalWalker().walk(YEW1_AREA, true);
                            log("MIA");
                            startTime = System.currentTimeMillis();
                        }
                    }
                }
                break;
        }
        return(750);
    }

    private void checkXP() throws InterruptedException {
       int check = random(1, 5);
       if(check == 5) {
           skills.hoverSkill(Skill.WOODCUTTING);
           log("Checkin' XP");
           sleep(random.nextInt(1000) + 250);
           getTabs().open(Tab.INVENTORY);
           sleep(random.nextInt(5000) + 5000);
       }
    }



    private void fixCam() {
        log("fixCam()");
        Entity yewTree = getObjects().closest(YEW_AREA,"Yew");
        if(!myPlayer().isAnimating() && myPlayer().isMoving()) {
            getCamera().toEntity(yewTree);
        }
    }

    public void onPaint(Graphics2D g) {
        Graphics2D gr = g;
        timeRan = System.currentTimeMillis() - this.timeBegan;
        g.drawString(ft(timeRan),500, 350);

    }



    public void onExit() {
    log("Script has Ended");
    }
}

 

v1.5  BETA [Currently: Stable]

import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.Area;

import java.awt.*;
import java.util.Random;
import java.util.concurrent.TimeUnit;


@ScriptManifest(name="INT YewChopper",
        author="Acinate",
        info="YEW CHOPPER",
        version=1.4,
        logo="")

public class DraynorChopper extends Script {

    private Random random;

    private long startTime;
    private long timeOut;
    private long timeBegan;
    private long timeRan;

    private String ft(long duration)
    {
        String res = "";
        long days = TimeUnit.MILLISECONDS.toDays(duration);
        long hours = TimeUnit.MILLISECONDS.toHours(duration)
                - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
        long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
                - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
        long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
                - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
        if(days == 0) {
            res = (hours + ":" + minutes + ":" + seconds);
        } else {
            res = (days + ":" + hours + ":" + minutes + ":" + seconds);
        }
        return res;
    }

    private Position[] bankPath = {
            new Position(3148,3232,0), new Position(3142,3229,0), new Position(3133,3227,0),
            new Position(3124,3222,0), new Position(3120,3215,0), new Position(3115,3220,0),
            new Position(3109,3224,0), new Position(3102,3230,0), new Position(3099,3238,9),
            new Position(3092,3243,0)
    };

    private Position[] treePath = {
            new Position(3100,3238,0), new Position(3098,3231,0), new Position(3104,3226,0),
            new Position(3113,3221,0), new Position(3120,3215,0), new Position(3125,3223,0),
            new Position(3134,3227,0), new Position(3143,3229,0), new Position(3149,3231,0)
    };

    public Area YEW_AREA = new Area(3140,3261,3192,3213);
    public Area BANK_AREA = new Area(3090,3240,3094,3246);
    public Area NYEW_AREA = new Area(3140,3261,3156,3225);
    public Area EYEW_AREA = new Area(3161,3227,3190,3215);
    public Area WYEW_AREA = new Area(3149,3233,3155,3228);

    public long getElapsed(long startTime){
        return System.currentTimeMillis() - startTime;
    }

    public void onStart() {
        log("Script has Started");
        random = new Random();

        timeBegan = System.currentTimeMillis();
        timeRan = System.currentTimeMillis() - this.timeBegan;
    }
    public enum State {IN_DIALOG, CHOP, WALK_BANK, BANK, WALK_TREES, MOVE2TREE, IDLE,}

    public State getState() {

        if(getDialogues().isPendingContinuation())
            return State.IN_DIALOG;

        if((YEW_AREA .contains(myPlayer())&& !getInventory().isFull()))
            return State.CHOP;
        if(!BANK_AREA.contains(myPlayer()) && getInventory().isFull())
            return State.WALK_BANK;
        if(BANK_AREA.contains(myPlayer()) && !getInventory().isEmptyExcept("Rune axe"))
            return State.BANK;
        if(!YEW_AREA.contains(myPlayer()) && getInventory().isEmptyExcept("Rune axe") && !getBank().isOpen())
            return State.WALK_TREES;
        return State.IDLE;
    }

    public int onLoop() throws InterruptedException {
        switch (getState()) {


            case IN_DIALOG:
                log("IN_DIALOG");
                if (getDialogues().isPendingContinuation()) {
                    getDialogues().clickContinue();
                }
                break;
            case CHOP:
                log("CHOP");
                Entity YewTree = getObjects().closest("Yew");
                Entity EyewTree = getObjects().closest(EYEW_AREA,"Yew");
                Entity NyewTree = getObjects().closest(NYEW_AREA, "Yew");
                Entity WyewTree = getObjects().closest(WYEW_AREA, "Yew");

                while(myPlayer().isAnimating()) {
                    log("CHOPPING:");
                    if(myPlayer().isOnScreen()) {
                        checkXP();
                        mouseOffScreen();
                        sleep(random.nextInt(500) + 700);
                    }
                    return 3000;
                }

                while((!EYEW_AREA.contains(myPlayer())
                    || !WYEW_AREA.contains(myPlayer())
                    || !NYEW_AREA.contains(myPlayer()))
                    && !getInventory().isFull()
                    && !myPlayer().isAnimating()
                    && !myPlayer().isMoving()) {
                    chopTree();
                }
                if(!myPlayer().isAnimating()) {
                    if (NYEW_AREA.contains(YewTree)) {
                        if (!NYEW_AREA.contains(myPlayer()) && !myPlayer().isMoving()) {
                            getLocalWalker().walk(NYEW_AREA, true);
                            sleep(random.nextInt(150) + 200);
                        }
                        if (NYEW_AREA.contains(myPlayer()) && NyewTree != null && !myPlayer().isAnimating()) {
                            chopTree();
                            sleep(random.nextInt(200) * 4);
                        }
                    }

                    if (WYEW_AREA.contains(YewTree)) {
                        if (WYEW_AREA.contains(myPlayer()) && WyewTree != null && !myPlayer().isAnimating()) {
                            chopTree();
                            sleep(random.nextInt(200) + 300);
                        }
                        if (!WYEW_AREA.contains(myPlayer()) && !myPlayer().isMoving()) {
                            getLocalWalker().walk(WYEW_AREA, true);
                            sleep(random.nextInt(150) + 200);
                        }
                    }

                    if (EYEW_AREA.contains(YewTree)) {
                        if (EYEW_AREA.contains(myPlayer()) && EyewTree != null && !myPlayer().isAnimating()) {
                            chopTree();
                            sleep(random.nextInt(200) + 300);
                        }
                        if (!EYEW_AREA.contains(myPlayer()) && !myPlayer().isMoving()) {
                            getLocalWalker().walk(EYEW_AREA, true);
                            sleep(random.nextInt(150) + 200);
                        }
                    }
                    return (random.nextInt(350) * 2);
                }
                break;
            case BANK:
                log("BANK:");
                Entity booth = getObjects().closest(BANK_AREA,11744);
                getCamera().toEntity(booth);
                if(getBank().isOpen()) {
                    bank.depositAllExcept("Rune axe");
                    sleep(random.nextInt(100) + 250);
                    bank.close();
                } else {
                    booth.interact("Bank");
                    sleep(random.nextInt(300) + 250);
                }
                break;
            case WALK_BANK:
                log("WALK_BANK");
                if(!WYEW_AREA.contains(myPlayer()) && !myPlayer().isMoving()) {
                        getLocalWalker().walk(WYEW_AREA,true);
                }

                if(WYEW_AREA.contains(myPlayer())) {
                    getLocalWalker().walkPath(bankPath);
                } else {
                    getLocalWalker().waitUntilIdle();
                }
                break;

            case WALK_TREES:
                if(BANK_AREA.contains(myPlayer())) {
                    getLocalWalker().walkPath(treePath);
                }
                if(!YEW_AREA.contains(myPlayer())) {
                    if (!myPlayer().isMoving() && !myPlayer().isAnimating()) {
                        if (getElapsed(startTime) >= 30000) {
                            getLocalWalker().walk(WYEW_AREA, true);
                            log("MIA");
                            startTime = System.currentTimeMillis();
                        }
                    }
                }
                break;
        }
        return(750);
    }

    private void chopTree() {
        log("chopTree()");
        Entity yewTree = getObjects().closest(YEW_AREA, "Yew");
        if(yewTree != null) {
            getCamera().toEntity(yewTree);
            yewTree.hover();
            if(!myPlayer().isMoving()) {
                yewTree.interact("Chop down");
            }
        }
    }

    private void mouseOffScreen() throws InterruptedException {
        int check = random(1,9);
        log(check);
        if(check == 6) {
            log("Zzz..");
            getMouse().moveSlightly();
            sleep(random.nextInt(50) + 100);
            getMouse().moveOutsideScreen();
            sleep(random.nextInt(7500) * 3);
            getCamera().movePitch(10);
            getCamera().moveYaw(120);
        }

        if(check == 3) {
            int pitch = getCamera().getPitchAngle();
            int yaw = getCamera().getYawAngle();

            log("Choppin' O Choppin' Away!");
            getCamera().movePitch(pitch - 20);
            sleep(random.nextInt(100) + 300);
            getCamera().movePitch(pitch + 20);
            sleep(random.nextInt(100) + 300);
            getCamera().moveYaw(yaw + 120);
            sleep(random.nextInt(300) + 250);
            getCamera().moveYaw(yaw - 120);
            getMouse().moveOutsideScreen();
        }
    }

    private void checkXP() throws InterruptedException {
        int check = random(1, 10);
        if(check == 5) {
            skills.hoverSkill(Skill.WOODCUTTING);
            log("Checkin' XP");
            sleep(random.nextInt(1000) + 250);
            getTabs().open(Tab.INVENTORY);
        }
    }




    public void onPaint(Graphics2D g) {
        Graphics2D gr = g;
        timeRan = System.currentTimeMillis() - this.timeBegan;
        g.drawString(ft(timeRan),470, 360);

    }


    public void onExit() {
        log("Script has Ended");
    }
}

v.1.1

-Fixed running from tree to tree

-Banking is fluid

-Rest times between actions

-Checks xp / amount of log

 

v.1.2

-Tree Chop detection complete revamp

-Failsafe added

 

 

v.1.3

-Megachange to Failsafe method

 

 

v1.5 [Tree Detection Method]

if ((!EYEW_AREA.contains(myPlayer())
|| !WYEW_AREA.contains(myPlayer())
|| !NYEW_AREA.contains(myPlayer()))
&& !getInventory().isFull()
&& !myPlayer().isAnimating()
&& !myPlayer().isMoving())
return State.MOVE2TREE;
if ((EYEW_AREA.contains(myPlayer())
|| WYEW_AREA.contains(myPlayer())
|| NYEW_AREA.contains(myPlayer()))
&& !getInventory().isFull())
return State.CHOP;

TO ADD:

1.0 

- ADD YEW3 & YEW4 [X] 
- Improve Paint [ ]

2.0 

- ADD FALADOR SUPPORT

3.0

- ADD RIMMINGTON SUPPORT

4.0 (PREMIUM)

- ADD CATHERYBY SUPPORT

2 Hour non-stop proggy:

(Sorry for the basic paint, mostly use log() to extract details)

2HourProg_zpshwzw5dzs.png

 

Edited by Acinate

if(!getCamera().equals(yewTree)) {
     getCamera().toEntity(yewTree);
}

getCamera() Obtains the Camera instance it will never ever return an Entity.

If you'd like to know whether or not your object is visible call object.isVisible()

private int cameraPitch = (0 - 50);

...

if(getCamera().getPitchAngle() != cameraPitch) {
getCamera().movePitch(random.nextInt(20) + 5);
}else if(getCamera().getYawAngle() != cameraPitch) {
getCamera().moveYaw(random.nextInt(25 + 10));
}

What's the purpose of this?

if(YEW_AREA.contains(myPlayer()) && !myPlayer().isAnimating() && !getInventory().isFull())
return State.CHOP;
if(YEW_AREA.contains(myPlayer()) && myPlayer().isAnimating() && !getInventory().isFull())
return State.CHOPPING;

Merge these biggrin.png

if(YEW_AREA.contains(myPlayer()) && !getInventory().isFull()) return myPlayer().isAnimating() ? State.CHOPPING : State.CHOP;

http://en.wikipedia.org/wiki/%3F:

 

There are a few other things I'd do differently, but good job :)

 

PS: once you are happy with it you should consider making this premium wink.png

 

 

 

Edited by Botre

if(!getCamera().equals(yewTree)) {
     getCamera().toEntity(yewTree);
}

getCamera() Obtains the Camera instance it will never ever return an Entity.

If you'd like to know whether or not your object is visible call object.isVisible()

private int cameraPitch = (0 - 50);

...

if(getCamera().getPitchAngle() != cameraPitch) {
getCamera().movePitch(random.nextInt(20) + 5);
}else if(getCamera().getYawAngle() != cameraPitch) {
getCamera().moveYaw(random.nextInt(25 + 10));
}

What's the purpose of this?

if(YEW_AREA.contains(myPlayer()) && !myPlayer().isAnimating() && !getInventory().isFull())
return State.CHOP;
if(YEW_AREA.contains(myPlayer()) && myPlayer().isAnimating() && !getInventory().isFull())
return State.CHOPPING;

Merge these biggrin.png

if(YEW_AREA.contains(myPlayer()) && !getInventory().isFull()) return myPlayer().isAnimating() ? State.CHOPPING : State.CHOP;

http://en.wikipedia.org/wiki/%3F:

 

There are a few other things I'd do differently, but good job smile.png

 

PS: once you are happy with it you should consider making this premium wink.png

 

You need to release a free script before you can make something premium :/. Unless you mean later on if he gets a free script out.

  • Author
if(!getCamera().equals(yewTree)) {
     getCamera().toEntity(yewTree);
}

getCamera() Obtains the Camera instance it will never ever return an Entity.

If you'd like to know whether or not your object is visible call object.isVisible()

private int cameraPitch = (0 - 50);

...

if(getCamera().getPitchAngle() != cameraPitch) {
getCamera().movePitch(random.nextInt(20) + 5);
}else if(getCamera().getYawAngle() != cameraPitch) {
getCamera().moveYaw(random.nextInt(25 + 10));
}

What's the purpose of this?

 

private int cameraPitch = (0 - 50);

...

if(getCamera().getPitchAngle() != cameraPitch) {
getCamera().movePitch(random.nextInt(20) + 5);
}else if(getCamera().getYawAngle() != cameraPitch) {
getCamera().moveYaw(random.nextInt(25 + 10));
}

Trying to set cameraPitch as a range from 0 - 50, anything outside that is =!

(i realize that == -50, need to fix)

 

TY for feedback, working on fixes asap, then work on paint once script is fluid.

Edited by Acinate

Do I need a top secret clearance to buy this?

 

 

  • 1 month later...

Hey, could i test your script? It sounds rly nice and i'd like to dl it :)

The method to parse runtime to a string can be much easier:

If you want days added, you'll have to rewrite it a bit ^^


public static String formatTime(long ms) {
   long sec = ms / 1000L;
   return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(sec / 3600L), Long.valueOf((sec % 3600L) / 60L), Long.valueOf(sec % 60L) });
}

Why is this code in Onstart?

Don't think you need that ^^

timeRan = System.currentTimeMillis() - this.timeBegan;

Try to use more random things instead just 1 number.

if (YEW1_AREA.contains(myPlayer())) {
   getCamera().moveYaw(0);
   getCamera().movePitch(60);
}

if (YEW2_AREA.contains(myPlayer())) {
   getCamera().moveYaw(190);
   getCamera().movePitch(45);
}

Looks good for the other things, Botre posted some other information ^^

 

Khaleesi

Edited by Khaleesi

  • 4 weeks later...
  • 3 months later...

Ummmm why doesn't this script seem to add for me? I'm really interested in it !!!

  • 3 months later...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.