WoW:API IsItemInRange: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(initial sketchy version)
 
m (Move page script moved page API IsItemInRange to API IsItemInRange without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{wowapi}}
{{wowapi}}__NOTOC__
Returns if you are in range of the specified unit to use the specified item.
result = IsItemInRange("itemName" or "itemLink", "unit")


Returns 1 if you are in range of the specified unit to use the item specified by item, 0 if not, nil if the target is invalid, etc.
== Parameters ==
=== Arguments ===
:(itemId or "itemName" or "[[itemLink]]", "[[unitId|unit]]")


----
:;itemId : Integer - The numeric ID of the item. ie. 12345
;''Arguments''
:;itemName : String - The Name of the Item, e.g. "Heavy Silk Bandage"
:;[[itemLink]] : String - The [[itemLink]], when Shift-Clicking items.
:;[[unitId|unit]] : String - The [[unitId]] for which the check is done.


:(String item, String unit)
=== Returns ===
:;result : Integer - If in range to perform the action ''1''. Otherwise ''0''. ''nil'' if the action is invalid.


:;item : The item to use (e.g. "Heavy Silk Bandage")
== Example ==
:;unit : The unit to query (e.g. "target", "party1", "pet", "player")
 
----
Common Ranges
::::Bandages: 18 yards
 
----
;''Returns''
 
:;If in range to perform the action, 1 (true).  Otherwise, 0 (false), or nil (false) if the action is invalid.
 
----
;''Notes''
 
----
;''Example''
  if ( IsItemInRange("Heavy Silk Bandage","target") ) then
  if ( IsItemInRange("Heavy Silk Bandage","target") ) then
   -- light up a part of the interface
   -- light up a part of the interface
Line 30: Line 21:
   -- darken
   -- darken
  end
  end
== Common Ranges ==
Bandages: 18 yards

Latest revision as of 04:46, 15 August 2023

WoW API < IsItemInRange

Returns if you are in range of the specified unit to use the specified item.

result = IsItemInRange("itemName" or "itemLink", "unit")

Parameters[edit]

Arguments[edit]

(itemId or "itemName" or "itemLink", "unit")
itemId
Integer - The numeric ID of the item. ie. 12345
itemName
String - The Name of the Item, e.g. "Heavy Silk Bandage"
itemLink
String - The itemLink, when Shift-Clicking items.
unit
String - The unitId for which the check is done.

Returns[edit]

result
Integer - If in range to perform the action 1. Otherwise 0. nil if the action is invalid.

Example[edit]

if ( IsItemInRange("Heavy Silk Bandage","target") ) then
  -- light up a part of the interface
else
  -- darken
end

Common Ranges[edit]

Bandages: 18 yards