Jump to content

[HELP] Basic woodcutting script


Vogelbekdier

Recommended Posts

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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