Gam Posted June 11, 2021 Posted June 11, 2021 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?
skillerkidos1 Posted June 11, 2021 Posted June 11, 2021 (edited) 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); execute(myEvent); //executing the event Edited June 11, 2021 by skillerkidos1 3
Gam Posted June 11, 2021 Author Posted June 11, 2021 (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 June 11, 2021 by Gam
Gam Posted June 11, 2021 Author Posted June 11, 2021 41 minutes ago, skillerkidos1 said: That’s exactly what I said? Lmao Yeah, I just mean I did that right before you commented. 1