Power Infusion Macro that supports character-realm whispers

Does anyone know of a way to code the Power Infusion macro to whisper someone that they have been granted Power infusion?

Here is what I have so far which doesn’t support “playername-realm” so the whisper doesn’t go through.

#showtooltip
/cast [target=mouseover] Power Infusion
/script local u,pi="mouseover","Power Infusion";if IsSpellInRange(pi,u)==1 and GetSpellCooldown(pi)==0 then SendChatMessage("You just got "..GetSpellLink(pi).."!","WHISPER",nil,UnitFullName(u)) end

EDIT Nvm I figured it out.

I fouind a nice WOWpedia site that gave me some information on how to gather player-realm information and just updated macro with that.

GetUnitName("target", true)

Here is the finished working macro in case someone else wants it.

/cast [target=mouseover] Power Infusion
/script local u,pi="mouseover","Power Infusion";if IsSpellInRange(pi,u)==1 and GetSpellCooldown(pi)==0 then SendChatMessage("You just got "..GetSpellLink(pi).."!","WHISPER",nil,GetUnitName(u, true)) end

Source https://wowpedia.fandom.com/wiki/API_UnitName

1 Like