WoW:API ActionHasRange: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (→Example) |
||
Line 1: | Line 1: | ||
{{wowapi}} | {{wowapi}} | ||
Returns true if the action has a numeric range requirement. | Returns true if the action has a numeric range requirement. | ||
local hasRange = ActionHasRange(slotID) | |||
== Parameters == | == Parameters == | ||
=== Arguments === | |||
* slotID (number) - The [[actionSlot|slot ID]] to test | |||
=== Returns === | |||
* hasRange (boolean) - True if the specified action has a numeric range requirement | |||
== Example == | == Example == | ||
/script if ActionHasRange(1) then if IsActionInRange(1) then ChatFrame1:AddMessage("Action 1 is in range!"); end end | |||
/script if | |||
;Result | |||
"Action 1 is in range!" | "Action 1 is in range!" | ||
The above message will be printed if the action in slot 1 has a numeric range requirement and you are within range of the target (or if there is no target; see [[API IsActionInRange|IsActionInRange]]). | |||
== Details == | |||
This function returns true if the action in the specified slot ID has a numeric range requirement as shown in the action's tooltip, e.g. Fire Blast has a numeric range of 20 yards. For actions like Attack which have no numeric range requirement in their tooltip (even though they only work within a certain range), this function will return false. |
Revision as of 03:39, 14 February 2021
Returns true if the action has a numeric range requirement.
local hasRange = ActionHasRange(slotID)
Parameters
Arguments
- slotID (number) - The slot ID to test
Returns
- hasRange (boolean) - True if the specified action has a numeric range requirement
Example
/script if ActionHasRange(1) then if IsActionInRange(1) then ChatFrame1:AddMessage("Action 1 is in range!"); end end
- Result
"Action 1 is in range!"
The above message will be printed if the action in slot 1 has a numeric range requirement and you are within range of the target (or if there is no target; see IsActionInRange).
Details
This function returns true if the action in the specified slot ID has a numeric range requirement as shown in the action's tooltip, e.g. Fire Blast has a numeric range of 20 yards. For actions like Attack which have no numeric range requirement in their tooltip (even though they only work within a certain range), this function will return false.