Click.mac - resurrect corpses around you using cleric epic

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Click.mac - resurrect corpses around you using cleric epic

Post by blueninja » Fri Oct 17, 2003 8:03 am


----------------------------------------------------------------
OUTDATED,
new version found here:
http://macroquest2.com/phpBB2/viewtopic.php?t=3804
----------------------------------------------------------------



First macro I've managed to clean up enough to post :) ..

Intended for raiding clerics, goes through all corpses within a defined radius and clicks them. It cycles through corpses twice, the first time clicking corpses that are defined as high priority, people you want to get up first for example other clerics that can help you click. This behaviour is defined in Sub HasPriority.

Max range for the spell is actually 200ft but for safety you might want to use something shorter.

Haven't had a chance to test it on a real raid wipe but I've tested it around graveyards in various pop zones.

Suggestions and bug reports welcome.

Code: Select all

| Click.mac - Click all corpses around you - by blueninja
|    Resurrects all corpses within a radius using the cleric epic
|    Clicks high priority classes first as defined by Sub HasPriority
|
|    You probably want to run this with '/filter macros enhanced' to avoid targeting spam

#turbo
#define clickradius 100
#event interrupt "Your spell is interrupted"
#event notequipped "You cannot use this item unless it is equipped."
#event notmemmed "You do not seem to have that spell memorized."

Sub Event_interrupt
   /varset status 2
/return

Sub Event_notequipped
|Epic is in an inventory slot, need to put it in primary
   /endmacro
/return

Sub Event_notmemmed
|Epic is bagged or banked
   /endmacro
/return


Sub Main
  /press esc
  /declare status global
  /declare oldtargetid local


|First loop through high priority classes..
  :loopprio
     /varset status 0
     /varset oldtargetid $target(id)
     /target corpse range 1 65 radius clickradius next
     /doevents
|If we didn't get a new target move on to low priority
     /if @oldtargetid==$target(id) /goto :clicktherest

|Check if this is a high priority corpse
     /call HasPriority
     /if $return!="true" /goto :loopprio
     /call clickit
  /goto :loopprio

  :clicktherest
  /press esc

|.. then everyone else
  :restloop
     /varset status 0
     /varset oldtargetid $target(id)
     /target corpse range 1 65 radius clickradius next
     /doevents
     | If we didn't get a new target quit
     /if @oldtargetid==$target(id) /endmacro

|Check that this isn't a priority corpse
     /call HasPriority
     /if $return=="true" /goto :restloop
     /call clickit
  /goto :restloop

/return

Sub HasPriority
|Add conditions for corpses to click before everyone else here
|For example you might want to get clerics up first to help out with rezzing
|or bards for manaregen song.
   /if "$target(class)"=="Cleric" /return "true"
   /if "$target(class)"=="Bard" /return "true"
/return "false"


Sub clickit
   /declare counter local
   /declare giveup local
   /declare castwait local

   /if $target()=="FALSE" /return

|Counter to give up after 4 attempts at rezzing a corpse
|that fail either by interrupt or if we can't cast for 3 seconds
   /varset giveup 0

   :tryagain
   /varadd giveup 1

|Too many tries, move on to next
   /if n @giveup>4 /return

   /varset status 0
   /varset castwait 0

|Wait until we are not casting, if we wait too long, treat as an interrupt
   :waitforcast
       /if $char(casting)!="TRUE" /goto :castit
       /delay 5
       /varadd castwait 1
       /if n @castwait>5 /goto :tryagain
   /goto :waitforcast

   :castit
   /cast item "water sprinkler of nem ankh"

|Wait until not casting anymore
   :castdelay
      /delay 1s
      /doevents
      /if n @status==2 /goto :tryagain
      /if n @status==1 /return
   /if $char(casting)=="TRUE" /goto :castdelay  

/return
EDIT: Changed the code to check the corpse's current hp as NPC corpses most of the time return 0 while PC corpses return a negative value. It seems that sometimes it will go wrong but I haven't seen it skip a PC corpse, only click a NPC corpse so I guess it's not that big a deal. Please let me know if you see it skip a PC corpse though, try to do '/echo $target(hp,cur)' on it too and report that value.

EDIT: Removed the hp check, seems like it wasn't very reliable after all. So now it's back to clicking corpses.
Last edited by blueninja on Wed Nov 05, 2003 7:57 pm, edited 6 times in total.

User avatar
vzmule
Contributing Member
Contributing Member
Posts: 378
Joined: Thu Mar 13, 2003 11:56 pm

Post by vzmule » Sat Oct 18, 2003 8:50 pm

Tested and worked well.

Rassilon
a lesser mummy
a lesser mummy
Posts: 73
Joined: Thu Sep 04, 2003 6:34 pm

Post by Rassilon » Sun Oct 19, 2003 8:30 am

Is there anyway to have it not try and rez mob corpses?

Thanks,

Rass

in_training
Craptastic
Posts: 115
Joined: Fri Oct 10, 2003 8:25 am

Post by in_training » Mon Oct 20, 2003 3:17 am

Code: Select all

:castit
   /if "$target(type)"!="NPC" { 
   /cast item "water sprinkler of nem ankh" 
   }
Maybe? Or do I need an Else?

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Mon Oct 20, 2003 3:56 am

Yeah that might work. Actually I just noticed myself that it tries to click npc corpses.

Code: Select all

/target [b]pc corpse[/b] radius clickradius next 
Looks like I didn't read the manual well enough.. /target takes [pc|npc|corpse] which means I'm using an argument in that position twice. Guess the parser uses the second arg.

$target(type) returns "Corpse" on npc corpses, probably on pc corpses too so that code wouldn't work. I guess you could /con the corpse and tie an event to the text since it will vary from pc and npc corpses if there is no better way.. Any suggestions?[/b]

CyberTech
a ghoul
a ghoul
Posts: 97
Joined: Wed Jun 26, 2002 9:27 am

Post by CyberTech » Mon Oct 20, 2003 6:52 pm

Parse out the name of the corpse, and do a "/who all name class" (since you do know the class, but race might be wrong) for that name. If you can't find them, it's a) a corpse, or b) someone who isn't online (or is zoning etc) and thus isn't rezzable anyway.

User avatar
Imperfect
Macro Author
Macro Author
Posts: 319
Joined: Fri Jun 14, 2002 1:52 am

Post by Imperfect » Mon Oct 20, 2003 7:58 pm

Rez timers could be useful in this situation.

blakbelt
a lesser mummy
a lesser mummy
Posts: 70
Joined: Wed Aug 27, 2003 12:40 pm
Location: Scotland UK

Post by blakbelt » Tue Oct 21, 2003 4:12 am

I used thissuccesfully to rez most of a wiped raid last night - has taken the RSI out of death, great macro
Blakbelt

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Tue Oct 21, 2003 9:08 am

It seems that there is no easy way to find out if a corpse belongs to a player or npc. I've thought about all those ways of checking if it is a player or not but /con'ing and /who all and both take time for the server to reply..

Also thought about checking the race of the corpse but I'm not sure how well that would work with illusions and stuff.. Plus it would still click certain npc corpses if they happen to be of a race that is playable. I wrote some code to do that but I deleted it cause I don't have a good list of races that could be returned. Might put something together though that logs the races of all players it sees and I could build a list from that..

Well anyway, I did a test of the /con idea but it didn't work out well because of server lag. Of course you could put in a delay or something but that would make it slower than to just click the npc corpse, get the error message and move on.

Here's the code I made that /con's if anyone's interested. It often misses the corpses because the /con message is delayed so it doesn't really work, you'd have to put some sort of delay in there I think. Keep using the one above instead :)

Code: Select all

| Click.mac - Click all corpses around you - by blueninja
|    Resurrects all corpses within a radius using the cleric epic
|    Clicks high priority classes first as defined by Sub HasPriority
|
|    You probably want to run this with '/filter macros enhanced' to avoid targeting spam

#turbo
#define clickradius 200
#event interrupt "Your spell is interrupted"
#event notequipped "You cannot use this item unless it is equipped."
#event notmemmed "You do not seem to have that spell memorized."
#event willdecay "This corpse will decay in"
#event restime "This corpse's resurrection time will expire in "

Sub Event_restime
    /varset ispccorpse 1
/return

Sub Event_willdecay
   /varset gotconmsg 1
/return

Sub Event_interrupt
   /varset status 2
/return

Sub Event_notequipped
|Epic is in an inventory slot, need to put it in primary
   /endmacro
/return

Sub Event_notmemmed
|Epic is bagged or banked
   /endmacro
/return


Sub Main
  /press esc
  /declare status global
  /declare ispccorpse global
  /declare gotconmsg global
  /declare oldtargetid local


|First loop through high priority classes..
  :loopprio
     /varset status 0
     /varset oldtargetid $target(id)
     /target corpse range 1 65 radius clickradius next
     /doevents
|If we didn't get a new target move on to low priority
     /if @oldtargetid==$target(id) /goto :clicktherest

|Check if this is a high priority corpse
     /call HasPriority
     /if $return!="true" /goto :loopprio
     /call clickit
  /goto :loopprio

  :clicktherest
  /press esc

|.. then everyone else
  :restloop
     /varset status 0
     /varset oldtargetid $target(id)
     /target corpse range 1 65 radius clickradius next
     /doevents
     | If we didn't get a new target quit
     /if @oldtargetid==$target(id) /endmacro

|Check that this isn't a priority corpse
     /call HasPriority
     /if $return=="true" /goto :restloop
     /call clickit
  /goto :restloop

/return

Sub HasPriority
|Add conditions for corpses to click before everyone else here
|For example you might want to get clerics up first to help out with rezzing
|or bards for manaregen song.
   /if "$target(class)"=="Cleric" /return "true"
   /if "$target(class)"=="Bard" /return "true"
/return "false"


Sub clickit
   /declare counter local
   /declare giveup local
   /declare castwait local

   /if $target()=="FALSE" /return

|Stupid stuff to check if the corpse is really a player corpse
|If this annoys you cut from here..
   /varset ispccorpse 0
   /varset gotconmsg 0
   /consider

   :waitcon
      /doevents
      /delay 1
   /if n @gotconmsg==0 /goto :waitcon

   /if n @ispccorpse!=1 /return
|..to here

|Counter to give up after 4 attempts at rezzing a corpse
|that fail either by interrupt or if we can't cast for 3 seconds
   /varset giveup 0

   :tryagain
   /varadd giveup 1

|Too many tries, move on to next
   /if n @giveup>4 /return

   /varset status 0
   /varset castwait 0

|Wait until we are not casting, if we wait too long, treat as an interrupt
   :waitforcast
       /if $char(casting)!="TRUE" /goto :castit
       /delay 5
       /varadd castwait 1
       /if n @castwait>5 /goto :tryagain
   /goto :waitforcast

   :castit
   /cast item "water sprinkler of nem ankh"

|Wait until not casting anymore
   :castdelay
      /delay 1s
      /doevents
      /if n @status==2 /goto :tryagain
      /if n @status==1 /return
   /if $char(casting)=="TRUE" /goto :castdelay  

/return

J-Squared

Post by J-Squared » Thu Oct 23, 2003 12:46 pm

It seems that there is no easy way to find out if a corpse belongs to a player or npc. I've thought about all those ways of checking if it is a player or not but /con'ing and /who all and both take time for the server to reply..

Also thought about checking the race of the corpse but I'm not sure how well that would work with illusions and stuff.. Plus it would still click certain npc corpses if they happen to be of a race that is playable. I wrote some code to do that but I deleted it cause I don't have a good list of races that could be returned. Might put something together though that logs the races of all players it sees and I could build a list from that..
Yeah that might work. Actually I just noticed myself that it tries to click npc corpses.
Code:
/target pc corpse radius clickradius next


Looks like I didn't read the manual well enough.. /target takes [pc|npc|corpse] which means I'm using an argument in that position twice. Guess the parser uses the second arg.

$target(type) returns "Corpse" on npc corpses, probably on pc corpses too so that code wouldn't work. I guess you could /con the corpse and tie an event to the text since it will vary from pc and npc corpses if there is no better way.. Any suggestions?[/b]

I have been following this thread with great intrest and been thinking about the probleam. It seems to me that a diffrent direction might be the best way. Perhaps going back to the source code and changing the way /target works all together. Changing it so that the /target command will accept both "pc" and "corpse" in such a way that it wouldn't effect other macros and get it submitted to the developers, then this macro would work as intended. And a very useful macro it is... even in it's current state.

I'm not a very skilled coder, but some added features to this that would be nice might be some stats listing how many people you rezzed vs how many failed. And perhaps soemthing in there to send a short tell to the person your rezzing "rez inc" and/or a message in a channel, such as /rsay I'm rezzing %reztarget%. so that other clerics on the raid can move to others.

Anyway. just some ideas. it's about all I can offer. I leave the coding to the skilled guys.

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Oct 23, 2003 10:01 pm

J-Squared wrote:Perhaps going back to the source code and changing the way /target works all together. Changing it so that the /target command will accept both "pc" and "corpse" in such a way that it wouldn't effect other macros and get it submitted to the developers, then this macro would work as intended.
We had this discussion in another thread here. The conclusion is that pc corpses and npc corpses show different hp percentages but it's not 100% reliable. The type of corpse is not availiable to the client in any other way. The macro now uses this to sort out npc corpses and it works pretty well, I haven't seen it miss a pc corpse and very few times have I seen it try to click npc corpses.
I'm not a very skilled coder, but some added features to this that would be nice might be some stats listing how many people you rezzed vs how many failed. And perhaps soemthing in there to send a short tell to the person your rezzing "rez inc" and/or a message in a channel, such as /rsay I'm rezzing %reztarget%. so that other clerics on the raid can move to others.
It would be very easy to make it send a tell or whatever when it rezzes. I don't want it to do that for me though, noone would notice you using this if you silently click but if you start letting people know you can click a corpse every 11 seconds when the cast time of the spell is 10s they might ..

Anyway, if you want to do something before clicking, put it in between these two lines, like this:

Code: Select all

   :castit 
[b]|... code goes here ...
   /tt Rez inc
   /say Clicking %t
[/b]
   /cast item "water sprinkler of nem ankh" 
If you want to use $target for sending tells or whatever you'd have to strip off the "'s corpse" part, something like this $left($instr("'",$target(name,clean),$target(name,clean))) should do it I think (off the top of my head).

The statistics thing should be pretty easy to do, I'll look into it when I get some time.

Thanks for your input ..

TheColonel
of what?
of what?
Posts: 164
Joined: Thu Oct 10, 2002 6:34 pm
Location: Golden, CO
Contact:

Post by TheColonel » Wed Nov 05, 2003 6:38 am

Just a gripe... but when you #define something PLEASE follow every convention ever written and make it CAPS
Hell hath no fury like a woman's scorn for EQ.
-==(UDIC)==-