WoWInterface

WoWInterface (http://www.wowinterface.com/forums/index.php)
-   Macro Help (http://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Announce to Raid Chat issue (http://www.wowinterface.com/forums/showthread.php?t=45704)

Flaer 01-20-13 11:26 PM

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")


Sharparam 01-21-13 02:01 AM

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.

Phanx 01-21-13 02:04 AM

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.

Sharparam 01-21-13 02:09 AM

Ah, didn't realize IsInGroup took a parameter. I should start checking wowpedia and not just wowprogramming :P

Phanx 01-21-13 06:40 PM

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.

Flaer 01-21-13 11:10 PM

Awesome, thanks guys!

Sharparam 01-22-13 12:29 AM

Quote:

Originally Posted by Phanx (Post 272231)
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.

Torhal 01-22-13 08:28 PM

Quote:

Originally Posted by Phanx (Post 272231)
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.

Flaer 01-26-13 01:54 PM

Anyone have insight into what change would be needed to stop the whisper if the spell doesn't activate?

Farmbuyer 01-26-13 03:28 PM

Quote:

Originally Posted by Flaer (Post 272410)
Anyone have insight into what change would be needed to stop the whisper if the spell doesn't activate?

Install AfterCast.

Flaer 01-31-13 06:02 PM

Is there a way to do it in the macro instead? It does not need to be limited to the 250 or whatever characters.

Sharparam 02-01-13 01:27 AM

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.

Phanx 02-01-13 06:09 PM

Quote:

Originally Posted by Flaer (Post 272650)
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?

Flaer 02-01-13 07:20 PM

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.

Phanx 02-02-13 03:41 AM

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.


All times are GMT -6. The time now is 09:25 AM.

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