JARNQ Posted April 20, 2017 Share Posted April 20, 2017 I've been trying to find out whats wrong but i just can't find the mistake. If i'm on the tile where i'm trying to go, nothing happens. ( this is correct ) But if i'm not on the tile all i see is the "Returning to exact AFK spot." get spammed on log and my character doesn't walk there. Can someone point me to the right direction? This is on my getState: if (afk.contains(myPlayer()) && !(myPlayer().getX() == 2704) && !(myPlayer().getY() == 3726)) return State.AFKSPOT; Position: Position afkspot = new Position(2704, 3726, 0); And this is my AFKSPOT case: case AFKSPOT: getWalking().walk(afkspot); log("Returning to exact AFK spot."); sleep(random(345, 825)); break; Quote Link to comment Share on other sites More sharing options...
Explv Posted April 20, 2017 Share Posted April 20, 2017 (edited) If you want to walk to an exact position you will need to use a custom WalkingEvent and change the distance threshold to 0. By default the value is 3, which means the player will stop walking when <= 3 tiles away from the destination (getWalking().walk() just uses the default settings) WalkingEvent walkingEvent = new WalkingEvent(afkspot); walkingEvent.setMinDistanceThreshold(0); execute(walkingEvent); Edited April 20, 2017 by Explv 1 Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted April 20, 2017 Share Posted April 20, 2017 What Explv said Quote Link to comment Share on other sites More sharing options...
harrypotter Posted April 20, 2017 Share Posted April 20, 2017 (edited) 10 minutes ago, JARNQ said: I've been trying to find out whats wrong but i just can't find the mistake. If i'm on the tile where i'm trying to go, nothing happens. ( this is correct ) But if i'm not on the tile all i see is the "Returning to exact AFK spot." get spammed on log and my character doesn't walk there. Can someone point me to the right direction? This is on my getState: if (afk.contains(myPlayer()) && !(myPlayer().getX() == 2704) && !(myPlayer().getY() == 3726)) return State.AFKSPOT; Position: Position afkspot = new Position(2704, 3726, 0); And this is my AFKSPOT case: case AFKSPOT: getWalking().walk(afkspot); log("Returning to exact AFK spot."); sleep(random(345, 825)); break; Why are you doing: !(myPlayer().getX() == 2704) Wouldn't: myPlayer().getX() != 2704 Be better? As for your question you need to do something like so: WalkingEvent walkToSpot = new WalkingEvent(afkspot); walkToSpot.setMinDistanceThreshold(0); execute(walkToSpot); Edited April 20, 2017 by harrypotter Quote Link to comment Share on other sites More sharing options...
Rudie Posted April 20, 2017 Share Posted April 20, 2017 4 minutes ago, harrypotter said: Why are you doing: !(myPlayer().getX() == 2704) Wouldn't: myPlayer().getX() != 2704 Be better? Nah man that's top tier antiban 2 Quote Link to comment Share on other sites More sharing options...
Explv Posted April 20, 2017 Share Posted April 20, 2017 4 minutes ago, harrypotter said: Why are you doing: !(myPlayer().getX() == 2704) Wouldn't: myPlayer().getX() != 2704 Be better? This would be better: !myPosition().equals(afkspot); 5 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted April 20, 2017 Share Posted April 20, 2017 16 minutes ago, Explv said: If you want to walk to an exact position you will need to use a custom WalkingEvent and change the distance threshold to 0. By default the value is 3, which means the player will stop walking when <= 3 tiles away from the destination (getWalking().walk() just uses the default settings) WalkingEvent walkingEvent = new WalkingEvent(afkspot); walkingEvent.setMinDistanceThreshold(0); execute(walkingEvent); This^ Quote Link to comment Share on other sites More sharing options...
Twisted Staff Posted April 20, 2017 Share Posted April 20, 2017 1 minute ago, Khaleesi said: This^ i know java css html php if i take some time learning osbot scripting can i make scripts?? ugh Quote Link to comment Share on other sites More sharing options...
JARNQ Posted April 20, 2017 Author Share Posted April 20, 2017 1 hour ago, harrypotter said: Why are you doing: !(myPlayer().getX() == 2704) Wouldn't: myPlayer().getX() != 2704 Be better? As for your question you need to do something like so: WalkingEvent walkToSpot = new WalkingEvent(afkspot); walkToSpot.setMinDistanceThreshold(0); execute(walkToSpot); Yes sir it would. I'm pretty new to java so alot of my code is questionable. :P 1 hour ago, Explv said: If you want to walk to an exact position you will need to use a custom WalkingEvent and change the distance threshold to 0. By default the value is 3, which means the player will stop walking when <= 3 tiles away from the destination (getWalking().walk() just uses the default settings) WalkingEvent walkingEvent = new WalkingEvent(afkspot); walkingEvent.setMinDistanceThreshold(0); execute(walkingEvent); Oh alright, i see. Thanks alot! Quote Link to comment Share on other sites More sharing options...
whipz Posted April 20, 2017 Share Posted April 20, 2017 also afkspot.interact(bot, "Walk here"); dunno how well it goes against what others have said but it works for me Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted April 20, 2017 Share Posted April 20, 2017 4 hours ago, Twisted Staff said: i know java css html php if i take some time learning osbot scripting can i make scripts?? ugh Sure, you can already start when you ahve a basic knowledge of java All you ahve to get used it the API of osbot 1 Quote Link to comment Share on other sites More sharing options...