Jump to content

[HELP] Basic woodcutting script


Recommended Posts

Posted (edited)

So I made a simple script that cuts oaks at Draynor, walks to the bank and banks the logs.

I'm trying to have the script chop Oak in my own defined area that only contains one Oak tree, the area I defined to chop Oak in also contains 2 normal tree's.

My goal is to have the script chop Oak but if the Oak is chopped down as a secondary task it will chop down the tree's within the area until the oak respawns.

Currently using the following code that does not work as I'm sure the order is completely wrong:

private void chop() throws InterruptedException {
    RS2Object Oak = getObjects().closest(choppingGround, "Oak");
    RS2Object Tree = getObjects().closest(choppingGround, "Tree");

    if (readyToCut() && Oak != null) {
        sleep(random(150, 3000));
        Oak.interact("Chop Down");
        log("Chopping oak.");
        sleep(random(650, 800));
        getMouse().moveOutsideScreen();
    } else if (readyToCut() && Oak == null && Tree != null) {
        sleep(random(150, 3000));
        Tree.interact("Chop Down");
        log("Chopping tree.");
        sleep(random(600, 800));
        getMouse().moveOutsideScreen();
        new ConditionalSleep(2300) {
            @Override
            public boolean condition() {
                return myPlayer().isAnimating();
            }
        }.sleep();
    } else if (!choppingGround.contains(myPlayer())) {
        log("walking back to tree's.");
        getWalking().webWalk(choppingGround);
    }

}

 

Edited by Vogelbekdier
Posted
6 minutes ago, Vogelbekdier said:

So I made a simple script that cuts willows at Draynor, walks to the bank and banks the logs.

To bank the logs I'm using


if(getInventory().contains("Willow logs") && bank.isOpen()) {
    getBank().depositAll(); }

It opens the bank just fine and everything is working but for some reason, it won't bank the willow logs.

Have you remembered to click refresh before running it?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...