January 23, 20197 yr Trying to create a basic script to, chop, and the burn the whole inventory of logs. when I use this code, the script wont even start, but if I remove the burnLogs method, it runs fine? also cannot for the life of me figure out how to how the next tree, not asking to be spoonfed, but if someone wants to hop on discord and help me out that would be great! void cutTree() { if(!getInventory().isFull()) { if(!myPlayer().isAnimating() && tree != null) { tree.interact("Chop Down"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } } void burnLogs() { if (!"Tinderbox".equals(getInventory().getSelectedItemName())) { if (getInventory().isItemSelected()) { getInventory().deselectItem(); } else { getInventory().interact("Use", "Tinderbox"); } } else if (getInventory().getItem("logs").interact()) { new ConditionalSleep(2000) { @Override public boolean condition() throws InterruptedException { return !myPlayer().isAnimating(); } }.sleep(); } }
January 23, 20197 yr 11 minutes ago, q600 said: Trying to create a basic script to, chop, and the burn the whole inventory of logs. when I use this code, the script wont even start, but if I remove the burnLogs method, it runs fine? also cannot for the life of me figure out how to how the next tree, not asking to be spoonfed, but if someone wants to hop on discord and help me out that would be great! } else if (getInventory().getItem("logs").interact()) { Isn't it "Logs" not "logs"? That will throw a NullPointerException if the name is incorrect. To hover the next tree you will need to store the current tree you are chopping. Then find the closest tree that is != the tree you're currently chopping, and call hover() on it. Edited January 23, 20197 yr by Explv
January 23, 20197 yr Author 35 minutes ago, Explv said: Isn't it "Logs" not "logs"? That will throw a NullPointerException if the name is incorrect. To hover the next tree you will need to store the current tree you are chopping. Then find the closest tree that is != the tree you're currently chopping, and call hover() on it. Yes, good catch there, and what I mean is that the script wont even start, I don't even get a chance to pause or stop it
January 23, 20197 yr Where is `tree` defined? Make sure to move the grabbing of objects, NPCs and whatnot into a method rather than in the body of the class as that will cause your script not to start.
Create an account or sign in to comment