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.

OSBot 2.1.1 (Possibly) Missing functions?

Featured Replies

1. In OSBot 1 we had obj.getMouseDestination().getBoundingBox() which returned a rectangle, which was very useful in drawing objects on screen. I've looked around ObjectDefinition and the new Model, but haven't found any way to access this, if its even still here.

 

I will update as I find things, but liking the new api a lot. Its going to be extremely easy for new scripters to learn how to script.

try something like getPolygon.  I havent looked at it much but that would be my guess

  public static short[][] getScreenCoordinates(Client client, int gridX, int gridY, int gridZ, Model model) {

        int cameraX = client.getCameraX();
        int cameraY = client.getCameraY();
        int cameraZ = client.getCameraZ();
        int sinP = Utilities.CAMERA_SIN[client.getCameraPitch()];
        int cosP = Utilities.CAMERA_COS[client.getCameraPitch()];
        int sinY = Utilities.CAMERA_SIN[client.getCameraYaw()];
        int cosY = Utilities.CAMERA_COS[client.getCameraYaw()];
        if (model.getTriangleCount() < 0) {
            return new short[0][];
        }
        short[][] screenCoords = new short[model.getVerticeCount()][];
        for (int n = 0; n < model.getVerticeCount(); n++) {
            int x0 = model.getVerticesX()[n] + gridX;
            int z0 = model.getVerticesZ()[n] + gridY;
            int y0 = model.getVerticesY()[n] + Utilities.getTileHeight(client.getBot(), x0, z0, gridZ) - cameraZ;

            int n15 = (z0 -= cameraY) * sinY + (x0 -= cameraX) * cosY >> 16;
            z0 = z0 * cosY - x0 * sinY >> 16;
            x0 = n15;
            n15 = y0 * cosP - z0 * sinP >> 16;
            z0 = y0 * sinP + z0 * cosP >> 16;
            y0 = n15;
            if (z0 >= 50) {
                x0 = 260 + (x0 << 9) / z0;
                y0 = 171 + (y0 << 9) / z0;
                if (x0 >= 0 && y0 >= 0) {
                    screenCoords[n] = new short[2];
                    screenCoords[n][0] = (short) x0;
                    screenCoords[n][1] = (short) y0;
                }
            }
        }

        return screenCoords;
    }
+

 public static Polygon getBoundingBox(Client client, Model model, int gridX, int gridY) {
        short[][] screenCoordinates = Utilities.getScreenCoordinates(client.getBot(), gridX, gridY, client.getPlane(), model);
        Polygon temp = new Polygon();

        int minX = Integer.MAX_VALUE;
        int minY = Integer.MAX_VALUE;
        int maxX = 0;
        int maxY = 0;
        for (int triangleId = 0; triangleId < model.getTriangleCount(); triangleId++)
            try {
                int triangleA = model.getTrianglesA()[triangleId];
                int triangleB = model.getTrianglesB()[triangleId];
                int triangleC = model.getTrianglesC()[triangleId];

                short[] pointA = screenCoordinates[triangleA];
                short[] pointB = screenCoordinates[triangleB];
                short[] pointC = screenCoordinates[triangleC];
                if (pointA != null && pointB != null && pointC != null) {
                    int aX = pointA[0];
                    int aY = pointA[1];

                    int bX = pointB[0];
                    int bY = pointB[1];

                    int cX = pointB[0];
                    int cY = pointB[1];

                    if (aX < minX) {
                        minX = aX;
                    }
                    if (bX < minX) {
                        minX = bX;
                    }
                    if (cX < minX) {
                        minX = cX;
                    }

                    if (aY < minY) {
                        minY = aY;
                    }
                    if (bY < minY) {
                        minY = bY;
                    }
                    if (cY < minY) {
                        minY = cY;
                    }
                    //maxes

                    if (aX > maxX) {
                        maxX = aX;
                    }
                    if (bX > maxX) {
                        maxX = bX;
                    }
                    if (cX > maxX) {
                        maxX = cX;
                    }

                    if (aY > maxY) {
                        maxY = aY;
                    }
                    if (bY > maxY) {
                        maxY = bY;
                    }
                    if (cY > maxY) {
                        maxY = cY;
                    }

                }
            } catch (ArrayIndexOutOfBoundsException var13) {
            }
        temp.addPoint(minX, minY);
        temp.addPoint(minX + (maxX - minX), minY);
        temp.addPoint(maxX, maxY);
        temp.addPoint(minX, maxY);
        return temp;
    }

Edited by PolishCivil

Its position's polygon. (bad)

 

I'm sure it'l suffice instead of re-creating the bounds for an object.

I'm sure it'l suffice instead of re-creating the bounds for an object.

some objects are small
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.