<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.easyuo.com/index.php?action=history&amp;feed=atom&amp;title=Event_PathFind</id>
		<title>Event PathFind - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.easyuo.com/index.php?action=history&amp;feed=atom&amp;title=Event_PathFind"/>
		<link rel="alternate" type="text/html" href="http://wiki.easyuo.com/index.php?title=Event_PathFind&amp;action=history"/>
		<updated>2026-04-30T01:56:34Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>http://wiki.easyuo.com/index.php?title=Event_PathFind&amp;diff=5451&amp;oldid=prev</id>
		<title>Seg at 18:00, 4 November 2007</title>
		<link rel="alternate" type="text/html" href="http://wiki.easyuo.com/index.php?title=Event_PathFind&amp;diff=5451&amp;oldid=prev"/>
				<updated>2007-11-04T18:00:26Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{command header|Event}}&lt;br /&gt;
&lt;br /&gt;
{{body|event PathFind {X-Coordinate} {Y-Coordinate} [Z-Coordinate]|The event PathFind moves you to the position given by the coordinates. If the Z coordinate os omitted, it is assumed to be -1.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note|&lt;br /&gt;
*Please note that your script will keep on executing while the character is moving. Take a look at the example below which mimics the way that the move command works.&lt;br /&gt;
*The event PathFind command only works within one screen. If you need to move longer you need to break up the path in to several calls.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;===========================================================&lt;br /&gt;
; Name: pathFind&lt;br /&gt;
; Author: ScriptFellow (the.WZA)&lt;br /&gt;
; Parameters: %1 = X&lt;br /&gt;
;             %2 = Y&lt;br /&gt;
;             %3 = Z&lt;br /&gt;
;             %4 = tolerance&lt;br /&gt;
;             %5 = timeout (in seconds)&lt;br /&gt;
; Purpose: Pathfind to the given coordinates&lt;br /&gt;
; Return: %return (#true or #false )&lt;br /&gt;
;-----------------------------------------------------------&lt;br /&gt;
sub pathFind&lt;br /&gt;
set %_x %1&lt;br /&gt;
set %_y %2&lt;br /&gt;
if %0 &amp;lt;= 2 || %2 = N/A&lt;br /&gt;
   set %_z -1&lt;br /&gt;
else&lt;br /&gt;
   set %_z %3&lt;br /&gt;
if %0 &amp;lt;= 3 || %3 = N/A&lt;br /&gt;
   set %_tolerance 0&lt;br /&gt;
else&lt;br /&gt;
   set %_tolerance %4&lt;br /&gt;
if %0 &amp;lt;= 4&lt;br /&gt;
   set %_endTime #sCnt + 15&lt;br /&gt;
else&lt;br /&gt;
   set %_endTime #sCnt + %5&lt;br /&gt;
set %return #false&lt;br /&gt;
deleteJournal&lt;br /&gt;
scanJournal 2&lt;br /&gt;
event PathFind %_x %_y %_z&lt;br /&gt;
_pathFindScanAgain:&lt;br /&gt;
scanJournal 1&lt;br /&gt;
if pathfinding in #journal&lt;br /&gt;
   goto _pathFindOkay&lt;br /&gt;
if can't_get_there in #journal || #sCnt &amp;gt; %_endTime&lt;br /&gt;
   return&lt;br /&gt;
goto _pathFindScanAgain&lt;br /&gt;
_pathFindOkay:&lt;br /&gt;
gosub _pathFindDist %_x %_y %_z #charPosX #charPosY #charPosZ&lt;br /&gt;
set %return %return &amp;lt;= %_tolerance&lt;br /&gt;
if %return&lt;br /&gt;
{&lt;br /&gt;
   if %_tolerance &amp;gt; 0&lt;br /&gt;
   {&lt;br /&gt;
      set %1 #cliLeft + #cliXRes / 2&lt;br /&gt;
      set %2 #cliTop + #cliYRes / 2&lt;br /&gt;
      if #charDir &amp;lt; 3&lt;br /&gt;
          set %1 %1 + 1&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
         if #charDir &amp;gt; 3 &amp;amp;&amp;amp; #charDir &amp;lt; 7&lt;br /&gt;
            set %1 %1 - 1&lt;br /&gt;
      }&lt;br /&gt;
      if #charDir = 0 || #charDir = 6&lt;br /&gt;
         set %2 %2 - 1&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
         if #charDir &amp;gt; 1 &amp;amp;&amp;amp; #charDir &amp;lt; 5&lt;br /&gt;
            set %2 %2 + 1 &lt;br /&gt;
      }&lt;br /&gt;
      click %1 %2 R&lt;br /&gt;
   }&lt;br /&gt;
   return&lt;br /&gt;
}&lt;br /&gt;
if #sCnt &amp;gt; %_endTime&lt;br /&gt;
   return&lt;br /&gt;
goto _pathFindOkay&lt;br /&gt;
&lt;br /&gt;
sub _pathFindDist&lt;br /&gt;
set %1 %1 - %4 abs&lt;br /&gt;
set %2 %2 - %5 abs&lt;br /&gt;
set %3 %3 - %6 abs&lt;br /&gt;
gosub max %1 %2 %3&lt;br /&gt;
return&lt;br /&gt;
&lt;br /&gt;
; to be defined&lt;br /&gt;
sub max&lt;br /&gt;
set %return %1&lt;br /&gt;
for %_idx 2 %0&lt;br /&gt;
{&lt;br /&gt;
   if % . %_idx &amp;gt; %return&lt;br /&gt;
   set %return % . %_idx&lt;br /&gt;
}&lt;br /&gt;
return&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
{{Event}}&lt;/div&gt;</summary>
		<author><name>Seg</name></author>	</entry>

	</feed>