Thread Tools Display Modes
08-16-10, 04:25 PM   #1
SannaSK
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
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
  Reply With Quote
08-16-10, 05:01 PM   #2
ra1d3n
A Cyclonian
 
ra1d3n's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 44
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.
  Reply With Quote
08-16-10, 05:02 PM   #3
Motig
A Fallenroot Satyr
 
Motig's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 23
#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!

Last edited by Motig : 08-16-10 at 05:07 PM.
  Reply With Quote
08-16-10, 09:35 PM   #4
SannaSK
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
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
  Reply With Quote
08-16-10, 10:18 PM   #5
ra1d3n
A Cyclonian
 
ra1d3n's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 44
As I said, you're welcome.

Originally Posted by Motig View Post
#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
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.
  Reply With Quote
08-17-10, 06:05 AM   #6
Motig
A Fallenroot Satyr
 
Motig's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 23
Ah yeah that's pretty stupid 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.
  Reply With Quote
08-26-10, 04:07 AM   #7
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
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
  Reply With Quote
08-26-10, 04:49 AM   #8
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Why use select(2, xxx) at all?

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

Number - The time when the cooldown started (as returned by GetTime()); zero if no cooldown; current time if (enabled == 0).
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
08-26-10, 07:55 AM   #9
Motig
A Fallenroot Satyr
 
Motig's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 23
Originally Posted by v6o View Post
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.
  Reply With Quote
08-26-10, 08:20 AM   #10
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by Motig View Post
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
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 08-26-10 at 08:29 AM.
  Reply With Quote
08-26-10, 09:26 AM   #11
xelepart
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 18
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...
  Reply With Quote
08-26-10, 10:23 AM   #12
Motig
A Fallenroot Satyr
 
Motig's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 23
Originally Posted by v6o View Post
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.
  Reply With Quote
08-26-10, 06:40 PM   #13
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by xelepart View Post
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.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
08-26-10, 08:34 PM   #14
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-26-10, 09:58 PM   #15
d87
A Chromatic Dragonspawn
 
d87's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 163
/cast Shield Wall
/script UnitAura("player","Shield Wall",nil,"HELPFUL") and SendChatMessage(...
i guess this could work, but maybe it'll require 2 clicks
  Reply With Quote
08-29-10, 09:41 AM   #16
zohar101
A Cyclonian
 
zohar101's Avatar
Join Date: Jan 2010
Posts: 43
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
  Reply With Quote
08-29-10, 05:58 PM   #17
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
If you want to go that route, why not just put in 30 seconds of extra effort and make it a real addon?
  Reply With Quote
09-04-10, 02:44 PM   #18
mentalnutsy
A Cyclonian
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 47
Originally Posted by Phanx View Post
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
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Only /say if ability is off CD?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off