WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   WoD Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=151)
-   -   IsSpellInRange "empty result" (https://www.wowinterface.com/forums/showthread.php?t=50003)

myrroddin 10-03-14 01:24 AM

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.

Phanx 10-03-14 03:07 AM

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)

myrroddin 10-03-14 03:28 AM

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.

p3lim 10-03-14 10:25 AM

IsItemInRange and IsActionInRange (if the action is an item) still doesn't work on friendly npcs, been bugged as far as I can remember.

Alternator 10-06-14 06:00 PM

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).


All times are GMT -6. The time now is 07:13 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI