Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Walking, what am i doing wrong?

Joined
Jul 20, 2015
Messages
27
Im trying to walk from point a to b, using:
public void walkToPoint(String... args) {
PredefinedPath path = PredefinedPath.create(new Coordinate(2098, 3919, 0), new Coordinate(2102, 3915, 0), new Coordinate(2107, 3915, 0), new Coordinate(2112, 3912, 0), new Coordinate(2112, 3907, 0), new Coordinate(2112, 3902, 0), new Coordinate(2112, 3897, 0), new Coordinate(2112, 3892, 0), new Coordinate(2113, 3887, 0), new Coordinate(2117, 3883, 0), new Coordinate(2118, 3878, 0), new Coordinate(2122, 3875, 0), new Coordinate(2126, 3872, 0), new Coordinate(2130, 3869, 0), new Coordinate(2134, 3866, 0), new Coordinate(2135, 3861, 0), new Coordinate(2140, 3860, 0), new Coordinate(2145, 3861, 0), new Coordinate(2150, 3863, 0), new Coordinate(2155, 3864, 0));

path.step();


}

But whenever i use this in my mainloop it starts walking, and then instantly starts doing the next thing in the loop, in this case bankWithdraw.

public class Astrals extends LoopingScript {
@Overridepublic void onLoop() {
bankWithdraw();
walkToPoint();
//Note that i've left out some methods
}
 
Joined
Jul 17, 2015
Messages
24
Doing path.step() will only step once which is why it is a step. So you need to keep calling it over and over until you have reached where you actually want to walk to which is the bank. So you need a range check.
 
Joined
Jul 20, 2015
Messages
27
Doing path.step() will only step once which is why it is a step. So you need to keep calling it over and over until you have reached where you actually want to walk to which is the bank. So you need a range check.
Any effective method of doing so? perhaps a while loop?
 
Joined
Nov 5, 2014
Messages
505
Any effective method of doing so? perhaps a while loop?

You need to adjust your logic so that pathing/banking are only called when they are necessary instead of procedurally every time, .step() will then be called again and will step onto the next tile in your path.

Something like this (I've left out generating the path and null checking everything, you'd need to do that too):

Code:
Area targetArea = null; // you would define the area

if (targetArea.contains(Players.getLocal()) {
     // we are in the area, call banking
} else {
    // we need to path to the area
    path.step(true); // pass true so the path clicks are managed for you
}
 
Joined
Jul 20, 2015
Messages
27
You need to adjust your logic so that pathing/banking are only called when they are necessary instead of procedurally every time, .step() will then be called again and will step onto the next tile in your path.

Something like this (I've left out generating the path and null checking everything, you'd need to do that too):

Code:
Area targetArea = null; // you would define the area

if (targetArea.contains(Players.getLocal()) {
     // we are in the area, call banking
} else {
    // we need to path to the area
    path.step(true); // pass true so the path clicks are managed for you
}
Thanks! I've created an area with areamaker, but i get "Cannot resolve symbol Circular"
 
Top