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.

PathWalk break

Featured Replies

I'm in the proces of converting all my webWalks to pathWalks but I'm wondering if it is possible to add a break condition. I ask this because I think my onLoop gets stuck at these pathwalks. 

Why are you converting all of your webWalks?

WalkPath only uses the local loaded map to walk and it also can not interact with any objects while walking.

So if you need to walk a long distance that might need to interact with a gate, door or stairs you'd more than likely need to use webWalk.

To set a break condition for a webWalk take a look at https://osbot.org/api/org/osbot/rs07/event/WebWalkEvent.html

To set a break condition for a WalkingEvent take a look at https://osbot.org/api/org/osbot/rs07/event/WalkingEvent.html

  • Author
15 hours ago, d0zza said:

Why are you converting all of your webWalks?

WalkPath only uses the local loaded map to walk and it also can not interact with any objects while walking.

So if you need to walk a long distance that might need to interact with a gate, door or stairs you'd more than likely need to use webWalk.

To set a break condition for a webWalk take a look at https://osbot.org/api/org/osbot/rs07/event/WebWalkEvent.html

To set a break condition for a WalkingEvent take a look at https://osbot.org/api/org/osbot/rs07/event/WalkingEvent.html

Because webWalk is using too much RAM and my paths do not require object interaction. I know breaking conditions are possible for both walkingEvents and webWalking but why not for pathWalking?

6 hours ago, Zummy said:

Because webWalk is using too much RAM and my paths do not require object interaction. I know breaking conditions are possible for both walkingEvents and webWalking but why not for pathWalking?

You could try creating a path:

ArrayList<Position> path

and then use WalkingEvent to traverse to each point.

  • Author
32 minutes ago, dreameo said:

You could try creating a path:

ArrayList<Position> path

and then use WalkingEvent to traverse to each point.

WalkingEvent only accepts a single Position, not a list or array.

12 minutes ago, Zummy said:

WalkingEvent only accepts a single Position, not a list or array.

Look at these examples

public boolean walkToDestination(final Position dest, final BooleanSupplier bc, final boolean walkExact){
        WalkingEvent walkingEvent = new WalkingEvent(dest);
        walkingEvent.setEnergyThreshold(10);
        walkingEvent.setBreakCondition(new Condition() {
            @Override
            public boolean evaluate() {
                return bc.getAsBoolean();
            }
        });
        if (walkExact)
            walkingEvent.setMinDistanceThreshold(0);
        return getScript().execute(walkingEvent).hasFinished();
    }

    public boolean walkToDestination(final Position[] positions, final BooleanSupplier bc, final boolean walkExact){
        WalkingEvent walkingEvent = new WalkingEvent();
        walkingEvent.setPath(new LinkedList<>(Arrays.asList(positions)));
        walkingEvent.setBreakCondition(new Condition() {
            @Override
            public boolean evaluate() {
                return bc.getAsBoolean();
            }
        });
        if (walkExact)
            walkingEvent.setMinDistanceThreshold(0);
        walkingEvent.setMiniMapDistanceThreshold(0);
        walkingEvent.setEnergyThreshold(random(5, 15));
        return getScript().execute(walkingEvent).hasFinished();
    }

    public boolean walkToDestination(LinkedList<Position> path, BooleanSupplier bc, boolean walkExact) {
        WalkingEvent walkingEvent = new WalkingEvent();
        walkingEvent.setPath(path);
        walkingEvent.setBreakCondition(new Condition() {
            @Override
            public boolean evaluate() {
                return bc.getAsBoolean();
            }
        });
        if (walkExact)
            walkingEvent.setMinDistanceThreshold(0);
        walkingEvent.setMiniMapDistanceThreshold(0);
        return getScript().execute(walkingEvent).hasFinished();
    }

 

38 minutes ago, Zummy said:

WalkingEvent only accepts a single Position, not a list or array.

... -.-

You can look at Chris's example or literally do what I said..

For each Position.. use the WalkingEvent until there are no more positions..

  • Author
On 8/31/2018 at 12:01 AM, dreameo said:

... -.-

You can look at Chris's example or literally do what I said..

For each Position.. use the WalkingEvent until there are no more positions..

I'm sorry you're right, I followed a tutorial which looked pretty official on this forum that stated you could only use 1 position for walkingEvents.
I tried using a list of positions regardless but couldn't figure it out so I thought the guy was telling the truth.

On 8/30/2018 at 11:36 PM, Chris said:

Look at these examples

Thanks Chris!

8 hours ago, Zummy said:

I'm sorry you're right, I followed a tutorial which looked pretty official on this forum that stated you could only use 1 position for walkingEvents.
I tried using a list of positions regardless but couldn't figure it out so I thought the guy was telling the truth.

Thanks Chris!

Code:

Spoiler

private boolean walk(){
        WalkingEvent walkingEvent;

        for(Position position : path)
        {
            walkingEvent = new WalkingEvent(position);
            Event event = getBot().getEventExecutor().execute(walkingEvent);

            if(event.hasFailed())
            {
                return false;
            }
            else
            {
                path.remove(position);
            }
        }

        return true;
    }

So I just tried that and it seems to work fine. You just fill in whatever break condition you want. (You need to keep a temporary path so that as you traverse to each node, you delete it and then continue to next -> really depends on how you write your logic to START the walker)

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.