View Single Post
11-15-14, 10:47 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
There's no need to call gsub here:

Code:
/run SendChatMessage ("Rise","WHISPER",nil,GetUnitName("target",1):gsub(" ","",2))
I assume this was intended to remove spaces from realm names, but the game hasn't included those for a while now.

Code:
/run SendChatMessage("Rise","WHISPER",nil,GetUnitName("target",1))
However:

Originally Posted by sptyi View Post
... then whisper to the raised ally to "Rise" after a successful cast.
There's no simple way to do this in a macro. Your current macro sends the message immediately. In order to delay the message, and only send it when the cast succeeds, you would need to create a frame and listen for an event. This isn't something you can do in a normal macro (since there isn't enough room) and probably should not be doing even in a Clique macro (which does give you more room).

Also, things like this are pretty annoying to the recipient -- if I'm getting a battle res, I don't need you to whisper me telling me I got a battle res, because I already know I got a battle res because the game already popped up a giant window in the middle of my screen telling me I got a battle res. You're not telling me anything new; you're just cluttering up my chat frame, and wasting my time by asking me to shift my attention to something totally irrelevant before I shift my attention back to the actually relevant giant window.

But if you really want to do it anyway, instead of letting you copy some terrifyingly badly written garbage from ArenaJunkies, here is the right way (or at least as much as there is a right way to do this) to do it:

Code:
/run if not RaiseAllyNotifier then local f, S, T = CreateFrame("Frame", "RaiseAllyNotifier"), GetSpellInfo(61999) f:RegisterUnitEvent("UNIT_SPELLCAST_SENT","player") f:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED","player") f:SetScript("OnEvent", function(_, e, _, n, _, t) if n == S then if type(t) == "string" then T = t else SendChatMessage("Rise", "WHISPER", nil, T) end end end) end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 11-16-14 at 01:01 PM. Reason: Fixed missing end quote tag
  Reply With Quote