Hello,
i'm trying to get my script to bank and to go back basically but it doesn't work it goes to the bank and then chops logs until the tree is done and he stands there doing nothing
import java.awt.*;
import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.EquipmentSlot;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;
@ScriptManifest(name = "Woodcutting2", author = "Test", version = 1.0, info = "Woodcutting test", logo = "")
public class Woodcutting extends Script {
Area treearea = new Area(3154, 3421, 3173, 3374);
Position treepath = new Position(3171, 3416, 0);
Position oakpath = new Position(3171, 3416, 0);
@Override
public void onStart() {
log("Woodcutting Script Begins"); //Code here will execute before the loop is started
}
@Override
public int onLoop() throws InterruptedException {
RS2Object tree = getObjects().closest("Tree");
RS2Object oaktree = getObjects().closest("Oak");
if (getInventory().contains("Bronze Axe")) {
getEquipment().equip(EquipmentSlot.HANDS, "Bronze Axe");
}
if (getSkills().getDynamic(Skill.WOODCUTTING) <= 14) {
if (getInventory().isFull()) {
sleep(random(700, 1200));
getInventory().dropAll();
}
if (treearea.contains(myPlayer())) {
if (tree != null && !myPlayer().isAnimating()) {
if (tree.isVisible()) {
tree.interact("Chop down");
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return myPlayer().isAnimating() || !tree.exists();
}
}.sleep();
} else {
getCamera().toEntity(tree);
}
}
} else {
getWalking().walk(treepath);
}
}
if (getSkills().getDynamic(Skill.WOODCUTTING) >= 15) {
if (treearea.contains(myPlayer())) {
if (getInventory().isFull()) {
log("RIGHT NOW IM FULL");
sleep(random(700, 1200));
// getInventory().dropAll();
if (!Banks.VARROCK_WEST.contains(myPlayer())) {
log("WALKING NOW");
getWalking().webWalk(Banks.VARROCK_WEST);
log("I'M AT THE BANK");
} else
if (!getBank().isOpen()) {
log("OPENING THE BANK");
getBank().open();
sleep(random(750, 1250));
getBank().depositAll();
sleep(random(750, 1300));
getBank().close();
}
}
if (getInventory().isEmpty()) {
if (oaktree != null && !myPlayer().isAnimating()) {
if (oaktree.isVisible()) {
oaktree.interact("Chop down");
log("Choppy Choppy");
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return myPlayer().isAnimating() || !oaktree.exists();
}
}.sleep();
} else {
getCamera().toEntity(oaktree);
}
}
}
} else {
getWalking().walk(oakpath);
}
}
return random(350, 500); //The amount of time in milliseconds before the loop starts over
}
@Override
public void onExit() {
log("Woodcutting Script Stops"); //Code here will execute after the script ends
}
@Override
public void onPaint(Graphics2D g) {
//g.setColor(Color.WHITE);
// g.drawString("EXP Gained (HR): " + getExperienceTracker().getGainedXP(Skill.WOODCUTTING) + " (" + getExperienceTracker().getGainedXPPerHour(Skill.WOODCUTTING) + ")", 20, 60);
// g.drawString("Levels Gained: " + getExperienceTracker().getGainedLevels(Skill.WOODCUTTING), 20, 80);
}
}
could you please tell me what i did wrong thank you ! (i just started yesterday)