WoW:API CheckInteractDistance: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 36: Line 36:
   -- we're too far away to follow the target
   -- we're too far away to follow the target
  end;
  end;


----
----
{{Template:WoW API}}
{{WoW API}}
[[Category:API Functions|CheckInteractDistance]]
[[Category:API Unit Functions|CheckInteractDistance]]

Revision as of 05:29, 4 January 2006

CheckInteractDistance

Returns true if you are in range of the specified unit to perform the action specified by distIndex. Otherwise, returns false.


Arguments
(String unit, Int distIndex)
unit
The unit to query (e.g. "target", "party1", "pet", "player")
distIndex
A value 1-4
1 = Inspect, 5 yards
2 = Trade, approx 10 yards
3 = Duel, approx 10 yards
4 = Follow, approx 28 yards

Returns
Boolean canInteract
canInteract
True if in range to perform the action. Otherwise, false.

Notes
If "unit" is a hostile unit, the return values are the same. But you obviously won't be able to do things like Trade.
There may also be more values for distIndex that we don't know about.

Example
if ( CheckInteractDistance("target", 4) ) then
  FollowUnit("target");
else
  -- we're too far away to follow the target
end;



Template:WoW API