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.

How to handle trees that grab you?

Featured Replies

I kind of assumed it would be handled in the webwalking since it's so fancy. However, if you walk by draynor, and it runs into one of the tree npcs, it will literally just kill you in that spot over and over. Anyone have a workaround?

Bring an axe and chop 'em down

I have made something for the exact same problem,

 

Because setBreakCondition isn't triggered often enough, I have a seperate thread that does the following:

 

Find all trees near me within 1 tile away,

If tree found, interrupt() the main thread

 

The interrupt interrupts the web walker, so my code falls back into the main onLoop()

 

There I have some logic that checks for the trees again, if one is found it walks around it or else continues webWalking smile.png

Edited by Abuse

  • Author

I have made something for the exact same problem,

 

Because setBreakCondition isn't triggered often enough, I have a seperate thread that does the following:

 

Find all trees near me within 1 tile away,

If tree found, interrupt() the main thread

 

The interrupt interrupts the web walker, so my code falls back into the main onLoop()

 

There I have some logic that checks for the trees again, if one is found it walks around it or else continues webWalking smile.png

Thank you yes that is a workaround however seems really haxxy :D

Thank you yes that is a workaround however seems really haxxy biggrin.png

 

There is no better responsive way atm.

  • Author

There is no better responsive way atm.

This isn't the only npc that halts your movement. Like the guy in the chair in falador castle, and others. It would be nice to see the web walking realize that it is not actually walking, and then evaluate()

The thread polling solution is rather cumbersome for such a simple task.

Edited by dmm_slaver

  • Author

Solution:

 

    Thread shitTree = new Thread() {

        {
            setDaemon(true);
            setPriority(Thread.MIN_PRIORITY);
            setName("Shit tree handler 0");
        }

        @[member=Override]
        public void run() {
            do {
                Player i = myPlayer();
                if (i != null) {
                    if (i.isHitBarVisible()) {
                        interrupt = true;
                        NPC tree = npcs.closest(4418);
                        if (tree != null) {
                            log("under attack tree");
                            if (tree.getY() > myPlayer().getY() && am.dist(tree, myPlayer()) < 2) {
                                Position p = myPosition().translate(am.gauss(3), 0);
                                p.interact(bot, "Walk here");
                                am.delay(am.gaussp(1200, 600));
                                continue;
                            }
                        }

                    } else {
                        interrupt = false;
                    }
                }
                am.delay(50);

            } while (running);
        }
    };

 

Solution:

 

    Thread shitTree = new Thread() {

        {
            setDaemon(true);
            setPriority(Thread.MIN_PRIORITY);
            setName("Shit tree handler 0");
        }

        @[member='Override']
        public void run() {
            do {
                Player i = myPlayer();
                if (i != null) {
                    if (i.isHitBarVisible()) {
                        interrupt = true;
                        NPC tree = npcs.closest(4418);
                        if (tree != null) {
                            log("under attack tree");
                            if (tree.getY() > myPlayer().getY() && am.dist(tree, myPlayer()) < 2) {
                                Position p = myPosition().translate(am.gauss(3), 0);
                                p.interact(bot, "Walk here");
                                am.delay(am.gaussp(1200, 600));
                                continue;
                            }
                        }

                    } else {
                        interrupt = false;
                    }
                }
                am.delay(50);

            } while (running);
        }
    };

 

It'd be cool if they added support for this so people weren't creating a separate thread just to check for tree npc's

  • Author

It'd be cool if they added support for this so people weren't creating a separate thread just to check for tree npc's

All they need is to be able to set a maximum wait time before running evaluate() 

Also note, my solution only works if you're walking from south to north always. However it would be easy to modify it to work for other directions. 

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.