Jump to content

Blind Walk


Recommended Posts

Is the simple task of walking to a tile using OSBot frustrating to anyone else? Maybe I'm using the wrong walking method that everyone else uses but my bots often just stand around when telling it to walk to a tile. I think this is because OSBot will not move if you tell it to walk to a tile that isn't in the loaded area or if the tile is unreachable. I've tried walk(), walkExact(), walkMinimap(), walkMainScreen() and I think they all require a loaded and reachable tile. Is there a reason for this? It's frustrating and I've resorted to using paths for everything which is annoying. I don't know about everyone else, but I'm used to the ability of specifying any tile and having the bot actually move towards it.


So here's a simple method that takes a step in the direction of the specified tile even if it's unreachable or unloaded. Using it in the script's loop will cause it to repeatedly take steps until it reaches the destination tile. It walks in a straight line so maybe it's not the best in terms of bot detection.

public boolean blindWalk(Position position) {
    final int STEP_SIZE = 15;
    Player myPlayer = client.getMyPlayer();
    try {
        if (position.distance(myPlayer.getPosition()) < STEP_SIZE) {
            return client.moveMouseTo(new MinimapTileDestination(bot, position), false, true, false);
        int myX = myPlayer.getX();
        int myY = myPlayer.getY();
        int posX = position.getX();
        int posY = position.getY();
        double deltaX = Math.abs(posX - myX);
        double deltaY = Math.abs(posY - myY);
        double angle = Math.atan(deltaY / deltaX);
        int xModifier = posX < myX ? -1 : 1;
        int yModifier = posY < myY ? -1 : 1;
        Position newPosition = new Position(myX + (int)(Math.cos(angle) * STEP_SIZE) * xModifier, myY + (int)(Math.sin(angle) * STEP_SIZE) * yModifier, 0);
        return client.moveMouseTo(new MinimapTileDestination(bot, newPosition), false, true, false);
    catch (Exception e) {
       return false;
Edited by pork
Link to comment
Share on other sites

Yes i used to hace that problem too, the bot would try to walk somewhere and sometimes it would try to click the same destination multiple times...

That was fixed using walkMinimap() instead of walk, now i just iterate through the path and it works like a charm.

Edit: But it's good to have a custom method, it differs your script from others, preventing bans.

Edited by Markoz
Link to comment
Share on other sites

OSBot should really implement a new exception surrounding walking:

  • PositionOutOfReachException - Destination tile exceeds the mini-map's visible radius. (bout 15~ tiles, I think.)
  • UnreachableDestinationException - Paths can't be generated (run-time) between two positions. 
  • IncompleteTraversalException - Moving to the destination tile was unsuccessful.

Each exception should provide a sufficient enough information for developers to try to 're-correct' prior movements. Your code would be a solution for the first exception idea.


I wrote the exceptions in this order to represent the linear checks that would be performed, and I believe this would provide OSBot with better walk handling.

Edited by liverare
Link to comment
Share on other sites

This topic is now closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...