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.

get farthest (or minimum distance) visible main screen tile in a given direction?

Featured Replies

I was just wondering if anyone could show me an efficient method to either get the farthest main screen tile or a main screen tile at a minimum distance, specifically in a given direction? :D

Edited by adc

Load region

Add all visible tiles to a list

Grab the biggest or smallest (or a mixture of both if you want a most distant inter-cardinal direction position) x and y coordinates

 

I'm curious what you need this for :p

If you have movement path found

LocalPathFinder pathFinder = new LocalPathFinder(scp.bot);
LinkedList<Position> path = pathFinder.findPath(entity);

you can just check its tiles for visibility from index 0 to 20 for example.

new MainScreenTileDestination(bot, path.get(i)).isVisible()

If you need specific direction, you can ray-trace the line:)

I'm pretty sure the game map is 16 by 16, so the farthest position to the right would be:

new Position(myPosition.getX() + 16, myPosition().getY(), myPosition().getZ());

Farthest position below:

new Position(myPosition().getX(), myPosition().getY() - 16, myPosition().getZ());

etc...

  • Author

Load region

Add all visible tiles to a list

Grab the biggest or smallest (or a mixture of both if you want a most distant inter-cardinal direction position) x and y coordinates

 

I'm curious what you need this for tongue.png

 

post-71761-0-22896900-1404500813_thumb.png

 

I'm pretty sure the game map is 16 by 16, so the farthest position to the right would be:

new Position(myPosition.getX() + 16, myPosition().getY(), myPosition().getZ());

Farthest position below:

new Position(myPosition().getX(), myPosition().getY() - 16, myPosition().getZ());

etc...

 

 

Oh hey, perfect, this is exactly what I need QwPha8E.png For some reason I overlooked this, thinking I'd need something more complex.

  • Author

Are you doing barrows tunnel traversal without a path finding algo ? huh.png

 

 

 

I originally tried using a simple A*-type algorithm, but I encountered the problem of rooms being too far to load. Because of this, there's no way to determine a path unless you're already in the center of the catacombs, making it pretty much useless :P 

 

So my solution is this: 

 

(for data I have an enum that stores room areas, as well as Point[]s that possible doors reside at)

  • analyze current room's number of openable doors
  • if viable doors < 2, that means there's only one possible path; follow that path to the next room
  • if viable doors = 2, there's two paths. If one of the paths leads to the previous room, forget it and use the other path. if said other path leads to a blacklisted door, blacklist the current room as well.
  • if viable doors > 2, prioritize in this order: 1) doors that lead to the chest 2) doors that lead to short tunnels 3) whatever is left (doors that lead to long tunnels)
  • if a room has only 1 door and it's not the ladder room or chest room, blacklist it

 

It works pretty okay so far  :D

I originally tried using a simple A*-type algorithm, but I encountered the problem of rooms being too far to load. Because of this, there's no way to determine a path unless you're already in the center of the catacombs, making it pretty much useless tongue.png

 

You could just go to the center once and store all the required data once in a class though (as you would do for a webwalker).

 

 

So my solution is this: 

 

(for data I have an enum that stores room areas, as well as Point[]s that possible doors reside at)

  • analyze current room's number of openable doors
  • if viable doors < 2, that means there's only one possible path; follow that path to the next room
  • if viable doors = 2, there's two paths. If one of the paths leads to the previous room, forget it and use the other path. if said other path leads to a blacklisted door, blacklist the current room as well.
  • if viable doors > 2, prioritize in this order: 1) doors that lead to the chest 2) doors that lead to short tunnels 3) whatever is left (doors that lead to long tunnels)
  • if a room has only 1 door and it's not the ladder room or chest room, blacklist it

 

It works pretty okay so far  biggrin.png

 

If it works then that's all that matters I guess x)

  • Author

You could just go to the center once and store all the required data once in a class though (as you would do for a webwalker).

 

 

 

Actually, I tried. the problem is that every time you spawn a new tunnel path (every chest run at barrows), you'd have to be able to check whether each door on a given path is openable. When I tried doing this via getActions.contains("Open"), unloaded doors return true whether they're actually openable or not, meaning it couldn't determine a path, since A* (and pathfinding in general afaik) obtains its path from the end point to the beginning.

Actually, I tried. the problem is that every time you spawn a new tunnel path (every chest run at barrows), you'd have to be able to check whether each door on a given path is openable. When I tried doing this via getActions.contains("Open"), unloaded doors return true whether they're actually openable or not, meaning it couldn't determine a path, since A* (and pathfinding in general afaik) obtains its path from the end point to the beginning.

 

You can get the openable doors via config(s) tho, without having the doors loaded.

  • Author

You can get the openable doors via config(s) tho, without having the doors loaded.

 

 

..... Looks like I'm going to be testing two methods of pathfinding for this script then.

 

 

Fuck.

Why do you guys make this so complex?

 

If you can get the doors you need to open via configs, you can literally just run around the perimeter until the door is reachable. Finding the next position to walk to is ezpz as you can just find the farthest walkable tile in your game region and walk to it.

Guest
This topic is now closed to further replies.

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.