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.

Walk path not applicable argument?

Featured Replies

Hello i want make my bot walk with a position path like this bug.PNG.359cb416782a4d6a5b804d28953a79d9.PNG

I have this error. 

did i need to read through a for loop?

for (int i = 0, i < HILLS_PATH.length() , i++ {

getWalking.walk(HILLS_PATH[ i ]);

}

thx for the help

 

ps: normally i make the position path as a constant with a final

Edited by m3nbersures

  • Author
2 minutes ago, MattGP said:

I think it has to be an array list not an array

any code exemple can help because aray list is a new element but i want new position do you mean : new ArrayList(new Position(0,0,0))) ?

Bruh you should look into some java tutorials.

Then you would know that walkPath accepts a list of positions and not an array.

 

  • Author
5 minutes ago, dreameo said:

Bruh you should look into some java tutorials.

Then you would know that walkPath accepts a list of positions and not an array.

 

i never use a list in input my data but can a for loop works? im not on my computer right now let give you feedback later

29 minutes ago, m3nbersures said:

any code exemple can help because aray list is a new element but i want new position do you mean : new ArrayList(new Position(0,0,0))) ?

that should do the trick

getWalking().walkPath(Arrays.asList(HILLS_PATH));

private List<Position> path = Arrays.asList(new Position(x,y,z), new Position(x,y,z));
  
script.getWalking().walkPath(path);

I believe something like this is what you are after?

0kqbx2R.png

you need a LinkedList for walking events.

3FvsNjg.png

I included a break condition as well for better efficiency and responsiveness.
Happy scripting!

  • Author
1 hour ago, 01053 said:

private List<Position> path = Arrays.asList(new Position(x,y,z), new Position(x,y,z));
  
script.getWalking().walkPath(path);

I believe something like this is what you are after?

yes thank you very much

1 minute ago, superuser said:

0kqbx2R.png

you need a LinkedList for walking events.

3FvsNjg.png

I included a break condition as well for better efficiency and responsiveness.
Happy scripting!

wow i like the effort you make for that very apreciated  ++ rep

Edited by m3nbersures

2 hours ago, m3nbersures said:

yes thank you very much

wow i like the effort you make for that very apreciated  ++ rep

Also make sure you populate the LinkedList when the script starts in the onStart() method.

So you're not having to spend time repopulating the List everytime you call the HILLS_RUN() method, not a major problem but good practise.

Also another thing I'd probably do is -

Change 

wEvent.setPath(HILLS_PATH);

To

w.setPath(HILLS_PATH).setMinDistanceThreshold(2).setMiniMapDistanceThreshold(2);

So you aren't literally walking to the exact same tile every time.

Edited by 01053

6 hours ago, 01053 said:

Also make sure you populate the LinkedList when the script starts in the onStart() method.

So you're not having to spend time repopulating the List everytime you call the HILLS_RUN() method, not a major problem but good practise.

Also another thing I'd probably do is -

Change 


wEvent.setPath(HILLS_PATH);

To


w.setPath(HILLS_PATH).setMinDistanceThreshold(2).setMiniMapDistanceThreshold(2);

So you aren't literally walking to the exact same tile every time.


The default min distance threshold is 3, and the default mini map distance threshold is 5 so I don't think he really needs to change those values.

Also mini map distance threshold does not affect whether the player walks to the same position or not:

"This method sets the property of this walking event that determines whether the next position you're walking to in the path from A to B will be walked to by using the mini map or the main screen. The next location you're walking to is not necessarily the destination of this event, but the next clickable position in the path from A to B. If the distance to the next clickable position is equal or higher than the mini map distance threshold, this event will walk using the mini map. If not, it will use the main screen. The default value of this property is 5."

 

 

8 hours ago, superuser said:

0kqbx2R.png

you need a LinkedList for walking events.

3FvsNjg.png

I included a break condition as well for better efficiency and responsiveness.
Happy scripting!


This is correct, can be simplified a little though (and you shouldn't create the LinkedList every time you want to walk)

public static final Area HILLS_AREA = new Area(1, 2, 3, 4);

public static final LinkedList<Position> HILLS_PATH = new LinkedList<>(
        Arrays.asList(
                new Position(1, 2, 0),
                new Position(2, 3, 0)
        )
);

public final void someMethod() {
    WalkingEvent walkingEvent = new WalkingEvent();
    walkingEvent.setPath(HILLS_PATH);
    walkingEvent.setBreakCondition(new Condition() {
        return HILLS_AREA.contains(myPosition());
    });
    execute(walkingEvent);
}


If you don't need to use setBreakCondition or any of the other functions though, then this will do:
 

private static final List<Position> HILLS_PATH = Arrays.asList(new Position(1, 2, 0), new Position(2, 3, 0));

public final void someMethod() {
    getWalking().walkPath(HILLS_PATH); 
}



 

Edited by Explv

3 hours ago, Explv said:

This is correct, can be simplified a little though (and you shouldn't create the LinkedList every time you want to walk)


public static final Area HILLS_AREA = new Area(1, 2, 3, 4);

public static final LinkedList<Position> HILLS_PATH = new LinkedList<>(
        Arrays.asList(
                new Position(1, 2, 0),
                new Position(2, 3, 0)
        )
);

public final void someMethod() {
    WalkingEvent walkingEvent = new WalkingEvent();
    walkingEvent.setPath(HILLS_PATH);
    walkingEvent.setBreakCondition(new Condition() {
        return HILLS_AREA.contains(myPosition());
    });
    execute(walkingEvent);
}


If you don't need to use setBreakCondition or any of the other functions though, then this will do:
 


private static final List<Position> HILLS_PATH = Arrays.asList(new Position(1, 2, 0), new Position(2, 3, 0));

public final void someMethod() {
    getWalking().walkPath(HILLS_PATH); 
}



 

yeah i know i wrote it like that because i was just expanding on what he had. in hindsight i should have just wrote it the proper way so he doesn't develop bad habits.

this is how i actually do things normally

N5xU2Ky.png
69ij727.png

 

Edited by superuser
deleted duplicate image

2 hours ago, superuser said:

yeah i know i wrote it like that because i was just expanding on what he had. in hindsight i should have just wrote it the proper way so he doesn't develop bad habits.

this is how i actually do things normally

N5xU2Ky.png
69ij727.png

 


Yeah fair enough, you don't need those for loops though, you can create a LinkedList<Position> like so:

public static final LinkedList<Position> HILLS_PATH = new LinkedList<>(
        Arrays.asList(
                new Position(1, 2, 0),
                new Position(2, 3, 0)
        )
);
  • Author

thx to everyone my question was just why my walking cant take my array argument and now i just do Arrays.asList and it works

i thought i needed to do a for loop to read through the array but finally i dont need to

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.