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);
}
}