path Find
path find {x} {y} [z]Also searchable as: path Find · pathfinding · route
path find plans a route from your character to x, y on the facet you are on, and keeps it for
path get and path walk. The character does not move.
Parameters
Section titled “Parameters”| Parameter | Meaning |
|---|---|
x, y |
World position, as in #CharPosX and #CharPosY. |
z |
Optional height. Without it, any height at x, y will do. With it, the route ends within 5 of it (see accuracyz in path set): use it to pick a floor of a building or a dungeon level. |
Results
Section titled “Results”#PathStateisokwhen a route was found. Otherwise:nopath: there is no way there;budgetortimeout: the search gave up before finding one;stopped: you pressed Stop;noclient: no client is attached;nomap: the client’s folder lacks this facet’s map files;error: …: the arguments are wrong.
#PathCntis the number of steps, 0 when there is no route or you are already there.#PathX,#PathY,#PathZare where the route ends, and#PathDiris the direction of its last step.
Details
Section titled “Details”- The route starts where your character stands:
#CharPosX,#CharPosY,#CharPosZ, on facet#CursKind. The way it faces doesn’t matter.path fromstarts it elsewhere. - Arriving. The route ends exactly at
x,y, unlessaccuracyis set (path set). If nothing can stand there (a tree, a rock, a chest), the route ends next to it. - The shortest walk. A diagonal step takes as long as a straight one, so the route is the one with the
fewest steps, and it avoids needless changes of direction (each costs a little, see
turncostinpath set). - The script waits while the route is planned: up to 5 seconds, a fraction of a second for most routes.
Stop interrupts it. A route that can’t exist (an island, a closed room) answers
nopathquickly as long as the goal is near, because the search only looks within 100 tiles around start and goal (margin). - Blocks, avoid areas and links set with
path block,path avoidandpath linkare used. - The map is read from the client’s files. On top of it, the route sees what your client holds around the
character: items on the ground, doors, creatures and, on
client_beta.exe7.0.117.31, the pieces of player houses. Farther away, those are not on it. See What the route knows about. - Places where a walk had a step refused are avoided for a while (
blocktimeinpath set). - A walk
path stepis moving on ends.
Example
Section titled “Example”Plan a route to the Britain bank and walk it:
path find 1434 1699if #PathState <> ok haltpath walkhaltpath walk does all the work. By hand, a script can walk the route a stretch at a time
with the client’s own pathfinder:
path find 1434 1699if #PathState <> ok haltset %i 0while %i < #PathCnt{ set %i %i + 10 if %i > #PathCnt set %i #PathCnt path get %i event PathFind #PathX #PathY #PathZ set %until #SCnt + 10 while #CharPosX <> #PathX || #CharPosY <> #PathY { if #SCnt > %until halt wait 5 }}halt