Jump to content

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


Recommended Posts

Posted
        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?

Posted (edited)
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

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...