Jump to content

localWalker.walkPath not working properly


Recommended Posts

Posted

do you use localWalker.walk in a custom walker or just click points on the minimap?

Custom walkers follows the same idea as local walker but doesn't spam click if ur not on the first position of the list

It would be in a new class

Walking.java

Then I call it snide my script

Walking walk = new Walking ();

Then walk.walkpath (path here);

@Sinatra

Hey,

So I'm writing a script and I tried using the osbot's local walker to walk a path but it always keeps spam clicking the first tile and doesn't walk any further. Is somebody else having this problem or is the local walker working fine for you?

thanks in advance smile.png

 

 

Something like this

public class Walking {
    private Script scriptInstance;
    public Walking(Script scriptInstance){
        this.scriptInstance = scriptInstance;
    }
    public void walkPath(Position[] path) throws InterruptedException {

        Position[] var5 = path;
        int var4 = path.length;

        for(int var3 = 0; var3 < var4; ++var3) {
            Position p = var5[var3];
            boolean success;
            if(scriptInstance.myPosition().distance(p) <= 16 && scriptInstance.myPosition().distance(p) >= 3) {
                do {
                    success = this.walkTile(p);
                } while(!success);
            }
        }
    }
    public boolean walkTile(Position p) throws InterruptedException {

        if(scriptInstance.myPosition().distance(p) > 13) {
            Position fail = new Position((p.getX() + scriptInstance.myPosition().getX()) / 2 + scriptInstance.random(-3, 3), (p.getY() + scriptInstance.myPosition().getY()) / 2 + scriptInstance.random(-3, 3), scriptInstance.myPosition().getZ());
            this.walkTile(fail);
        }

        scriptInstance.mouse.click(new MiniMapTileDestination(scriptInstance.bot, p), false);
        int var3 = 0;

        while(scriptInstance.myPosition().distance(p) > 2 && var3 < 10) {
            scriptInstance.sleep(500L);
            if(!scriptInstance.myPlayer().isMoving()) {
                ++var3;
            }
        }
        return var3 != 10;
    }
}

Posted

Custom walkers follows the same idea as local walker but doesn't spam click if ur not on the first position of the list

It would be in a new class

Walking.java

Then I call it snide my script

Walking walk = new Walking ();

Then walk.walkpath (path here);

@Sinatra

Something like this

public class Walking {    private Script scriptInstance;    public Walking(Script scriptInstance){        this.scriptInstance = scriptInstance;    }    public void walkPath(Position[] path) throws InterruptedException {        Position[] var5 = path;        int var4 = path.length;        for(int var3 = 0; var3 < var4; ++var3) {            Position p = var5[var3];            boolean success;            if(scriptInstance.myPosition().distance(p) <= 16 && scriptInstance.myPosition().distance(p) >= 3) {                do {                    success = this.walkTile(p);                } while(!success);            }        }    }    public boolean walkTile(Position p) throws InterruptedException {        if(scriptInstance.myPosition().distance(p) > 13) {            Position fail = new Position((p.getX() + scriptInstance.myPosition().getX()) / 2 + scriptInstance.random(-3, 3), (p.getY() + scriptInstance.myPosition().getY()) / 2 + scriptInstance.random(-3, 3), scriptInstance.myPosition().getZ());            this.walkTile(fail);        }        scriptInstance.mouse.click(new MiniMapTileDestination(scriptInstance.bot, p), false);        int var3 = 0;        while(scriptInstance.myPosition().distance(p) > 2 && var3 < 10) {            scriptInstance.sleep(500L);            if(!scriptInstance.myPlayer().isMoving()) {                ++var3;            }        }        return var3 != 10;    }}
thanks a lot, I'll try it out!
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...