Thread Tools Display Modes
01-21-13, 12:26 AM   #1
Flaer
A Murloc Raider
Join Date: Sep 2006
Posts: 6
Announce to Raid Chat issue

I've been using the mouseover macro below to both whisper the target I cast my battle rez on and announce it to the raid but since 5.1 changed GetRealNumRaidMembers the raid chat announce doesn't work anymore. Does anyone have insight into what I'd need to change to make it work again? I'd also like it to stop the whisper to the target if the spell doesn't fire but I haven't been able to figure that part out. Lastly, I never PvP so the Battleground part can be removed if it's unneeded but I don't know if that's the case. Thanks.

Code:
#showtooltip Raise Ally
/stopmacro [@mouseover,nodead]
/cast [@mouseover,dead,help][@target,dead,help][]Raise Ally
/run SendChatMessage("Raise Ally cast on you. Rise up and fight!!","WHISPER",nil, UnitName("mouseover") or UnitName("target"))
/stopmacro [nogroup][@mouseover,nodead]
/run SendChatMessage("Aethran cast Raise Ally on "..UnitName("mouseover")..".", GetRealNumRaidMembers() > 0 and "RAID" or GetNumRaidMembers() > 0 and "BATTLEGROUND" or GetNumPartyMembers() > 0 and "PARTY" or "SAY")
  Reply With Quote
01-21-13, 03:01 AM   #2
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
Changing the last line to this should work:
Code:
/run SendChatMessage("Aethran cast Raise Ally on "..UnitName("mouseover")..".", UnitInBattleground("player") and "BATTLEGROUND" or IsInRaid() and "RAID" or IsInGroup() and "PARTY" or "SAY")
Note that I haven't tested it.

Edit: Changed to IsInRaid and IsInGroup instead of checking player count.

Last edited by Sharparam : 01-21-13 at 03:03 AM.
  Reply With Quote
01-21-13, 03:04 AM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Change the last line to:
Code:
/run SendChatMessage("Aethran cast Raise Ally on "..UnitName("mouseover")..".", IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or IsInRaid() and "RAID" or IsInGroup() and "PARTY" or "SAY")
Uses IsInRaid/IsInGroup, but also supports the INSTANCE_CHAT channel added in 5.1 for LFG/LFR/battleground groups.
__________________
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.
  Reply With Quote
01-21-13, 03:09 AM   #4
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
Ah, didn't realize IsInGroup took a parameter. I should start checking wowpedia and not just wowprogramming :P
  Reply With Quote
01-21-13, 07:40 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Wowprogramming's documentation tends to be more consistent, but the problem is that it's only updated by a very small group of people (I don't actually know, but I'd guess 1-5 people) while anyone can add info to Wowpedia, so while the documentation can be inconsistent (eg. random functions not documented, writing quality varies wildly, some stuff is really outdated, etc.) it's also more thorough, with lots of notes and examples on usage, bugs, etc.

When in doubt, check the default UI code to verify current API usage. Blizzard is generally pretty bad at writing efficient code, but one thing they are good at is using descriptive variable names.
__________________
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.
  Reply With Quote
01-22-13, 12:10 AM   #6
Flaer
A Murloc Raider
Join Date: Sep 2006
Posts: 6
Awesome, thanks guys!
  Reply With Quote
01-22-13, 01:29 AM   #7
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
Originally Posted by Phanx View Post
the problem is that it's only updated by a very small group of people (I don't actually know, but I'd guess 1-5 people) while anyone can add info to Wowpedia
Just thought I should add, anyone can edit wowprogramming as well (I updated http://wowprogramming.com/docs/api/IsInGroup for example). But it probably doesn't have as many active editors as wowpedia does.
  Reply With Quote
01-22-13, 09:28 PM   #8
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by Phanx View Post
Wowprogramming's documentation tends to be more consistent, but the problem is that it's only updated by a very small group of people (I don't actually know, but I'd guess 1-5 people) while anyone can add info to Wowpedia, so while the documentation can be inconsistent (eg. random functions not documented, writing quality varies wildly, some stuff is really outdated, etc.) it's also more thorough, with lots of notes and examples on usage, bugs, etc.

When in doubt, check the default UI code to verify current API usage. Blizzard is generally pretty bad at writing efficient code, but one thing they are good at is using descriptive variable names.
Anyone can edit WoWProgramming's API documentation - you simply need to make an account and start editing.

Edit: This is what I get for replying before reading later posts. Meh.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
01-26-13, 02:54 PM   #9
Flaer
A Murloc Raider
Join Date: Sep 2006
Posts: 6
Anyone have insight into what change would be needed to stop the whisper if the spell doesn't activate?
  Reply With Quote
01-26-13, 04:28 PM   #10
Farmbuyer
A Cyclonian
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 43
Originally Posted by Flaer View Post
Anyone have insight into what change would be needed to stop the whisper if the spell doesn't activate?
Install AfterCast.
  Reply With Quote
01-31-13, 07:02 PM   #11
Flaer
A Murloc Raider
Join Date: Sep 2006
Posts: 6
Is there a way to do it in the macro instead? It does not need to be limited to the 250 or whatever characters.
  Reply With Quote
02-01-13, 02:27 AM   #12
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
I don't think there's an easy way to incorporate such "advanced" behaviour into the macro alone.

I think you'd be better off making a small addon for it instead, there are events for when a spell succeeds casting.

UNIT_SPELLCAST_SUCCEEDED Fires when a unit's spellcast succeeds, it doesn't seem to provide info on what the spell was cast at, though.

Last edited by Sharparam : 02-01-13 at 02:32 AM.
  Reply With Quote
02-01-13, 07:09 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Flaer View Post
Is there a way to do it in the macro instead? It does not need to be limited to the 250 or whatever characters.
Not really, because in order to do what you're looking to do, you'd need to create a frame, register some events for it to respond to, define a function for it to run whenever the event(s) fired, and have the function check the event arguments to determine what had happened and perform some action accordingly.

If you have some "unlimited macro" addon, you could technically write all of this in a "macro" but then you would just end up with a macro that you would have to run once (and only once) when you logged in to set up the frame and its event handler, so why not just put the same code in an actual addon that you don't have to manually activate?
__________________
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.
  Reply With Quote
02-01-13, 08:20 PM   #14
Flaer
A Murloc Raider
Join Date: Sep 2006
Posts: 6
Makes sense, I was just hopping for something easy such as a stopmacro command. I don't pretend to know anything about coding though. Thanks all.
  Reply With Quote
02-02-13, 04:41 AM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
A /stopmacro-like command would not work for this, because assuming the first line in your macro casts a spell, that spell is still "being cast" while all other lines in the macro are being processed. For example, if you have this macro:

Code:
/cast Albino Drake
/dismount
...you will always end up mounted, because /dismount (like /stopmacro) happens instantly, while /cast takes time, even for "instant cast" spells. There is no "delay" command, so there is no way to tell the macro to wait until the cast action resolves before executing the next line.
__________________
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.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Announce to Raid Chat issue

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