Jump to content

walk() vs random path walking


Recommended Posts

Posted
Area area = new Area(0, 0, 1, 1);

getLocalWalker().walk(area.getRandomPosition());

Exactly what I need! thank you! 

 

What about interacting with objects ect, is there a way to make sure  i don't always click the same spot.

RS2Object portal = objects.getClosest("portal");

portal.interact("Teleporte");

How can i make this click the portal at random locations?

Posted

Exactly what I need! thank you! 

 

What about interacting with objects ect, is there a way to make sure  i don't always click the same spot.

RS2Object portal = objects.getClosest("portal");

portal.interact("Teleporte");

How can i make this click the portal at random locations?

 

It should be fairly random as it is?

Posted

I don't know..Im trying to make this thing as random as possible. Im pretty new to the scripting so maybe im being a little too cautious. 

 

Well interactions are pretty random by themselves.

 

Also going back to path walking, if you call walk() like this:

Position[] path = {

    new Position(0, 1, 0),
    new Position(0, 2, 0),
    new Position(0, 3, 0)
};

getLocalWalker().walkPath(path);

It will walk to each position in the array, but randomise each position to a distance of 1 tile.

 

So most things are already randomised for you. :)

  • Like 1
  • 2 weeks later...
Posted
Area area = new Area(0, 0, 1, 1);

getLocalWalker().walk(area.getRandomPosition());

 

 

So it turns out this doesn't work after all...I'm not certain but i think it will only work if every tile in that area is walkable... i.e there is not object on the floor that stop you from standing on 1 spot. For me this failed 1/2 times and walk() would return false. 

 

By simply using 

getLocalWalker().walk(area);

the bot always walks to the correct area and walk never returns false... Also the position it clicks is randomized so no need to worry.

It seems i was complicating thing by trying to randomize more... :( Live and learn people! 

  • Like 1

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