WoW:API UnitInRange: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{wowapi}} __NOTOC__ <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> Returns 1 if the unit is in range (40yds) and "Line of Sig...") |
m (Move page script moved page API UnitInRange to API UnitInRange without leaving a redirect) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> | <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> | ||
Returns 1 if the unit is in range (40yds) and | Returns 1 if the unit is in range of most helpful spells (40yds) and in a group / raid with you, otherwise nil. | ||
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args --> | <!-- List return values and arguments as well as function name, follow Blizzard usage convention for args --> | ||
Line 9: | Line 9: | ||
== Arguments == | == Arguments == | ||
<!-- List each argument, together with its type --> | <!-- List each argument, together with its type --> | ||
;unit : String - [[unitId]] to check. | ;unit | ||
: String - [[unitId]] to check. | |||
== Returns == | == Returns == | ||
<!-- List each return value, together with its type --> | <!-- List each return value, together with its type --> | ||
;isTrue : 1 or nil | ;isTrue | ||
: 1 or nil | |||
== Example == | == Example == | ||
Line 19: | Line 21: | ||
if UnitInRange("target") then | if UnitInRange("target") then | ||
print(UnitName("target") .. " is 40 yds away.") | print(UnitName("target") .. " is 40 yds away.") | ||
else | |||
print(UnitName("target") .. " is not in range!") | print(UnitName("target") .. " is not in range!") | ||
end | end | ||
Line 31: | Line 33: | ||
<!-- Details not appropriate for the main description can go here. | <!-- Details not appropriate for the main description can go here. | ||
REMOVE the section if you're just going to restate the intro line! --> | REMOVE the section if you're just going to restate the intro line! --> | ||
: Returns 'false' for any unit not in party or raid. | |||
: Will return nil for hostile units. | : Will return nil for hostile units. | ||
==See also== | ==See also== | ||
* [[API IsSpellInRange]] | * [[API IsSpellInRange]] |
Latest revision as of 04:47, 15 August 2023
← WoW API < UnitInRange
Returns 1 if the unit is in range of most helpful spells (40yds) and in a group / raid with you, otherwise nil.
isTrue = UnitInRange("unit")
Arguments[edit]
- unit
- String - unitId to check.
Returns[edit]
- isTrue
- 1 or nil
Example[edit]
if UnitInRange("target") then print(UnitName("target") .. " is 40 yds away.") else print(UnitName("target") .. " is not in range!") end
Result[edit]
FarfarawayDPS is 40 yds away. FarfarawayDPS is not in range!
Details[edit]
- Returns 'false' for any unit not in party or raid.
- Will return nil for hostile units.