I'm making a woodcutting script but I have ran into an issue, when I get a full inventory of logs my character will walk to the back but will not deposit the logs but instead run back to the trees and try to cut them down. This making my character run back and forth. Script is below, I don't know what to add to fix this. If you guys have any other recommendations to add to the script or tips let me know, Thanks.
@Override
public void onStart() throws InterruptedException {
super.onStart();
int wcLvl = getSkills().getStatic(Skill.WOODCUTTING);
if (getInventory().isEmptyExcept("Bronze axe", "Iron axe", "Steel Axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe",
"Dragon axe")) ;
}
@Override
public int onLoop() throws InterruptedException {
Player player = myPlayer();
RS2Object Tree = getObjects().closest(new Filter<RS2Object>() {
@Override
public boolean match(RS2Object rs2Object) {
return rs2Object != null && rs2Object.getName().equals("Tree") && rs2Object.exists() && getMap().canReach(rs2Object);
}
});
if (Banks.VARROCK_WEST.contains(myPosition()) && bankbooth != null && !getBank().isOpen()) {
getBank().withdraw("Steel axe",1);
}
if (Tree != null)
if (Tree.isVisible()) {
getWalking().walk(Tree.getPosition());
getCamera().toEntity(Tree);
if (Tree.getPosition().distance(myPosition()) > 6) ;
if (!myPlayer().isAnimating())
if (Tree.interact("Chop down")) ;
getMouse().moveOutsideScreen();
sleep(random(301, 2999));
} else {
RS2Object bankBooth = getObjects().closest("Bank booth");
if (getInventory().isFull()) getWalking().webWalk(BANK_AREA);
log("Inventory full walking to bank");
if (Banks.VARROCK_WEST.contains(myPosition()) && bankbooth != null && !getBank().isOpen()) {
getBank().depositAllExcept("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Dragon axe");
log("interacting with bank");
bankBooth.interact("Bank");
} else if (getBank().isOpen()) {
int wcLvl = getSkills().getStatic(Skill.WOODCUTTING);
log("Depositing Logs");
getBank().depositAllExcept("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Dragon axe");
if (wcLvl >= 6 && getInventory().contains("Bronze axe", "Iron axe") && getBank().contains("Steel axe")) {
log("withdrawing shitty axe");
getBank().deposit("Bronze axe", 1);
getBank().withdraw("Steel axe", 1);
}
}
}return 0;}}