openclonk/docs/sdk/script/fn/GetPathLength.xml

45 lines
1.6 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>GetPathLength</title>
<category>Landscape</category>
<version>4.9.1.0 GWE</version>
<syntax>
<rtype>int</rtype>
<params>
<param>
<type>int</type>
<name>startx</name>
<desc>X coordinate of starting position</desc>
</param>
<param>
<type>int</type>
<name>starty</name>
<desc>Y coordinate of starting position</desc>
</param>
<param>
<type>int</type>
<name>endx</name>
<desc>X coordinate of end position</desc>
</param>
<param>
<type>int</type>
<name>endy</name>
<desc>Y coordinate of end position</desc>
</param>
</params>
</syntax>
<desc>Searches for a path from start point to end point using the pathfinding algorithm as used by clonks and returns the length of the found path. Returns 0 if no path was found.</desc>
<examples>
<example>
<code>var iDist = GetPathLength(<funclink>GetX</funclink>(), <funclink>GetY</funclink>(), <funclink>GetX</funclink>(<funclink>FindBase</funclink>(<funclink>GetOwner</funclink>())), <funclink>GetY</funclink>(<funclink>FindBase</funclink>(<funclink>GetOwner</funclink>())));</code>
<text>Determines the distance from an object to its closest friendly base.</text>
</example>
</examples>
</func>
<author>PeterW</author><date>2002-04</date>
</funcs>