Jump to content

localWalker.walkPath not working properly


Ace

Recommended Posts

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;
    }
}

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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