WoWInterface

WoWInterface (http://www.wowinterface.com/forums/index.php)
-   Macro Help (http://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Resurrection Macro (http://www.wowinterface.com/forums/showthread.php?t=35073)

TheGeek 09-20-10 08:34 PM

Resurrection Macro
 
I'm trying to do two things with a macro. I don't know how to do it tho.

Cast Resurrection

Say "(Resurrection) on 'PlayerName'". I want the (Resurrection) to be the actual spell link. I want it to use raid or party depending on whether im in raid or not.

Possible?

Phanx 09-20-10 09:35 PM

If you just want it to send the message every time you press the button:

/run SendChatMessage(GetNumRaidMembers()>0 and "RAID" or "PARTY","Casting "..GetSpellLink("Resurrection").." on "..UnitName("target") or "No Target")

TheGeek 09-20-10 09:46 PM

That didn't work for me :(

Seerah 09-20-10 10:20 PM

Phanx has the arguments switched around. Should be message first:

Code:

/run SendChatMessage("Casting "..GetSpellLink("Resurrection").." on "..UnitName("target") or "No Target",GetNumRaidMembers()>0 and "RAID" or "PARTY")

TheGeek 09-20-10 10:29 PM

Worked.. however, if I'm not in a party and I want to rez a nube who happen to get killed by the environment, this pops.

Date: 2010-09-20 23:29:02
ID: 1
Error occured in: Global
Count: 1
Message: [string "SendChatMessage("Casting "..GetSpellLink("R..."] line 1:
attempt to concatenate a nil value
Debug:
(tail call): ?
[C]: ?
[string "SendChatMessage("Casting "..GetSpellLink("R..."]:1: in main chunk
[C]: RunScript()
..\FrameXML\ChatFrame.lua:1996: value()
..\FrameXML\ChatFrame.lua:4070:
..\FrameXML\ChatFrame.lua:3997
[C]: ChatEdit_ParseText()
..\FrameXML\ChatFrame.lua:3660: ChatEdit_SendText()
..\FrameXML\ChatFrame.lua:2477:
..\FrameXML\ChatFrame.lua:2470
[C]: ?
[C]: UseAction()
..\FrameXML\SecureTemplates.lua:310: handler()
..\FrameXML\SecureTemplates.lua:529:
..\FrameXML\SecureTemplates.lua:478

Guardix 09-21-10 02:19 AM

Code:

/run SendChatMessage("Casting "..GetSpellLink("Resurrection").." on "..UnitName("target") or "No Target",GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY" or "SAY")
Simply added a GetNumPartyMembers() and make it use "SAY" if you are not in raid nor party.

TheGeek 09-21-10 05:53 PM

You rock! Thanks.

TheGeek 10-01-10 09:43 PM

Quote:

Originally Posted by Guardix (Post 206821)
Code:

/run SendChatMessage("Casting "..GetSpellLink("Resurrection").." on "..UnitName("target") or "No Target",GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY" or "SAY")
Simply added a GetNumPartyMembers() and make it use "SAY" if you are not in raid nor party.

Ok, it's working except for if I accidentally hit it while not targeting, it kills the macro all together.

Seerah 10-01-10 09:47 PM

Put the /run line after your /cast line (if you mean what I think you mean, that is).

TheGeek 10-01-10 09:54 PM

Code:

#showtooltip Resurrection
/cast Resurrection
/run SendChatMessage("Casting "..GetSpellLink("Resurrection").." on "..UnitName("target") or "No Target",GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY" or "SAY")

That's what it looks like. If I happen to just be standing there and I hit the rez key without anyone targeted it pops up the error I posted a few ones up.

I've managed to narrow it down to this;

Code:

"..UnitName("target") or "No Target"
If the "..UnitName" piece is in it errors. It's like the command isn't understanding to use UnitName or No Target if nothing is targeted.

TheGeek 10-01-10 09:58 PM

That probably made no sense. It works period if you have someone targeted. It will use say when not in party, party when in a party, and raid when in a raid. However, the unitname and no target clause don't seem to work with one another.

It reminds me of an IF/OR statement that should say IF targeted use UnitName OR not targeted use "No Target".

Xubera 10-01-10 10:56 PM

try

Code:

/run SendChatMessage(("Casting "..GetSpellLink("Resurrection").." on "..UnitName("target")) or "No Target",GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY" or "SAY")
the difference being putting paraenthesis around the entire string so

if (longString..with..concat..UnitName) or "No Target"

so the whole string is all or nothing

Seerah 10-01-10 11:27 PM

eh, I would try them here :)

Code:

/run SendChatMessage("Casting "..GetSpellLink("Resurrection").." on "..(UnitName("target") or "No Target"),GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY" or "SAY")
But this would definitely work:
Code:

/run local n=UnitName("target") or "No Target" SendChatMessage("Casting "..GetSpellLink("Resurrection").." on "..n",GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY" or "SAY")

Maleekha 07-15-11 10:34 AM

But what if the target is out of range or out of line of sight? The macro is enabled, informing ppl but my char does not cast the spell.... :S could any1 help me pls?

SDPhantom 07-15-11 11:27 AM

You'll need an addon watching events to detect if you actually started casting a resurrection spell instead of erroring due to range/LoS. Due to the nature of the code required, it wouldn't be practical to run from a macro.


All times are GMT -6. The time now is 08:30 PM.

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