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.

Finding the Closest Walkable Tile to Any Given Tile

Featured Replies

Figured I would make a non spam post for once. :doge:

 

I was working on a script last night and came across the issue of, what if you try to walk to a tile that is not walkable? So I said to myself, well you could just find the first one around it that is walkable and go there?

 

So I started making a method, getClosestWalkablePositionTo(Position P). There were two ways that immediately came to mind:

 

1) Check every tile in the region, if the tile is walkable, then calculate the distance between that tile and the desired tile. You can then find the closest one that way. Note that this requires ~10k checks and potentially 10k calculations if all tiles are walkable (worst case).

You could improve on this by accepting the first one that you find within 3 tiles from it or something of the sort. 

 

2) The idea that I thought up which made more sense, start at the given position, if its not walkable, start spiraling out checking each tile around it until you hit a walkable position, then return. 

 

So this is how it turned out:

http://i.imgur.com/pC8k0d4.webm

 

Note that the delay that you see between tiles being drawn is not a real delay, I added that in there for the visual spiral effect. The time it takes to actually find the tile is not noticeable.

 

So basically I give it the yellow tile in the middle of the water, and it begins to spiral out until it eventually finds the red tile, which is the first walkable (and reachable) tile that the spiral hits. 

 

What do you think? Would anyone use something like this if I released code for it. ^_^

Figured I would make a non spam post for once. doge.png

 

I was working on a script last night and came across the issue of, what if you try to walk to a tile that is not walkable? So I said to myself, well you could just find the first one around it that is walkable and go there?

 

So I started making a method, getClosestWalkablePositionTo(Position P). There were two ways that immediately came to mind:

 

1) Check every tile in the region, if the tile is walkable, then calculate the distance between that tile and the desired tile. You can then find the closest one that way. Note that this requires ~10k checks and potentially 10k calculations if all tiles are walkable (worst case).

You could improve on this by accepting the first one that you find within 3 tiles from it or something of the sort. 

 

2) The idea that I thought up which made more sense, start at the given position, if its not walkable, start spiraling out checking each tile around it until you hit a walkable position, then return. 

 

So this is how it turned out:

http://i.imgur.com/pC8k0d4.webm

 

Note that the delay that you see between tiles being drawn is not a real delay, I added that in there for the visual spiral effect. The time it takes to actually find the tile is not noticeable.

 

So basically I give it the yellow tile in the middle of the water, and it begins to spiral out until it eventually finds the red tile, which is the first walkable (and reachable) tile that the spiral hits. 

 

What do you think? Would anyone use something like this if I released code for it. happy.png

 

 

Was about to post:

Did you add sleeptimes ?

Because it takes quite a while to check them all, even though it's only about +-30 tiles?

 

But then I read again... and I was too fast xD

I used somehting like this too to walk to some unwalkable npc's and objects.

 

Great GIF :)

  • Author

Was about to post:

Did you add sleeptimes ?

Because it takes quite a while to check them all, even though it's only about +-30 tiles?

 

But then I read again... and I was too fast xD

I used somehting like this too to walk to some unwalkable npc's and objects.

 

Great GIF smile.png

 

[iNFO][bot #1][02/27 08:17:14 AM]: Took ~299 ms to find the walkable tile.

 

Yea I added sleeps in the paint, that is the time to find this particular walkable tile, and its searching in a pretty big area.

 

If the given position is walkable it will just return that position. In most cases, I cant imagine it making more than one or two rings. For example, to find this one:

 

2ab0c367604311e74640bf8bd7c0b3bf.png

[iNFO][bot #1][02/27 08:19:47 AM]: Took ~5 ms to find the walkable tile.

 

So in most cases it will be not noticeable.

 

I would use for what im working on right now

 

And what script is that?

  • Author

didntread/10 

 

if only i had a webwalker, release plox doge.png

 

brb using mysteryfisher

 

 

You mean like this 

0827f60385735d6b7b18381dbc908233.png

 

 

:doge:

 

I actually made this for walking to areas where the provided tile might not be walkable. :p

This is much more effective than the alternative tongue.png

 

Still worst-case O(n) ph34r.png

But considering n is probably quite low it doesn't matter :p

Call the algo MysteryySearch pls

  • Author

Still worst-case O(n) ph34r.png

But considering n is probably quite low it doesn't matter tongue.png

Call the algo MysteryySearch pls

 

Rofl that would be fitting. xD

 

And yea worst cast is O(n) but since its starting at the central position then chances of it running to n are very low. 

If it runs to n, then you are probably in the middle of water so there is no walkable tile anyway hue. 

Edited by Mysteryy

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.