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.

Regarding Clipping planes and tiles

Featured Replies

Dunno if this is in the right section, but posting in regards of a bunch of noob questions and general information.

So I was snooping around and found this thread

Khaleesi posted a nice solution for the given problem

static final int UNWALKABLE = 256 | 0x200000 | 0x40000;

public static boolean isWalkable(int flag) {
   return (flag & (UNWALKABLE)) == 0;
}

XClippingPlane[] clippingPlanes = script.client.accessor.getClippingPlanes();
int[][] map = clippingPlanes[script.myPlayer().getZ()].getTileFlags();

for(int i = 0; i < map.length;i++){
   for(int j = 0; j < map[i].length; j++){
      if(isWalkable(map[i][j]))
         //store in list?
   }
}

I tried playing around with this, but didn't succeed in the end.

My extremely nooby questions would be (spare the flame :D):

1) What the hell are these clipping planes and how can I use the given information for my benefit?

2) What are tile/clipping plane flags?

3) What are tiles exactly in OSRS (in depth). A  NxN size polygon of points? 

4) In the given code above there's a comment "//store in list?". First thing that comes to mind is to store each tile POSITION and there you have - you know where you can walk and where you can't. Didn't suceed in this.

5) How does a tile map to a position exactly?

Edited by nosepicker

6 hours ago, nosepicker said:

Dunno if this is in the right section, but posting in regards of a bunch of noob questions and general information.

So I was snooping around and found this thread

Khaleesi posted a nice solution for the given problem


static final int UNWALKABLE = 256 | 0x200000 | 0x40000;

public static boolean isWalkable(int flag) {
   return (flag & (UNWALKABLE)) == 0;
}

XClippingPlane[] clippingPlanes = script.client.accessor.getClippingPlanes();
int[][] map = clippingPlanes[script.myPlayer().getZ()].getTileFlags();

for(int i = 0; i < map.length;i++){
   for(int j = 0; j < map[i].length; j++){
      if(isWalkable(map[i][j]))
         //store in list?
   }
}

I tried playing around with this, but didn't succeed in the end.

My extremely nooby questions would be (spare the flame :D):

1) What the hell are these clipping planes and how can I use the given information for my benefit?

2) What are tile/clipping plane flags?

3) What are tiles exactly in OSRS (in depth). A  NxN size polygon of points? 

4) In the given code above there's a comment "//store in list?". First thing that comes to mind is to store each tile POSITION and there you have - you know where you can walk and where you can't. Didn't suceed in this.

5) How does a tile map to a position exactly?

I'm interested in this as well, though wouldn't it make more sense in the Scripting Help section? 

Great question, I’m also interested in this, haven’t sen anything like it before.

as Jca said it is probably better suited in scripting help.

These flags are what the client uses to calculate pathing. Basically, getTileFlags() returns a int[104][104] that contains the local regions "collision" data. Since OSRS is tile based, its pretty simple in the fact a tile is either blocked via walls or is blocked entirely (solid objects). You can also check if you can cast a spell or shoot a projectile through a wall. Lets look at an example "flag":

l8TlzES.png

Now it is an int, but to understand how it works we need the binary representation. 10000000 is the binary representation of 128, but we are looking at the "flags", aka a single bit. This flag has the 8th bit as 1, which we can compare with Region Flags. WALL_WEST is 0x80 in hex form which is 128, so this is our match. But what if multiple flags are flipped? This is where we use the bitwise AND operator:

flags[localX][localY] & 128 == 0

What this does is takes the first integer, and 0's out all bits that are not 1 in the second integer (and only the 8th bit is 1 for 128). So this check tests if the 8th bit is 1 (it'll return 128, not 1) or 0 (which returns 0 because all other bits are 0'd). From here we can do this for all the different flags, which you can find using the link in the previous paragraph. Once you can test if there is a wall between nodes, you can connect them. Note that there are no walls surrounding solid objects, so you also need to test if that tile is walkable.

Xceho7N.png

This shows a generated "web" of tiles in game, generated from the tile flags. You'll notice there is a bunch of "web" in the open air space too, as this web is just generated by going through every tile and connecting it to its neighbors. All those tiles are not marked "UNWALKABLE" as in your example, and therefore would incorrectly return as reachable. For this use getMap().canReach(Position), which basically does a flood fill of the local region to see what you can get to from the current position.

Edited by Lemons

  • Author

@Lemons thanks a lot! Checking your Quantum API atm to see how it's done form A to Z and honestly, I'm getting wet just by reading your code. Awesome.

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.