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.

meanzie

Members
  • Joined

  • Last visited

  1. Hello there, so ehh, I started working on my first bot script today, And I couldn't really find any good pathfinding utilities to use, so I threw up one on my own. /** * Tries to find the best node in the path to walk on * * @param path * * @return */ public Position getBestNode(Position[] path) { int radius = 15; List<Integer> candidates = new LinkedList<>(); for (int i = 0; i < path.length; i++) { if (path[i].distance(myPosition()) < radius) { candidates.add(i); } } if (candidates.size() == 0) { warn("Tried to find best node for path, but no candidates were found."); return null; } int bestCandidate = 0; for (int i : candidates) { if (path[i].distance(path[path.length - 1]) < path[bestCandidate] .distance(path[path.length - 1])) { bestCandidate = i; } } // Check if this is the last point in the path if (bestCandidate + 1 >= path.length) { return path[bestCandidate]; } // We should try and interpolate between this point and the next point // so that distance is always radius Position pointA = path[bestCandidate]; Position pointB = path[bestCandidate + 1]; // So let's take p2 - p1 and get the direction vector int dirX = pointB.getX() - pointA.getX(); int dirY = pointB.getY() - pointA.getY(); // Now find a's distance to the target double distA = pointA.distance(myPosition()); // Let's normalize our direction vector double dirVecL = Math.sqrt(dirX * dirX + dirY * dirY); double dirVecX = dirX / dirVecL; double dirVecY = dirY / dirVecL; // Now let's create our destination vector Position pointD = new Position( (int) (dirVecX * (radius - distA) + pointA.getX()), (int) (dirVecY * (radius - distA) + pointA.getY()), 0); return pointD; } This function assumes that you are giving it a forward path, meaning that path[0] is the start point and path[n] is the end point. The script will find the node that is closest to the player and closest to the target. Of course there is room for improvements, and I am sure there are scenarios where this method wouldn't work. Also, each path node has to be < 15 tiles away from each other, or else it won't find them.

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.