Jump to content

Hover and burn method!


q600

Recommended Posts

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

 

Link to comment
Share on other sites

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 by Explv
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...