Difference between revisions of "Event PathFind"
From Wiki
(No difference)
|
Latest revision as of 10:00, 4 November 2007
Synopsis
event PathFind {X-Coordinate} {Y-Coordinate} [Z-Coordinate]
Description
The event PathFind moves you to the position given by the coordinates. If the Z coordinate os omitted, it is assumed to be -1.
| Note: |
|
Example
;===========================================================
; Name: pathFind
; Author: ScriptFellow (the.WZA)
; Parameters: %1 = X
; %2 = Y
; %3 = Z
; %4 = tolerance
; %5 = timeout (in seconds)
; Purpose: Pathfind to the given coordinates
; Return: %return (#true or #false )
;-----------------------------------------------------------
sub pathFind
set %_x %1
set %_y %2
if %0 <= 2 || %2 = N/A
set %_z -1
else
set %_z %3
if %0 <= 3 || %3 = N/A
set %_tolerance 0
else
set %_tolerance %4
if %0 <= 4
set %_endTime #sCnt + 15
else
set %_endTime #sCnt + %5
set %return #false
deleteJournal
scanJournal 2
event PathFind %_x %_y %_z
_pathFindScanAgain:
scanJournal 1
if pathfinding in #journal
goto _pathFindOkay
if can't_get_there in #journal || #sCnt > %_endTime
return
goto _pathFindScanAgain
_pathFindOkay:
gosub _pathFindDist %_x %_y %_z #charPosX #charPosY #charPosZ
set %return %return <= %_tolerance
if %return
{
if %_tolerance > 0
{
set %1 #cliLeft + #cliXRes / 2
set %2 #cliTop + #cliYRes / 2
if #charDir < 3
set %1 %1 + 1
else
{
if #charDir > 3 && #charDir < 7
set %1 %1 - 1
}
if #charDir = 0 || #charDir = 6
set %2 %2 - 1
else
{
if #charDir > 1 && #charDir < 5
set %2 %2 + 1
}
click %1 %2 R
}
return
}
if #sCnt > %_endTime
return
goto _pathFindOkay
sub _pathFindDist
set %1 %1 - %4 abs
set %2 %2 - %5 abs
set %3 %3 - %6 abs
gosub max %1 %2 %3
return
; to be defined
sub max
set %return %1
for %_idx 2 %0
{
if % . %_idx > %return
set %return % . %_idx
}
return
See Also
Event
- Event commands cause the Ultima Online client to use one of its available internal macros.
| event Drag | Drags an object |
| event ExMsg | Shows a message over the object given by the ID |
| event Macro | Performs a UO internal macro |
| event PathFind | Moves you to a specified position if it is possible |
| event Property | Reads the property description of an item |
| event SkillLock | Changes the skill locks on the different skills |
| event Sleep | Suspends the client for a specified time |
| event SysMessage | Outputs text to the client as a system message |