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

Checking distance between two positions?

Featured Replies

for instance...

if player is closer to position1, make them walk there, else if it's position2, make them walk there


pos1.distance(pos2)

||

if myPosition#distance(pos1) <= x

//do stuff

else if myPosition#distance(pos2) <= x

//do stuff

Edited by Sinatra

  • Author
position.distance(position)

 

 

pos1.distance(pos2)

||

if myPosition#distance(pos1) <= x
//do stuff
else if myPosition#distance(pos2) <= x
//do stuff

literally just checked the api lol

thx fam

position.distance() will not work properly if you want accurate long distance checks because that's just an application of Pythagora's algorithm and does not take into account plane difference, links or obstacles at all.

 

map.realDistance(Position position) should take into consideration all the above situations. You could also try walking.webWalk(Position... positions) as that walks to the closest of the given positions since you mentioned you only want to walk. 

position.distance() will not work properly if you want accurate long distance checks because that's just an application of Pythagora's algorithm and does not take into account plane difference, links or obstacles at all.

 

map.realDistance(Position position) should take into consideration all the above situations. You could also try walking.webWalk(Position... positions) as that walks to the closest of the given positions since you mentioned you only want to walk. 

 

However realdistance seems to be off a lot.

I tried using it to find the real closest goblin (like one next to you but behind the fence would actually be further away to run to it)

However it mostly doesn't seem to actually pick the closest one, it looked fairly random

However realdistance seems to be off a lot.

I tried using it to find the real closest goblin (like one next to you but behind the fence would actually be further away to run to it)

However it mostly doesn't seem to actually pick the closest one, it looked fairly random

It seems to be working fine for me but I haven't tested it much. If you don't trust OSBot's realDistance() method you can try implementing A* with collision flags and getting the length of the path and you should get the same result.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.