Thread Tools Display Modes
05-16-23, 06:00 AM   #1
Virotic
A Defias Bandit
Join Date: May 2023
Posts: 2
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!
  Reply With Quote
05-17-23, 04:01 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
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.
__________________
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)

Last edited by SDPhantom : 05-17-23 at 04:19 PM.
  Reply With Quote
05-17-23, 06:49 PM   #3
Virotic
A Defias Bandit
Join Date: May 2023
Posts: 2
Thanks very much. This macro works great!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Please Help on PI Macro


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