WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Need help with DK Raise Ally macro (https://www.wowinterface.com/forums/showthread.php?t=50473)

sptyi 11-15-14 11:24 AM

Need help with DK Raise Ally macro
 
I'm using the Clique Addon. What I want to occur is when I mouseover a dead ally in a party/raid/instance, and press a hotkey (set in clique) it will put "Brezzing [target]" in a group appropriate chat, begin to Raise Ally, then whisper to the raised ally to "Rise" after a successful cast.

I am a complete WOW macro noob and have pieced this together from multiple sources, however I am not sure it will work as intended or if there is a more efficient way to complete the task. Thank you for your help beforehand.

Code:

/run local c=IsInGroup(2) and "INSTANCE_CHAT" or IsInRaid() and "RAID" or IsInGroup(1) and "PARTY" if c then SendChatMessage("Brezzing %t",c) end
/cast [@mousover]Raise Ally
/run SendChatMessage ("Rise","WHISPER",nil,GetUnitName("target",1):gsub(" ","",2))


Phanx 11-15-14 10:47 PM

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:

Quote:

Originally Posted by sptyi (Post 300470)
... 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

sptyi 11-16-14 05:47 AM

Okay, I definitely see your point. I'll be sure to leave off the whisper. Thanks for your help.

sptyi 11-17-14 08:08 AM

This is what I have ended up with:

Code:

/use [@mouseover,dead]Raise Ally
/focus [@mouseover]
/run local c=IsInGroup(2) and "INSTANCE_CHAT" or IsInRaid() and "RAID" or IsInGroup(1) and "PARTY" if c then SendChatMessage("Brezzing %f",c) end
/clearfocus


Phanx 11-17-14 08:16 AM

That'll work, though it would probably be better not to have it (temporarily) change your focus, since that will make it unusable with actual focus macros. Just use UnitName("mouseover") to get the name of your current mouseover unit.

Code:

/use [@mouseover,help,dead] Raise Ally
/stopmacro [@mouseover,nohelp][@mouseover,nodead]
/run local c=IsInGroup(2)and "INSTANCE_CHAT" or IsInRaid()and "RAID" or IsInGroup()and "PARTY" if c then SendChatMessage("Brezzing "..UnitName("mouseover"),c)end

I also added checks so it won't try to cast on hostile targets, and won't send a message if your mouseover target is hostile or not dead.

sptyi 11-17-14 09:32 AM

That is perfect, once again, thank you very much for your help!


All times are GMT -6. The time now is 12:44 AM.

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