Jump to content

Walking to exact position.


Recommended Posts

Posted

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?

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

Posted

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"

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

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

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