Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • AStarPathFinder Example


    Flying Low

    Recommended Posts

    When I use the default getWalking().walk() method, it sometimes results in an unusual route to the destination. So I would like to define my own route to take. Is it possible to use AStarPathFinder to create my own route? 

     

    If so, can someone write a quick code snippet, showing how this would be done. Thank you.

    Link to comment
    Share on other sites

    If the tile is in your loaded region, you can do I believe it's um

    LocalPath path = getWalking().getAStarPathFinder().calculate(getLocalPlayer().getTile(),yourDestination);

    then you can do path.walk() or look at all the tiles in the path and whatnot.

     

    If it's outside of your loaded region, then you can't really make your own path to it, you'll need the web walker (Which is what walk() uses)

    But essentially you won't get much of a different path than what walk() gives you, since that's pretty much exactly what walk() does.

     

    If you want to make your own custom path, I would suggest looking at LocalPath, you can add tiles to it and create your own path and then walk that.

    If you want to make your own path, I would suggest writing a quick little script to add all of your tiles as you walk to your destination, and then print out the syntax to add the tiles to a path, so you can just copy/paste the log and put it directly into your script. Then write a little custom walk method that randomizes each tile slightly.

    Link to comment
    Share on other sites

    If the tile is in your loaded region, you can do I believe it's um

    LocalPath<Tile> path = getWalking().getAStarPathFinder().calculate(getLocalPlayer().getTile(),yourDestination);

     

    then you can do path.walk() or look at all the tiles in the path and whatnot.

     

    If it's outside of your loaded region, then you can't really make your own path to it, you'll need the web walker (Which is what walk() uses)

    But essentially you won't get much of a different path than what walk() gives you, since that's pretty much exactly what walk() does.

     

    If you want to make your own custom path, I would suggest looking at LocalPath, you can add tiles to it and create your own path and then walk that.

    If you want to make your own path, I would suggest writing a quick little script to add all of your tiles as you walk to your destination, and then print out the syntax to add the tiles to a path, so you can just copy/paste the log and put it directly into your script. Then write a little custom walk method that randomizes each tile slightly.

     

     

    Thanks, Nezz. This is really helpful!

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.