Jump 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.

Walking to Entity

Featured Replies

I am trying to walk to an entity if it is not visible. My scripts cuts the trees but then just stands there and does nothing... This is my code so far:

Entity tree = sI.objects.closest("Tree");

        if (!sI.inventory.isFull() && tree != null) {
            if (tree.isVisible()) {
                if (!sI.myPlayer().isMoving() && !sI.myPlayer().isAnimating()) {
                    tree.interact("Chop down");
                    sleep(random(400, 800));
                } else if (tree != null && !tree.isVisible()){
                    // Walk to tree
                    sleep(random(400, 1000));
                }
            }
        }
    }


if (tree != null) {

if (tree.isVisible()) {

if (!myPlayer().isAnimating() && !myPlayer().isMoving()) {

if (tree.interact("Chop down")) {

return 1000;

}

}

} else {

if (myPlayer().getPosition().distance(tree) <= 9) {

getCamera().toEntity(tree);

} else {

getWalking().walk(tree);

}

}

}

Edited by iJodix

  • Author
		if (tree != null) {
			if (tree.isVisible()) {
				if (!myPlayer().isAnimating() && !myPlayer().isMoving()) {
					if (tree.interact("Chop down")) {
						return 1000;
					}
				}
			} else {
				if (myPlayer().getPosition().distance(tree) <= 9) {
					getCamera().toEntity(tree);
				} else {
					getWalking().walk(tree);
				}
			}
		}

 

 

I changed it to this, but when I start the script it still stands there - if I pause the script and move myself it starts chopping but then it just stands still again. Is this correct?

Entity tree = sI.objects.closest("Tree");

 

I changed it to this, but when I start the script it still stands there - if I pause the script and move myself it starts chopping but then it just stands still again. Is this correct?

Entity tree = sI.objects.closest("Tree");

Just do;

RS2Object tree = getObjects().closest("Tree");
  • Author

I got it working now, it was something to do with my Tree Area. Thanks for your help.

 

I changed it to this, but when I start the script it still stands there - if I pause the script and move myself it starts chopping but then it just stands still again. Is this correct?

Entity tree = sI.objects.closest("Tree");

 

 

 

Just do;

RS2Object tree = getObjects().closest("Tree");

http://osbot.org/forum/topic/93981-guidetypes-of-entities-and-how-to-use-them-correctly/ this might help too, its a guide about entity types :P

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.