Jump to content

getWalking().walk(Position) doesn't walk to exact tile


Gam

Recommended Posts

        Position myPos = myPlayer().getPosition();

        if (myPlayer().isUnderAttack() && myPos.equals(afkPos)) {
            lastAtk = System.currentTimeMillis();
            done = false;
            afk();
        } else {
            if ( (System.currentTimeMillis() > (lastAtk + timer) ) && !done) {
                reset();
            } else {
                log("CURRENTLY HERE");
                getWalking().walk(afkPos);
                sleep(random(450, 750));
            }
        }

 

I'm at Sand Crabs and sometimes the script will missclick so I want it to return to the afk tile, but it doesn't actually walk to it. The logger spams "CURRENTLY HERE" so it reaches the code, but the script doesn't move. Does this have something to do with how getWalking().walk(Position) works?

Link to comment
Share on other sites

2 minutes ago, skillerkidos1 said:

You need to make an event and setMinDistanceThreshold to 0 to walk to exact tile



WalkingEvent myEvent = new WalkingEvent(new Position(1, 2, 3)); //making the event
myEvent.setMinDistanceThreshold(0); 
myEvent.setEnergyThreshold(47);
myEvent.setBreakCondition(new Condition() {
    @[member='Override']
    public boolean evaluate() {
        return myPlayer().isUnderAttack();
    }
});
execute(myEvent); //executing the event

 

Yeah after some searching I simply did

WalkingEvent walkingEvent = new WalkingEvent(afkPos);
walkingEvent.setMinDistanceThreshold(0);
execute(walkingEvent);

Thanks anyway

Edited by Gam
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...