pathfinder object
This method starts a new path search.
vector[] find(int source_x, int source_y, int destination_x, int destination_y, string user_data)
Parameters:
source_x
The x coordinate of the source square that the search starts from.
source_y
The y coordinate of the source square that the search starts from.
destination_x
The x coordinate of the destination square that must be reached.
destination_y
The y coordinate of the destination square that must be reached.
user_data
A string of arbitrary data that will be passed to the callback during the search.
Return value:
An array of vectors indicating the path on success, or an empty array on failure.
Remarks:
Before this method may be called, a map must have been set up and a user callback must have been specified. For more information about the callback function such as its exact signature and its use, see the pathfinder_callback chapter.
The user data allows you to pass along special information to the callback that may be useful while searching. This string will often contain a number which identifies the entity for whom the search is being performed, so that the callback may enforce special rules for the type of creature in question etc.
This method must not be invoked from within the user callback of any pathfinder object.
Please note: You may neither call this method from the constructor of a class that is instanciated in global scope, nor from an overloaded operator method.
Example:
See the main pathfinder chapter and the pathfinding tutorial.