is there a non-linear Game.map.getRoomLinearDistance



  • Hi all,

    Just wondering if there's a function that can tell me how many room crossings are required to go from room A to room B.

    A function that sort of works, but ignores walls and diagonals:

    Game.map.getRoomLinearDistance("W48N71", "W47N71")

    I would be expecting this to be 5 instead of 1, since you have to go S E E N W.

    Alternatively if no such function exists can anyone point me to a function that calculates walk distance required between these two rooms.

    I am trying to use my scouts to determine if a remote mining source is worth it or if a room is far enough to expand to.

    Thanks,

    Primoz



  • You are looking for Game.map.findRoute.

    http://support.screeps.com/hc/en-us/articles/203079191-Map#findRoute

    To calculate the walking distance between 2 points use Pathfinder. Such as the distance between new RoomPosition(25, 25, room1) and RoomPosition(25, 25, room2).



  • Thank you, strange how i managed to miss that function even though i was in the right area :s