WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Please Help on PI Macro (https://www.wowinterface.com/forums/showthread.php?t=59585)

Virotic 05-16-23 06:00 AM

Please Help on PI Macro
 
Hello,

i need help for a PI Macro. (WOW Classic)



#showtooltip Power Infusion
/cast [target=mouseover] Power Infusion
/script SendChatMessage(("Power Infusion cast on %s"):format(UnitName("mouseover")), "YELL")

But I want to whisper and yell at the same time and a range check + player alive for power infusion.

Thank you very much!

SDPhantom 05-17-23 04:01 PM

I had to cut some corners in order to get it to fit in a macro. The size constraint is 255 characters.

Code:

#showtooltip
/cast [@mouseover] Power Infusion
/run local s,u,f="Power Infusion","mouseover",SendChatMessage;if IsSpellInRange(s,u)==1 then local n=UnitName(u);local m=("%s cast on %s"):format(s,n);f(m,"WHISPER",nil,n);f(m,"YELL");end

Notes:
  • IsSpellInRange() already does target validation checks such as existence, friend/foe, and living. It returns nil for invalid units and 0/1 based on range otherwise.
  • The /cast command will always try to cast Power Infusion since it doesn't have any actual conditions to check, just a target parameter. This made specifying it for #showtooltip redundant.
  • [@mouseover] is shorthand for [target=mouseover]
  • /run is a shorter alias for /script.

Virotic 05-17-23 06:49 PM

Thanks very much. This macro works great!


All times are GMT -6. The time now is 01:09 AM.

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