Sebastian Posted November 30, 2015 Author Share Posted November 30, 2015 (edited) Trinity fixed the issue. God bless haha. But the problem now is. I'm cutting yew logs at varrock castle. There are 3 tree's. 2 standing next to each other, and one is a bit away. We tried to let the character walk to another yew tree, if the tree's i'm standing at are null. This is the code we have so far. But everything we tried didn't work. case CHOP: Entity treeToChop = getObjects().closest(tree); if (treeToChop != null){ if (treeToChop.getPosition().distance(myPosition()) <= 5){ //checks distance to your player if (treeToChop.isVisible()){ if (treeToChop.interact("Chop down")){ new ConditionalSleep(2500) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } else { getCamera().toEntity(treeToChop); } } else { log("Walking"); getLocalWalker().walk(treeToChop); //walks if farther than 6 tiles } } else { log("Tree is null"); } Edited November 30, 2015 by OSRS Sebastian Quote Link to comment Share on other sites More sharing options...
Explv Posted December 1, 2015 Share Posted December 1, 2015 Trinity fixed the issue. God bless haha. But the problem now is. I'm cutting yew logs at varrock castle. There are 3 tree's. 2 standing next to each other, and one is a bit away. We tried to let the character walk to another yew tree, if the tree's i'm standing at are null. This is the code we have so far. But everything we tried didn't work. case CHOP: Entity treeToChop = getObjects().closest(tree); if (treeToChop != null){ if (treeToChop.getPosition().distance(myPosition()) <= 5){ //checks distance to your player if (treeToChop.isVisible()){ if (treeToChop.interact("Chop down")){ new ConditionalSleep(2500) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } else { getCamera().toEntity(treeToChop); } } else { log("Walking"); getLocalWalker().walk(treeToChop); //walks if farther than 6 tiles } } else { log("Tree is null"); } I could not tell you what is wrong with your code without seeing the full source / testing it for myself. However this script I have just written, works perfectly well on all three Varrock Yews behind the castle, it automatically walks to the third tree if it is not in click-able distance, so perhaps you are over complicating it: import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "Explv", name = "Wood Chop Chop", version = 1.0, info = "Chops wood", logo = "") public class WoodChopChop extends Script { @Override public int onLoop() throws InterruptedException { if (!myPlayer().isAnimating() && !myPlayer().isMoving()) { if(getInventory().isFull()) getInventory().dropAllExcept(item -> item.getName().contains("axe")); else chop(); } return 0; } private void chop() { RS2Object yew = getObjects().closest("Yew"); if (yew != null) { if (!yew.isVisible()) getCamera().toEntity(yew); yew.interact("Chop down"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } } Quote Link to comment Share on other sites More sharing options...
Joseph Posted December 1, 2015 Share Posted December 1, 2015 FYI I say the the reason it didn't work at first was because of you getState() I saw you were looking for an entity by the name of tree. Wasn't sure if you added yew to that array so it might not have activated the chop state Quote Link to comment Share on other sites More sharing options...