AFK Cleric Buffbot+Rezzer for Guildhall - accepts money

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

User avatar
xantan
a ghoul
a ghoul
Posts: 98
Joined: Wed Feb 09, 2005 11:17 pm
Location: Nevada
Contact:

AFK Cleric Buffbot+Rezzer for Guildhall - accepts money

Post by xantan » Thu Jul 26, 2007 3:49 pm

Was bored today, and with mq2 not entirely working for me lately, I made a macro, its not bad, but, has flaws if people are too dumb to hail me, or if they dont want to loot their corpses after getting a rez and want buffs...

It only casts virt and temperance, and does not make use of a cleric epic.

Shouldnt be hard to modify, or I can if you dont want to, anyways, enjoy.

--Its only lightly tested at the moment -- so please give bug reports/suggestions --

I plan to improve it later if I use it often. we'll see.

Made to setup in center area.
Several fixes since original post, thanks to people below and a few bug fixes done by myself.

Code: Select all

//==clerbot.mac==\\
//== Xantan's Cleric Rez/Buffbot -- Do with it what you want ==\\

#turbo

#Event CantRez "This player cannot be resurrected. The corpse is too old."
#Event Hail "#1# says, 'Hail, |${Me.Name}|'"
#Event Hold "Your spell would not have taken hold on your target."
#Event Old "That corpse is too old#*#"
#Event Oor "Your target is out of range, get closer!"
#Event Rez "#1# auctions, '#*#rez#*#"
#Event Rez "#1# says out of character, '#*#rez#*#"
#Event Rez "#1# shouts, '#*#rez#*#"
#Event Spam "You can't use that command while casting..."
#Event Stuck "You can't use that command right now..."
#Event Temp "#1# auctions, '#*#temp#*#"
#Event Temp "#1# says out of character, '#*#temp#*#"
#Event Temp "#1# shouts, '#*#temp#*#"
#event Virt "#1# auctions, '#*#virt#*#"
#event Virt "#1# says out of character, '#*#virt#*#"
#event Virt "#1# shouts, '#*#virt#*#"

#include Spell_Routines.inc

Sub Main
/declare Rez int outer 0
/declare TargetName string outer
/if (!${Defined[AFKMessage]}) /declare AFKMessage string outer 96% Rez, Temp, and Virt @ Center of Guild Lobby. Please Hail me for attention.
/if (!${Defined[MedMessage]}) /declare MedMessage string outer ...Meditating... - please hold till I have mana, then hail me if you need a rez or buffs.
/afk ${AFKMessage}
/ooc 96% Rez, Temperance, and Virtue @ Center of Guild Lobby. Hail me for attention.
/echo Started Cleric Buff/Rez bot

:MainLoop
/if (!${Me.AFK}) /call AFK
/if (${Me.PctMana} < 45) /call Med
/if (${Window[TradeWnd].Open}) /call Money
/if (${Me.Standing} && !${Me.Mount.ID}) /sit
/doevents
/goto :MainLoop

Sub AFK
/afk ${AFKMessage}
/return

Sub Buff
/if (${Window[TradeWnd].Open}) /call Money
/if (${Spawn[pc ${TargetName}].Pet.ID}) {
/if (${Spawn[PC ${TargetName}].Level} < 46) /tell ${TargetName} Inc Temp on pet.
/if (${Spawn[PC ${TargetName}].Level} > 45) /tell ${TargetName} Inc Virt on pet.
 /call BuffPet
}
/target id ${Spawn[PC ${TargetName}].ID}
/if (${Spawn[PC ${TargetName}].Level} < 46) /call Temp
/if (${Spawn[PC ${TargetName}].Level} > 45) /call Virt
/return

Sub BuffPet
/if (${Window[TradeWnd].Open}) /call Money
/target ${Spawn[PC ${TargetName}].Pet}
/if (${Spawn[PC ${TargetName}].Level} < 46) /call cast "Temperance" gem1 15s
/if (${Spawn[PC ${TargetName}].Level} > 45) /call cast "Virtue" gem2 15s
/return

Sub FaceSouth
/if (${Window[TradeWnd].Open}) /call Money
/face loc 201.46, -1.46
/delay 1s
/return

Sub Med
/afk ${MedMessage}
/if (!${Me.Sitting} && !${Me.Mount.ID}) /sit on
/delay 5m ${Me.PctMana} > 60
/afk ${AFKMessage}
/return

Sub Money
/delay 3s ${Window[TradeWnd].Open}
/delay 3s ${Window[TradeWnd].HisTradeReady}
/if (${Window[TradeWnd].HisTradeReady}) {
/echo Received a donation from ${Target.CleanName}.
/notify TradeWnd TRDW_Trade_Button leftmouseup
/say Thank you for your donation, ${Target.CleanName}. Hail me if you need buffs or a rez still.
}
/delay 1s
/return

Sub Oor
/t ${TargetName} ${Target.CleanName} is out of range, please come closer if you need buffs or a rez.
/return

Sub Temp
/if (${Window[TradeWnd].Open}) /call Money
/face
/tell ${TargetName} INC Temp - click off oldies
/call cast "Temperance" gem1 15s
/return

Sub Rez
/if (${Window[TradeWnd].Open}) /call Money
/delay 3
/tell ${TargetName} Inc Rez. If you need multiple rezzes or you need buffs afterwards, please hail me again after looting your corpse..
/delay 6
/tar ${TargetName}'s corpse
/delay 4
/if (${Target.Distance}>82) {
/call Oor
/return
}
/call cast "Reviviscence" gem3 15s
/varset Rez 0
/return

Sub RezCheck
/if (${Window[TradeWnd].Open}) /call Money
/delay 1
/if (${Spawn[corpse ${TargetName}].ID}) /varset Rez 1
/return

Sub Virt
/if (${Window[TradeWnd].Open}) /call Money
/face
/tell ${TargetName} INC Virt - click off oldies
/call cast "Virtue" gem2 15ss
/return

Sub Event_CantRez
/t ${TargetName} Cannot rez your corpse, its too old! Loot it and hail me again if wanted.
/return

Sub Event_Hail(Line,Sender)
/varset TargetName ${Sender}
/if (${Me.Sitting}) /stand up
/if (${Window[TradeWnd].Open}) /call Money
/delay 2
/target id ${Spawn[PC ${TargetName}].ID}
/call RezCheck
/if (${Rez}) {
/call Rez
/return
}
/call Buff
/call FaceSouth
/return

Sub Event_Hold
/t ${TargetName} The spell I casted wouldn't take hold, please click off old buffs and hail me again if you'd like to be buffed.
/return

Sub Event_Old
/t ${TargetName} ${Target.CleanName} is too old to be rezzed! loot it up - I cant rez it. Hail me afterwards if you need buffs.
/return

Sub Event_Oor
/t ${TargetName} ${Target.CleanName} is out of range, please come closer if you need buffs or a rez.
/return

Sub Event_Spam
/delay 4s
/return

Sub Event_Stuck
/say sec
/notify TradeWnd TRDW_Cancel_Button leftmouseup
/return

Sub Event_Temp(Line,Sender)
/if (${Window[TradeWnd].Open}) /call Money
/delay 2s
/if (${Spawn[PC ${Sender}].Class.ShortName.Equal[CLR]}) /return
/delay 1s
/tell ${Sender} Temp @ Center - hail me.
/return

Sub Event_Rez(Line,Sender)
/if (${Window[TradeWnd].Open}) /call Money
/delay 2s
/if (${Spawn[PC ${Sender}].Class.ShortName.Equal[CLR]}) /return
/delay 1s
/tell ${Sender} 96% Rez @ Center - bring corpse(s) and hail me.
/return

Sub Event_Virt(Line,Sender)
/if (${Window[TradeWnd].Open}) /call Money
/delay 2s
/if (${Spawn[PC ${Sender}].Class.ShortName.Equal[CLR]}) /return
/delay 1s
/tell ${Sender} Virt @ Center - hail me
/return
Last edited by xantan on Fri Jul 27, 2007 1:50 pm, edited 32 times in total.
[b]=/[/b]

User avatar
xantan
a ghoul
a ghoul
Posts: 98
Joined: Wed Feb 09, 2005 11:17 pm
Location: Nevada
Contact:

Post by xantan » Thu Jul 26, 2007 4:18 pm

deleted - edited first post with new ver.
Last edited by xantan on Thu Jul 26, 2007 4:29 pm, edited 1 time in total.
[b]=/[/b]

jacensolo
a snow griffon
a snow griffon
Posts: 427
Joined: Wed Feb 14, 2007 8:51 am
Location: Right behind you

Post by jacensolo » Thu Jul 26, 2007 4:28 pm

Not exactly sure, haven't ever done it, but I thought I read somewhere on the wiki that things in events could be dynamically generated by placing the code inside "|" marks. So like this:

Code: Select all

#Event Hail "#1# says, 'Hail, MYNAMEHERE'"
Could be rewritten as:

Code: Select all

#Event Hail "#1# says, 'Hail, |${Me.Name}|'"
So that it worked without modification for each user.

Again, never done something like that before, but I think thats how I read it, and it would make it easier to use for multiple toons on same computer.

User avatar
xantan
a ghoul
a ghoul
Posts: 98
Joined: Wed Feb 09, 2005 11:17 pm
Location: Nevada
Contact:

Post by xantan » Thu Jul 26, 2007 4:34 pm

Thanks a lot for that, I was trying things like that, but without the | |'s... anyways, I tested it and it works, edited top post macro.
[b]=/[/b]

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Thu Jul 26, 2007 4:35 pm

Somewhere up top:

Code: Select all

/if (!${Defined[AFKMessage]}) /declare AFKMessage string outer 96% Rez, Temp, and Virt @ Center of Guild Lobby. Please Hail me for attention.
/if (!${Defined[MedMessage]}) /declare MedMessage string outer ...Meditating... - please hold till I have mana, then hail me if you need a rez or buffs.
Replace yours:

Code: Select all

Sub Med
|Set afk med message
/afk ${MedMessage}
|if I am not sitting and I don't have a mount, sit on
/if (!${Me.Sitting} && !${Me.Mount.ID}) /sit on
|delay 5 minutes or until my mana is greater then 60%
|Note: 5 minutes should be more then enough to get over 60%
|so I should not have to go through this sub more then once
/delay 5m ${Me.PctMana} > 60
|set my afk message back to normal
/afk ${AFKMessage}
/return 
Adjust rest of macro to use new afk message format.

Further, replace

Code: Select all

/tar ${TargetName}
with

Code: Select all

/target id ${Spawn[PC ${Sender}].ID}
as using "/tar ${TargetName}" will not work for beastlords or anybody with an aura at all.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

User avatar
xantan
a ghoul
a ghoul
Posts: 98
Joined: Wed Feb 09, 2005 11:17 pm
Location: Nevada
Contact:

Post by xantan » Thu Jul 26, 2007 4:59 pm

fearless wrote:Further, replace

Code: Select all

/tar ${TargetName}
with

Code: Select all

/target id ${Spawn[PC ${Sender}].ID}
as using "/tar ${TargetName}" will not work for beastlords or anybody with an aura at all.
TargetName is used everywhere, but then you switch to Sender, sender I can do for the first one, but then, should I use

Code: Select all

/target id ${Spawn[PC ${TargetName}].ID}
for the rest?
TargetName was just defined from Sender

I think so, but not sure ...

Thanks for the help.
[b]=/[/b]

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Thu Jul 26, 2007 5:02 pm

Yup, that's fine.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Thu Jul 26, 2007 5:11 pm

Code: Select all

Sub PetCheck
/if (${Window[TradeWnd].Open}) /call Money
/tar ${TargetName}
/tar ${Target.Pet}
/if (${Target.ID} && ${Target.Type.Equal[Pet]}) /varset Pet 1
/return 

Code: Select all

Sub PetCheck
/if (${Window[TradeWnd].Open}) /call Money
/if (${Spawn[pc ${TargetName}].Pet.ID}) /varset Pet 1
/return
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Thu Jul 26, 2007 5:41 pm

You REALLY need to reduce the number of target commands you use. Every time you issue a target command it issues commands to the server, these commands are trackable.

You can reduce the number of target commands by checking if you already have the right target before issuing a new target command. Further, you do NOT need to use target to see if somebody has a pet or what level they are, all of this info is already available via Spawn.

Code: Select all

Sub Buff
/if (${Window[TradeWnd].Open}) /call Money
/if (${Spawn[pc ${TargetName}].Pet.ID}) {
  /tell ${TargetName} Inc Virt on pet.
  /call BuffPet
}
/if (${Spawn[PC ${TargetName}].Level}) < 46 /call Temp
/if (${Spawn[PC ${TargetName}].Level}) > 45 /call Virt
/return

Sub BuffPet
/if (${Window[TradeWnd].Open}) /call Money
/if (!${Target.ID}==${Spawn[PC ${TargetName}].Pet.ID}) {
  /target id ${Spawn[PC ${TargetName}].Pet.ID}
  /delay 3s ${Target.ID}==${Spawn[PC ${TargetName}].Pet.ID}
}
/if (${Spawn[PC ${TargetName}].Level}) < 46 /call cast "Temperance" gem1 15s
/if (${Spawn[PC ${TargetName}].Level}) > 45 /call cast "Virtue" gem2 15s
/return
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

User avatar
xantan
a ghoul
a ghoul
Posts: 98
Joined: Wed Feb 09, 2005 11:17 pm
Location: Nevada
Contact:

Post by xantan » Thu Jul 26, 2007 6:05 pm

Thanks, fixed that and a few other things, will keep working with this spawn thing when I get back from the store.
[b]=/[/b]

LexLuthor
orc pawn
orc pawn
Posts: 13
Joined: Sun Jul 09, 2006 8:40 pm
Location: USA

anyone know?

Post by LexLuthor » Wed Oct 31, 2007 8:34 pm

anyone know if this macro still works? if it does could they modify it or show me where to add in tenacity to this macro?

User avatar
xantan
a ghoul
a ghoul
Posts: 98
Joined: Wed Feb 09, 2005 11:17 pm
Location: Nevada
Contact:

Re: anyone know?

Post by xantan » Wed Dec 05, 2007 4:38 am

LexLuthor wrote:anyone know if this macro still works? if it does could they modify it or show me where to add in tenacity to this macro?
Sub Buff
/if (${Window[TradeWnd].Open}) /call Money
/if (${Spawn[pc ${TargetName}].Pet.ID}) {
/if (${Spawn[PC ${TargetName}].Level} < 46) /tell ${TargetName} Inc Temp on pet.
/if (${Spawn[PC ${TargetName}].Level} > 45 && ${Spawn[PC ${TargetName}].Level} < 65 ) /tell ${TargetName} Inc Virt on pet.
/if (${Spawn[PC ${TargetName}].Level} > 65) /tell ${TargetName} INC Tenacity on pet.

/call BuffPet
}
/target id ${Spawn[PC ${TargetName}].ID}
/if (${Spawn[PC ${TargetName}].Level} < 46) /call Temp
/if (${Spawn[PC ${TargetName}].Level} > 45 && ${Spawn[PC ${TargetName}].Level} < 65 ) /call Virt
/if (${Spawn[PC ${TargetName}].Level} > 65) /call Tena

/return


Sub Tena
/if (${Window[TradeWnd].Open}) /call Money
/tell ${TargetName} Inc tenacity, click off oldies
/target ${Spawn[PC ${TargetName}]}
/call cast "Tenacity" gem3 15s
/return

Sub BuffPet
/if (${Window[TradeWnd].Open}) /call Money
/target ${Spawn[PC ${TargetName}].Pet}
/if (${Spawn[PC ${TargetName}].Level} < 46) /call cast "Temperance" gem1 15s

/(${Spawn[PC ${TargetName}].Level} > 45 && ${Spawn[PC ${TargetName}].Level} < 65 ) /call cast "Virtue" gem2 15s
/if (${Spawn[PC ${TargetName}].Level} > 65) /call cast "Tenacity" gem3 15s
/return


RED = add/change, find it out yourself with what I've given you and the original macros code above.
[b]=/[/b]

Yunto?
a grimling bloodguard
a grimling bloodguard
Posts: 502
Joined: Sat Nov 19, 2005 12:05 pm

Post by Yunto? » Wed Dec 05, 2007 7:52 am

Buffs for the pet are based on the PCs level, not the pets. You could have a level 1 pet going around with Tenacity, if the caster is high enough level.

IOW, dont /target the pet till you decide what buff to cast. That, or buff the owner, then immediately buff the pet.
(10:02:10 AM) fearless: kate beckinsale
(10:02:18 AM) fearless: chick from underpants
(10:02:27 AM) fearless: er . . . world, underworld

User avatar
xantan
a ghoul
a ghoul
Posts: 98
Joined: Wed Feb 09, 2005 11:17 pm
Location: Nevada
Contact:

Post by xantan » Thu Dec 06, 2007 4:50 am

Yunto? wrote:Buffs for the pet are based on the PCs level, not the pets. You could have a level 1 pet going around with Tenacity, if the caster is high enough level.

IOW, dont /target the pet till you decide what buff to cast. That, or buff the owner, then immediately buff the pet.
First statement doesn't really apply since my code checked the keyword PC's level, then buffed the pet. Do you really want to make such assumptions?

Code: Select all

Sub BuffPet
/if (${Window[TradeWnd].Open}) /call Money
/target ${Spawn[PC ${TargetName}].Pet}
/if (${Spawn[PC ${TargetName}].Level} < 46) /call cast "Temperance" gem1 15s
[color=red]
/(${Spawn[PC ${TargetName}].Level} > 45 && ${Spawn[PC ${TargetName}].Level} < 65 ) /call cast "Virtue" gem2 15s
/if (${Spawn[PC ${TargetName}].Level} > 65) /call cast "Tenacity" gem3 15s
/return 
Second statement makes complete sense, and I'm sorry I'm a terrible sloppy coder, who was incredibly lazy at one point in time and in stead of keeping track of variables, I just randomly used functions for things and reused them for different things, and always made sure to check, and also I was somewhat new with the /if ${Spawn}[pc] type deal....

anyways, change it how you think, or help him change it if it doesn't work, otherwise the knowledge only applies for others to learn, besides us here.

=/
[b]=/[/b]

MissTerious
decaying skeleton
decaying skeleton
Posts: 8
Joined: Wed Feb 01, 2006 7:04 pm

Post by MissTerious » Sun Dec 09, 2007 4:24 am

There's been a rezbot in the lobby of our server lately. Very handy. Functions well. I saw GM KaoIMhe's body in front of it yesterday. Today he's gone. I hope nothing bad happened to him.