Afternoon, everyone. I read the wowwiki macro pages, and attempted to Google for an answer to this as well as search this forum, buuut I couldn't even figure out good search terms. : x.

My warrior has a macro something like

/use Shield Wall
/s Shield Wall: -60%dmg 12 sec

Problem is, if SW is still on cd and I jam the button, my /say goes off anyway. Is there a way to make the /say only happen if SW is off CD and gets used? IE, if it's 3 sec from being available, I could jam the button multiple times, but the whole key would only work (use SW and then do the /say) the one time when SW comes off CD and gets used, and then the key doesn't work again now that SW has been used.

Your code is actually better (shorter), but you need to execute the script before the /cast or else it will never evaluate to "true". Because after the /cast it always is on cooldown :D
Further, specifying the channel and ending a line with the semicolon just eats up macro space and is not necessary.

Question is whether we can force a variable to be globally (or macro-level) bound from a /script call, and I don't remember the WoW-Lua variable bounding rules for macros... :)

Motig

08-26-10 10:23 AM

Quote:

Originally Posted by v6o
(Post 203901)

Weird. I went back and tried 8 second long and 120 second long cooldowns and it always resets the returned values to 0, 0, 1

(As it should)

<Edit>

Oh should have said that instead of
not select(2,GetSpellCooldown(s))
you use
GetSpellCooldown(s)==0

You're right I just tested it again with Barkskin, I must've done something wrong on my first test. So yeah the select(2, ...) is useless.

v6o

08-26-10 06:40 PM

Quote:

Originally Posted by xelepart
(Post 203907)

Not that it matters, but I liked the idea of the "improved?" version, where it checks if you can cast it. Would it be possible to check if you *did* cast it?:)

If you're gonna take it any further you might as well monitor the combat log for the cast instead. That's what I do with my announcements.

Seerah

08-26-10 08:34 PM

And a macro cannot do anything like this - you would need an addon. An entire macro and its scripts are run all in a single frame draw (if you have 60fps, it takes 1/60th of a second to run it). There is absolutely no way for a macro to know if the spell it contains WAS successful.

#showtooltip
/cast Growl
/run if not yyz then yyz=CreateFrame("Frame")yyz:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")yyz:SetScript("OnEvent",function(a,b,c,d,e)if c=="player"and d=="Growl"then SendChatMessage("AEONFLUX IS A ****TY NAME TAUNTED")end end)end