Crimcinder Posted April 4, 2021 Share Posted April 4, 2021 Hey I was trying to write a script that favors the "closest" node of a resource to gather, either ore or trees, but I ran into the issue of my bot running 60 tiles spaces away because he wanted to go around a fence to a tree that was technically closer after cut the last tree, when there were plenty of other trees closer to the first one he cut. I recognize that I can just make him search for a closer tree as he starts moving but now I've fallen down the rabbit hole of wanting to be able to find the length of a path/route made by webwalking or local walking functions. Is this even possible? From what I can tell when we create a walking event you can call, for example with a WebWalkEvent, the getPositions() method but only after you call execute(WebWalkEvent cleverName). This will of course make the bot take the path, and then return the list of positions of the path it just took. If we can find the list of positions that make up the route before the bot walks it, how can this be done? At this point I'm contemplating writing my own pathing script but I know that's a huge undertaking I was hoping to avoid... Thanks for any help! Quote Link to comment Share on other sites More sharing options...
Camaro Posted April 4, 2021 Share Posted April 4, 2021 You can use the LocalPathFinder class to generate the path your character will take when walking to a position https://osbot.org/api/org/osbot/rs07/api/util/LocalPathFinder.html Although if you just want find the closest object based on the actual path, you can pass the realDistance = true parameter to the closest() method call. This will generate the path and compare lengths for you https://osbot.org/api/org/osbot/rs07/api/EntityAPI.html#closest-boolean-java.lang.String...- 1 Quote Link to comment Share on other sites More sharing options...