Thread Tools Display Modes
10-03-14, 01:24 AM   #1
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
IsSpellInRange "empty result"

On live servers, IsSpellInRange is a 1/0 result, and I was checking if it had become a true/false. Testing on my level 90 shadow priest using Mind Blast (spell ID 8092) I get
Code:
Dump: value=IsSpellInRange(8092)
empty result
When passing nothing: /dump IsSpellInRange
Code:
Dump: IsSpellInRange
IsSpellInRange=<function[IsSpellInRange]>
Has this API been temporarily removed, or am I using /dump incorrectly? It doesn't matter if a target is or is not in range, I get the same result.
 
10-03-14, 03:07 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You are using /dump incorrectly based on your intent. In your second example, you're not calling the function and dumping the result -- you're just dumping the function. If you want to call it without any arguments, you still need to write the parentheses:

/dump IsSpellInRange()

If you were actually trying to just check if the function exists, the fact that your first test didn't generate an "attempt to call a nil value" error already told you it exists.

As for the API itself, according to the documentation for IsSpellInRange you must pass a unit token, eg.

/dump IsSpellInRange(8092, "target")

... and "nil" is the expected result if the arguments are invalid (eg. you didn't pass a unit) or don't apply (eg. if you tried to check if a friendly target was in range for a hostile spell)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
10-03-14, 03:28 AM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Thank you Phanx.
Code:
/dump IsSpellInRange("Mind Blast", "target") -- correct syntax
It is also still 1/0 if anyone was wondering. This API has not been converted to true/false as of build 18973.
 
10-03-14, 10:25 AM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
IsItemInRange and IsActionInRange (if the action is an item) still doesn't work on friendly npcs, been bugged as far as I can remember.
 
10-06-14, 06:00 PM   #5
Alternator
A Fallenroot Satyr
 
Alternator's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 20
I was curious about the whole true/false thing as well with this function.

I suspect part of the reason it's still 1/0 is because it's used as a tri-state function as follows:
1 = In Range
0 = Not In Range (but action is ranged type)
nil = Not a Ranged Action/Spell/Item

Of course tri-state can easily be done with true/false/nil as well but it will behave slightly differently in if statements (perhaps a weak reason, but that's my guess on it).
 
 

WoWInterface » Site Forums » Archived Beta Forums » WoD Beta archived threads » IsSpellInRange "empty result"

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off