Thread Tools Display Modes
10-02-22, 01:27 PM   #1
Basil2
An Aku'mai Servant
Join Date: Feb 2015
Posts: 30
Question IsSpellUsable() and Swiftmend spell

IsSpellUsable() for Swiftmend always return false unless you have a unit with hots in your target.

However, WoW UI is more adequate. If you have a macro "/cast [@player] Swiftmend", the macro's spell icon is showed as available when hots are on player (not on target).

So is there any chance to have such behavior with IsSpellUsable()?
__________________
Wow Switcher - super easy multiboxing software for leveling and more...
  Reply With Quote
10-02-22, 07:17 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
Macros and IsUsableSpell() have very different mechanics behind them. ActionButtons (and by extension macros) are handled by C code. We don't get access to those methods.

IsUsableSpell() has very basic capability, like "Can I afford the resource cost?", "Did I just dodge/parry?", etc. It doesn't have the capability to check what buffs/debuffs the target has.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
10-02-22, 08:38 PM   #3
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
You can use SecureCmdOptionParse to evaluate macro conditions for use in an addon.

In your case, you would use local action, target = SecureCmdOptionParse("[@player] Swiftmend") which should return the strings "Swiftmend" and "player" if valid, and both nil if not valid.
  Reply With Quote
10-03-22, 12:52 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
It still doesn't do any buff checking like the OP was asking for. It just checks whether the macro conditions are true and returns the option and target it finds. [@player] always evaluates to true, so it'll always return the spell name and "player" regardless of anything else.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
10-04-22, 11:00 AM   #5
Basil2
An Aku'mai Servant
Join Date: Feb 2015
Posts: 30
Thank you for help, I'll try SecureCmdOptionParse.
__________________
Wow Switcher - super easy multiboxing software for leveling and more...
  Reply With Quote
10-05-22, 01:41 PM   #6
Basil2
An Aku'mai Servant
Join Date: Feb 2015
Posts: 30
Originally Posted by SDPhantom View Post
IsUsableSpell() has very basic capability, like "Can I afford the resource cost?", "Did I just dodge/parry?", etc. It doesn't have the capability to check what buffs/debuffs the target has.
Actually, IsUsableSpell() does check for buffs. But do it for target only.
__________________
Wow Switcher - super easy multiboxing software for leveling and more...
  Reply With Quote
10-05-22, 01:43 PM   #7
Basil2
An Aku'mai Servant
Join Date: Feb 2015
Posts: 30
Originally Posted by Kanegasi View Post
You can use SecureCmdOptionParse to evaluate macro conditions for use in an addon.
I have tried. It looks like that SecureCmdOptionParse() makes parsing only. It doesn't check spell conditions - just extracts spell name and spell destination.
__________________
Wow Switcher - super easy multiboxing software for leveling and more...
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » IsSpellUsable() and Swiftmend spell


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