WoW:API CheckInteractDistance: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
(Update values using tab-targeting method)
Line 10: Line 10:
:;unit : The unit to query (e.g. "target", "party1", "pet", "player")
:;unit : The unit to query (e.g. "target", "party1", "pet", "player")
:;distIndex : A value 1-4:
:;distIndex : A value 1-4:
:::1 = Inspect, ~28 yards (prior to Patch 2.1 this was 11.11 yards)
:::1 = Inspect, 30 yards
:::2 = Trade, ~7 yards
:::2 = Trade, 11.11 yards
:::3 = Duel, ~7 yards
:::3 = Duel, 9.9 yards
:::4 = Follow, ~28 yards
:::4 = Follow, 30 yards


----
----
Line 26: Line 26:


:There may also be more values for distIndex that we don't know about.
:There may also be more values for distIndex that we don't know about.
:Patch 2.1 changed trade distance to 11.11 yards, but this was later reverted.


----
----

Revision as of 11:04, 11 November 2007

WoW API < CheckInteractDistance

Returns 1 if you are in range of the specified unit to perform the action specified by distIndex (returns nil otherwise).


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

Returns
canInteract
If in range to perform the action, 1 (true). Otherwise, nil (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.
Patch 2.1 changed trade distance to 11.11 yards, but this was later reverted.

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