Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

What do i do wrong?

Featured Replies

  • Author

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 by OSRS Sebastian

 

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

 

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.