WoWInterface

WoWInterface (http://www.wowinterface.com/forums/index.php)
-   Macro Help (http://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Only /say if ability is off CD? (http://www.wowinterface.com/forums/showthread.php?t=34496)

SannaSK 08-16-10 04:25 PM

Only /say if ability is off CD?
 
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.

So, instead of spamming
Shield Wall: -60%dmg 12 sec
Shield Wall: -60%dmg 12 sec
Shield Wall: -60%dmg 12 sec
Shield Wall: -60%dmg 12 sec
Shield Wall: -60%dmg 12 sec
Shield Wall: -60%dmg 12 sec
Shield Wall: -60%dmg 12 sec

and making the healers wonder if it's working at all, it would only happen once.

Simple macros I get. This, I don't get enough to figure out out : x. Thanks in advance for any help \o !

-- Sanna

ra1d3n 08-16-10 05:01 PM

Code:

/script local _, duration, _ = GetSpellCooldown("Shield Wall");  if duration == 0 then SendChatMessage("Shield Wall: -60%dmg 12 sec") end

/use Shield Wall

You're welcome. :)

Motig 08-16-10 05:02 PM

#showtooltip
/cast Shield Wall
/script if select(2, GetSpellCooldown('Shield Wall')) == 0 then SendChatMessage("Shield Wall: -60%dmg 12 sec", 'SAY'); end

Edit:
Awww beaten to it!

SannaSK 08-16-10 09:35 PM

Many cheers to the both of you! Thanks a ton! No way in tar would I have been able to put that together on my own. Yaaay \o/

-- Sanna

ra1d3n 08-16-10 10:18 PM

As I said, you're welcome. ;)

Quote:

Originally Posted by Motig (Post 202766)
#showtooltip
/cast Shield Wall
/script if select(2, GetSpellCooldown('Shield Wall')) == 0 then SendChatMessage("Shield Wall: -60%dmg 12 sec", 'SAY'); end

Edit:
Awww beaten to it!

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.

Conclusion:
Code:

#showtooltip
/script if select(2, GetSpellCooldown('Shield Wall')) == 0 then SendChatMessage("Shield Wall: -60%dmg 12 sec") end
/cast Shield Wall

Warning, haven't tested this last iteration. :)

Motig 08-17-10 06:05 AM

Ah yeah that's pretty stupid :p I must've moved it up after testing it! I figured I'd include the channel name in case the OP wanted to change it sometime in the future though.

Vlad 08-26-10 04:07 AM

Improved?

Code:

#showtooltip
/run local s=GetSpellInfo(871)if HasFullControl()and IsUsableSpell(s)and not select(2,GetSpellCooldown(s))then SendChatMessage(s..": -60%dmg 12sec","SAY")end
/cast Shield Wall


v6o 08-26-10 04:49 AM

Why use select(2, xxx) at all?

The first argument is 0 if it's not on cooldown.

Quote:

Number - The time when the cooldown started (as returned by GetTime()); zero if no cooldown; current time if (enabled == 0).

Motig 08-26-10 07:55 AM

Quote:

Originally Posted by v6o (Post 203883)
Why use select(2, xxx) at all?

The first argument is 0 if it's not on cooldown.

That only worked the first time when I tried it.

v6o 08-26-10 08:20 AM

Quote:

Originally Posted by Motig (Post 203897)
That only worked the first time when I tried it.

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

xelepart 08-26-10 09:26 AM

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?

This is obviously untested, but here's the basic idea:
/script wasNotOnCooldown=(GetSpellCooldown(s)==0)
/cast Shield Wall
/script if (wasNotOnCooldown&& GetSpellCooldown(s)~=0) SendChatMessage...

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.

d87 08-26-10 09:58 PM

Quote:

/cast Shield Wall
/script UnitAura("player","Shield Wall",nil,"HELPFUL") and SendChatMessage(...
i guess this could work, but maybe it'll require 2 clicks

zohar101 08-29-10 09:41 AM

From the ui macro wow forums:)

#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

Here's the original thread:
http://forums.worldofwarcraft.com/th...sid=1&pageNo=1

Phanx 08-29-10 05:58 PM

If you want to go that route, why not just put in 30 seconds of extra effort and make it a real addon?

mentalnutsy 09-04-10 02:44 PM

Quote:

Originally Posted by Phanx (Post 204233)
If you want to go that route, why not just put in 30 seconds of extra effort and make it a real addon?


If you want an addon try Nutty War Announce. It is aimed at warriors and does loads of announcements. Fully configurable also.

http://www.wowinterface.com/download...rAnnounce.html


All times are GMT -6. The time now is 05:24 PM.

vBulletin © 2014, Jelsoft Enterprises Ltd
©2012 ZAM Network LLC