Jump to content

walk() vs random path walking


baseball_260

Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 2 weeks later...
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
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...