Jump to content

Walking to exact position.


sudoinit6

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

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