Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Walk to a random tile inside an area?

Featured Replies

How can I make the player walk to a random tile inside an area? I've used walking event and webwalk but both seem to randomly every now and again walk 1-2 tiles away from the area.

 

By the way I have put the min distance threshold on walking event to 0 but it doesn't seem to work as intended on the API so possibly a client bug.

 

Thanks

Edited by steve498

How can I make the player walk to a random tile inside an area? I've used walking event and webwalk but both seem to randomly every now and again walk 1-2 tiles away from the area.

 

By the way I have put the min distance threshold on walking event to 0 but it doesn't seem to work as intended on the API so possibly a client bug.

 

Thanks

walking.walk(area.getRandomPosition());

or

walking.webWalk(area.getRandomPosition());

?

Edited by Explv

  • Author
walking.walk(area.getRandomPosition());

or

walking.webWalk(area.getRandomPosition());

?

 

 

I have tried these and no luck.

 

Basically this is how I'm testing it:

 

I have an area created and a condition that checks whether the area contains the player. If true, great! if false, then log it.

 

Sooo... I then use the methods you mentioned and sometimes it will say that I'm not inside the area. So it is not walking in one of the area's tiles.

 

Hopefully that makes some sense.

I have tried these and no luck.

 

Basically this is how I'm testing it:

 

I have an area created and a condition that checks whether the area contains the player. If true, great! if false, then log it.

 

Sooo... I then use the methods you mentioned and sometimes it will say that I'm not inside the area. So it is not walking in one of the area's tiles.

 

Hopefully that makes some sense.

 

You should use WakingEvent, however I feel like the min threshold stuff might not be working right now.

 

You could try:

MainScreenTileDestination destination = new MainScreenTileDestination(getBot(), area.getRandomPosition());
getMouse().click(destination);

or:

MiniMapTileDestination destination = new MiniMapTileDestination(getBot(), area.getRandomPosition());
getMouse().click(destination);

Edited by Explv

I have tried these and no luck.

 

Basically this is how I'm testing it:

 

I have an area created and a condition that checks whether the area contains the player. If true, great! if false, then log it.

 

Sooo... I then use the methods you mentioned and sometimes it will say that I'm not inside the area. So it is not walking in one of the area's tiles.

 

Hopefully that makes some sense.

if(AREA.contain(player)){
   walker.walk(AREA.getRandomPosition());
} else {
  log("Area does not contain player");
}

Edited by ni562

  • Author

 

You should use WakingEvent, however I feel like the min threshold stuff might not be working right now.

 

You could try:

MainScreenTileDestination destination = new MainScreenTileDestination(getBot(), area.getRandomPosition());
getMouse().click(destination);

 

Tried and just spams this in the console...

 

ei6m3Tr.jpg

 

This message is logged when the area does not contain the player. When it does not contain the player it executes the code to walk to the area. Unfortunately nothing happens with the solution you just provided sad.png

 

Edit: Trying other solutions just posted bare with... Thanks

Edited by steve498

if(AREA.contain(player)){
   walker.walk(AREA.getRandomPosition());
} else {
   stop();
}

 

That is incorrect, and also he said walker.walk doesn't work :doge:

  • Author

That is incorrect, and also he said walker.walk doesn't work doge.png

 

Well it does but it puts me 1-2 tiles away sometimes. Also that code wouldn't work as it would try to move the player when they are already inside the area?

 

Will edit this post after testing your second solution Explv, thanks.

 

Update:

 

Well the second solution looks like it worked however, inside the bank it cannot run back to the area because it is not on the minimap.

Edited by steve498

That is incorrect, and also he said walker.walk doesn't work doge.png

:( Except an 's' what did i miss? 

sad.png Except an 's' what did i miss? 

 

it only walks to a random position in the area, if it's already in the area doge.png

Well it does but it puts me 1-2 tiles away sometimes. 

 

That is because the walker uses default WalkingEvent which walks with a minthreshold of 2 tiles.

 

You should either wait for WalkingEvent to be fixed (if its broken)  or just walk to a position deep in the area rather than a random one?

Edited by Explv

  • Author

it only walks to a random position in the area, if it's already in the area doge.png

 

That is because the walker uses default WalkingEvent which walks with a minthreshold of 2 tiles.

 

You should either wait for WalkingEvent to be fixed (if its broken)  or just walk to a position deep in the area?

 

I thought by setting the minDistance threshold to 0 it would override this but I could be wrong and yes that is what I was just considering. I think I'll stick to WalkingEvent and just make a path and place it inside an area deep so if it's 1-2 tiles out it'll still be in the area.

 

Thanks anyway I appreciate it :)

Position pos = Area.getRandomPosition();
long safeGuard = System.currentTimeMillis();
while(!Area.contains(pos))
{
	pos = Area.getRandomPosition();
	if(System.currentTimeMillis() - safeGuard > 1000)
	{
		log("Something went wrong -_-");
		break;
	}
}

You could try something like that.

Edited by dopenes

Position pos = Area.getRandomPosition();
long safeGuard = System.currentTimeMillis();
while(!Area.contains(pos))
{
	pos = Area.getRandomPosition();
	if(System.currentTimeMillis() - safeGuard > 1000)
	{
		log("Something went wrong -_-");
		break;
	}
}

You could try something like that.

 

 

This code wont make any difference. Considering his walking code will be inside the onLoop method, the same functionality will occur. The issue lies somewhere else, probably with the walker stopping outside the area due to its minThreshold setting.

This code wont make any difference. Considering his walking code will be inside the onLoop method, the same functionality will occur. The issue lies somewhere else, probably with the walker stopping outside the area due to its minThreshold setting.

 

 

Ehh, I was assuming that the getRandomPosition() method was returning a position OUTSIDE of the area. If this is the case, then this will fix it, but if not, then yeah, lol.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.