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) Code:
Dump: IsSpellInRange |
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) |
Thank you Phanx.
Code:
/dump IsSpellInRange("Mind Blast", "target") -- correct syntax |
IsItemInRange and IsActionInRange (if the action is an item) still doesn't work on friendly npcs, been bugged as far as I can remember.
|
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 09:24 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI