sudoinit6 Posted April 29, 2019 Share Posted April 29, 2019 I have found some useful information about walking to exact position, for example this thread: Unfortunately I can't get the syntax correct and I think it is because I am using this method of writing:https://osbot.org/forum/topic/92612-tutorialindepth-a-better-take-on-task-based-scripts/ If I use the syntax found in the thread or try and make my own WalkingEvent: WalkingEvent digsite = new WalkingEvent(EVarrockMinePos); digsite.setMinDistanceThreshold(0); script.execute(digsite); It rejects it saying script can not be resolved. Nor does is like: api.script.execute(digsite) This code gets passed over, I don't get an error, nothing happens: WalkingEvent digsite = new WalkingEvent(EVarrockMinePos); digsite.setMinDistanceThreshold(0); api.execute(digsite); Anyone want to give me a hint as to what I am doing wrong? Quote Link to comment Share on other sites More sharing options...
Night Posted April 29, 2019 Share Posted April 29, 2019 You probably need to pass a script reference to execute events instead of a MethodProvider, but I've always passed Script regardless so not sure. Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted April 29, 2019 Author Share Posted April 29, 2019 43 minutes ago, Night said: You probably need to pass a script reference to execute events instead of a MethodProvider, but I've always passed Script regardless so not sure. If you were to guess how this could be done, what would you guess? Quote Link to comment Share on other sites More sharing options...
Chris Posted April 29, 2019 Share Posted April 29, 2019 just use onloop in the main script class easier then getting confused with these "task based" solutions Quote Link to comment Share on other sites More sharing options...
Night Posted April 29, 2019 Share Posted April 29, 2019 16 minutes ago, sudoinit6 said: If you were to guess how this could be done, what would you guess? Just pass your Script object from main class through the constructor of your task. Quote Link to comment Share on other sites More sharing options...
Juggles Posted April 29, 2019 Share Posted April 29, 2019 Also remember walkingevent will only work for the loaded area. you can't do it for long distances Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted April 29, 2019 Author Share Posted April 29, 2019 1 hour ago, Chris said: just use onloop in the main script class easier then getting confused with these "task based" solutions I am too dumb to do that. 1 hour ago, Night said: Just pass your Script object from main class through the constructor of your task. I will give that a try, thanks. 5 minutes ago, Juggles said: Also remember walkingevent will only work for the loaded area. you can't do it for long distances How far is the "loaded area" I am trying to go from Varrock Bank West to Varrock East Mine. Quote Link to comment Share on other sites More sharing options...
Juggles Posted April 29, 2019 Share Posted April 29, 2019 Just now, sudoinit6 said: I am too dumb to do that. I will give that a try, thanks. How far is the "loaded area" I am trying to go from Varrock Bank West to Varrock East Mine. Way too far. Only about 20 tiles in every direction (what your minimap can see) Quote Link to comment Share on other sites More sharing options...
Czar Posted April 29, 2019 Share Posted April 29, 2019 in your main class, the class that 'extends Script' (at the top of the file), add a custom method like this: public void longwalk(Position target) { WebWalkEvent event = new WebWalkEvent(target); execute(event); } Then in your tasks/events you can just call that method, of course don't forget to add a target position. If you want to walk to an AREA instead of a position, you can change "Position target" to "Area target" Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted April 29, 2019 Author Share Posted April 29, 2019 12 minutes ago, Juggles said: Way too far. Only about 20 tiles in every direction (what your minimap can see) Well damn, that could be my problem. Thanks mate! 2 minutes ago, Czar said: in your main class, the class that 'extends Script' (at the top of the file), add a custom method like this: public void longwalk(Position target) { WebWalkEvent event = new WebWalkEvent(target); execute(event); } Then in your tasks/events you can just call that method, of course don't forget to add a target position. If you want to walk to an AREA instead of a position, you can change "Position target" to "Area target" Gotcha, I will try starting from closer and this. You guys rock, thanks again! Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted April 30, 2019 Author Share Posted April 30, 2019 26 minutes ago, Czar said: in your main class, the class that 'extends Script' (at the top of the file), add a custom method like this: public void longwalk(Position target) { WebWalkEvent event = new WebWalkEvent(target); execute(event); } Then in your tasks/events you can just call that method, of course don't forget to add a target position. If you want to walk to an AREA instead of a position, you can change "Position target" to "Area target" When I do this and call upon it, the IDE wants me to make longwalk static, and then I get an error on execute that say I can't make a static reference to a not static method from the type MethodProvider. Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted April 30, 2019 Author Share Posted April 30, 2019 Solved! Thank you all for your help! It was a combination of your advice, putting it in the main class and I was too far away so I started closer. Those did the trick! Quote Link to comment Share on other sites More sharing options...
FrostBug Posted April 30, 2019 Share Posted April 30, 2019 WalkingEvent uses LocalWalker, which uses the local region clipping graph. This is 104x104 tiles (13 by 13 chunks), so a bit more than just 20 tiles in each direction. Quote Link to comment Share on other sites More sharing options...