cleric.mac (working Cleric bot with Autoloot and Autoheal)

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

Dirtface
a lesser mummy
a lesser mummy
Posts: 39
Joined: Tue Nov 12, 2002 2:43 am

cleric.mac (working Cleric bot with Autoloot and Autoheal)

Post by Dirtface » Mon Nov 18, 2002 4:58 am

Hey kids. With a lot of help from a few people, heres a bot that will follow commands, and has an always on autoheal. Also new is the included autolooter. Enjoy.

***EDIT (now completely working before Nov 19th patch.) Replaced some stupid spells with more useful ones. Added gate, and root. Autoheal now targetting properly.

Code: Select all

| cleric.mac 
| cleric petbot
|  
| Courtesy of Dirtface
| Special thanks: Wes (for the idea of the FOR loop)
|                 Fippy (for figuring out "What went wrong.)
|                 Valerian (for completely writing the Autoheal script
|                           and the auto loot script.
|                           Seriously, Val figured this whole thing out.)
|                 Sparr (For helping me with the Set camp feature)
| Usage: /macro cleric.mac <character in control> 

#define GroupMember v93
#define GroupMax v90
#define ChatCommand p2
#define XLOC v52
#define YLOC v53
#define $GroupClass $spawn($group($GroupMember),class)

#include SpellSub.mac
#include loot.inc
#include routines.mac
#chat tell 
#Event Invited "To join the group, click on the 'FOLLOW' option, or 'DISBAND' to cancel" 
#Event ClarityGone "Your mind returns to normal." 
#Event InvisGone "You feel yourself starting to appear"
#Event RootGone "Your Instill spell has worn off." 
#Event FollowOff "You are no longer auto-following " 

Sub Main 
   /varset v69 $p0 
:chkevent 
   /doevents 
   | *** AutoHeal ***

   /varcalc GroupMax $group(count)-1
   /for GroupMember 0 to $GroupMax
      /if n $spawn($group($GroupMember),hp,pct)<41 {
         /if n $spawn($group($GroupMember),hp,pct)<1 /goto :nextmember
         /if "$GroupClass"=="Warrior" /goto :Tankheal
         /if "$GroupClass"=="Paladin" /goto :Tankheal
         /if "$GroupClass"=="Shadowknight" /goto :Tankheal
         /if "$GroupClass"=="Monk" /goto :Tankheal
         /if "$GroupClass"=="Ranger" /goto :Tankheal
         /goto :CasterHeal

:Tankheal
         /if n $group($GroupMember)==$char(id) /press F1
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember)
         /face
         /delay 11
         /stand
         /g COMPLETE HEAL on %T in 10seconds 
         /call SpellSub 1 105 
         /sit
         /goto :nextmember

:Casterheal
         /if n $group($GroupMember)==$char(id) /press F1
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember)
         /face
         /delay 11
         /stand
         /g Healing %T 
         /call SpellSub 2 50
         /sit
:nextmember
      }
   /next GroupMember
   /goto :chkevent
/return 

Sub Event_Chat 

:Commands

| *** Complete Heal ***

/if "$ChatCommand"=="ch" { 
     /target $lasttell
     /face
     /delay 11
     /stand
     /g COMPLETE HEAL on %T in 10seconds 
     /call SpellSub 1 105 
     /sit
     /press esc

| *** HEAL OVER TIME ***

   } else /if "$ChatCommand"=="ce" { 
     /target $lasttell
     /face
     /delay 11
     /stand
     /g Celestial Healing on %T 
     /call SpellSub 4 45 
     /sit
     /press esc

| *** GATE ***

   } else /if "$ChatCommand"=="gate" { 
     /stand 
     /g Gating 
     /call SpellSub 8 55
     
| *** HP BUFF ***

   } else /if "$ChatCommand"=="HP" { 
     /target $lasttell
     /face
     /delay 11
     /stand
     /g HP Buff on %T 
     /call SpellSub 6 65
     /sit  
     /press esc

| *** Superior Heal ***

   } else /if "$ChatCommand"=="Heal" { 
     /target $lasttell
     /face
     /delay 11
     /stand
     /g Healing %T 
     /call SpellSub 2 50
     /sit 
     /press esc

| *** Symbol ***

   } else /if "$ChatCommand"=="Symbol" { 
     /target $lasttell
     /face
     /delay 11
     /g Symbol on %T 
     /call SpellSub 7 55
     /sit  
     /press esc

| *** AC BUFF ***

   } else /if "$ChatCommand"=="AC" { 
     /target $lasttell
     /face
     /delay 11
     /stand
     /g AC BUFF on %T 
     /call SpellSub 5 45
     /sit 
     /press esc

| *** Root ***

     } else /if "$ChatCommand"=="root" { 
     /target $lasttell
     /face
     /assist
     /delay 11
     /stand
     /g Rooting %T 
     /call SpellSub 3 40
     /sit 
     /press esc

| *** Report Mana ***

   } else /if "$ChatCommand"=="mana" { 
     /target myself 
     /delay 5 
     /g Mana is at $char(mana,pct) 
     /press esc

| *** Auto Loot ***

   } else /if "$ChatCommand"=="loot" { 
     /stand
     /call AutoLoot
     /goto :return

| *** AUTOFOLLOW ***

   } else /if "$ChatCommand"=="follow" { 
     /target $lasttell
     /face
     /sit off 
     /follow 
     /g Lead on %T 
     /varset v10 0 

| *** Define Camp Spot ***

   } else /if "$ChatCommand"=="setcamp" { 
     /target myself 
     /delay 5 
     /varset XLOC $char(x)
     /varset YLOC $char(y)
     /g Ok. Here I sit.

| *** AUTORETURN (to camp)***

   } else /if "$ChatCommand"=="return" { 
:return
     /stand
     /face loc $YLOC,$XLOC 
     /call GotoLoc $YLOC,$XLOC
     /sit

| *** AUTOSTOP ***

   } else /if "$ChatCommand"=="stop" { 
     /press down 
     /varset v10 1 
     /say Stopping here. 

| *** SIT/STAND ***

   } else /if "$ChatCommand"=="sit" { 
     /sit 

| *** LFG ON ***

   } else /if "$ChatCommand"=="LFG" { 
     /delay 10 
     /target myself 
     /delay 10 
     /disband 
     /delay 10 
     /lfg on 
     /r LFG now. 

| *** CAMP ***

   } else /if "$ChatCommand"=="camp" { 
     /sit off 
     /sit 
     /camp 
     /delay 10 
     /unload 

| *** COMMAND HELP ***

   } else /if "$ChatCommand"=="command help" { 
     /reply "[CE] - Celestial Heal, [CH] - Complete Heal, [AC] - HP Buff, [HP] - HP Buff, [Heal] - Superior Heal, [Root] - Root Mob, [Gate] - Gate out, [Mana] - Report Mana, [Follow] - Follow, [Stop] - Stop Follow, [Loot] - Autoloot, [Setcamp] = Set camp spot, [Return] - Return to camp, [Sit] - Sit/Stand, [LFG] - LFG ON, [Camp] - Camp
            
   } 
/return 

Sub Event_Invited 
   /delay 20 
   /invite 
/return 

Sub Event_ClarityGone 
   /g Clarity just faded... 
/return 

Sub Event_InvisGone 
   /g Invis is wearing off. 
/return

Sub Event_RootGone 
   /g Root Wore off. 
/return

Sub Event_FollowOff 
   /if n $v10==1 { 
      /r Parked. 
   } else { 
      /g Lost ya. 
      /sendkey down up 
      :KeepRunning 
      /face 
          /if n $target(distance)<50 { 
             /sendkey up up 
             /follow 
             /varset v10 0 
             /g Back on Auto-Follow. go ahead. 
          } else { 
             /goto :KeepRunning 
          } 
       } 
/return

heres the loot.inc

Code: Select all

#Event CorpseTime "This corpse will decay in 0" 
#Event Looted "--You have looted a " 

Sub AutoLoot
   /target npc corpse radius 160
   /delay 5
   /con 
   /delay 5 
   /doevents 
   /if n $v4==1 /goto :Continue 
   /if n $target(distance)<15 /goto :LootCorpse 
   /sendkey down up 

   :FaceCorpse 
      /delay 0 
      /face 
      /if n $target(distance)>14 /goto :FaceCorpse 

   :LootCorpse 
      /sendkey up up 
      /loot 
      /delay 10 
      /varset v3 0 

   :Looting 
      /delay 0 
      /varset v5 $v3 
      /click right corpse $v3 
      /delay 5 
      /doevents 
      /if n $v3>$v5 /goto :Looting 
      /press esc 

   :Continue 
      /varset v4 0 

/return 

Sub Event_CorpseTime 
   /varset v4 1 
/return 

Sub Event_Looted 
   /varadd v3 1 
/return 
and the Spellsub.mac

Code: Select all

| - SpellSub.mac - 
| Spell Casting Sub routine - Usage "/call SpellSub <gem> <delay *actual cast time plus recast*>" 
| Will return $v99 = 999 if you go oom. 
| 
| Modified by GD to work with the 7-4-2002 Release 
| 
| modified by sempi to include sitting/standing and be more cleric oriented 
| 1. Complete Heal 
| 2. Divine Light 
| 3. Celestial Healing 
| 4. Remedy 
| 5. Symbol of Marzin (?) 
| 6. Heroic Bond 
| 7. Mark of Karn 
| 8. Mark of Retribution
|
| Modified by S_B_R to handle more events and relay more information to the person 
| issuing the command. Also removed the auto-sit function to help control aggro. 09-07-02 

#Event CastStart "You begin casting" 
#Event CastFizzle "Your spell fizzles!" 
#Event CastInterrupt "Your spell is interrupted." 
#Event CastNoMana "Insufficient Mana to cast this spell" 
#Event CastTooFar "Your target is out of range, get closer!" 
#Event CastTimer "You haven't recovered yet..." 
#Event CastResist "Your target resisted " 

Sub SpellSub 
   /varset v98 $p0 
   /varset v99 $p1 
   :ReCast 
   /sit off 
   /varset v1 2 
   /cast $v98 
   /delay 10 
   /doevents 
   /if n $v1==0 /goto :ReCast 
   /if n $v1>1 /goto :Failure 
/return 

:Failure 
   /if n $v1==2 { 
      /reply Spell failed for unknown reason... 
      /delay 5 
   } else /if n $v1==3 { 
      /reply You're too far away. Come back. 
      /delay 5 
   } else /if n $v1==4 { 
      /reply OOM 
      /delay 100 
      /sit on 
   } else /if n $v1==5 { 
      /reply Waiting for repop... 
   } else /if n $v1==6 { 
      /reply %T RESISTED. 
   } 
/return 

Sub Event_CastStart 
   /varset v1 1 
   /delay $v99 
/return 

Sub Event_CastFizzle 
   /varset v1 0 
/return 

Sub Event_CastInterrupt 
   /varset v1 0 
/return 

Sub Event_CastTooFar 
   /varset v1 3 
/return 

Sub Event_CastNoMana 
   /varset v1 4 
/return 

Sub Event_CastTimer 
   /varset v1 5 
/return 

Sub Event_CastResist 
   /varset v1 6 
/return
[/code]

Banned_From_EQ
orc pawn
orc pawn
Posts: 16
Joined: Mon Jun 24, 2002 7:01 pm

Post by Banned_From_EQ » Thu Nov 28, 2002 11:31 pm

Can you write ina script to report when at 20% mana to say LoM hold pulls?

Svarten
decaying skeleton
decaying skeleton
Posts: 3
Joined: Mon Dec 02, 2002 4:19 am
Location: Sweden

Post by Svarten » Mon Dec 02, 2002 5:43 am

Hello, I did some changes to your autoheal code, I don't realy think class is of that much importance, MaxHP is what is of importance... I havn't tested this yet, but it should work, I will probably do more changes after testing it though :)

EDIT: Ooops, forgot, you typed "Shadowknight" in one word, should be "Shadow Knight" for it to match :)

EDIT Again: Fixed code after debugging, unfortiunetly my inital Idea about Max HP don't work...

- Svarten

Code: Select all

Sub Main 
   /varset v69 $p0 
:chkevent 
   /doevents 
   | *** AutoHeal *** 

   /varcalc GroupMax $group(count)-1 
   /for GroupMember 0 to $GroupMax 
      /if n $spawn($group($GroupMember),hp,pct)>0 {
         /if "$GroupClass"=="Warrior" /goto :Tank
         /if "$GroupClass"=="Paladin" /goto :Tank 
         /if "$GroupClass"=="Shadow Knight" /goto :Tank
         /if "$GroupClass"=="Bard" /goto :Normal
         /if "$GroupClass"=="Monk" /goto :Normal
         /if "$GroupClass"=="Rogue" /goto :Normal
         /if "$GroupClass"=="Ranger" /goto :Normal
         /if "$GroupClass"=="Beastlord" /goto :Normal
         /if "$GroupClass"=="Cleric" /goto :Normal
         /if "$GroupClass"=="Druid" /goto :Normal
         /if "$GroupClass"=="Shaman" /goto :Normal
         /if "$GroupClass"=="Enchanter" /goto :Caster
         /if "$GroupClass"=="Wizard" /goto :Caster
         /if "$GroupClass"=="Necromancer" /goto :Caster
        /goto :nextmember

:Tank
  /if n $spawn($group($GroupMember),hp,pct)<51 {
    /if n $char(mana,pct)>75 /goto :CelestialHealing
  }
  /if n $spawn($group($GroupMember),hp,pct)<31 /goto :CompleteHeal
  /goto :nextmember

:Normal
  /if n $spawn($group($GroupMember),hp,pct)<71 {
    /if n $char(mana,pct)>75 /goto :CelestialHealing
  }
  /if n $spawn($group($GroupMember),hp,pct)<51 /goto :CelestialHealing
  /if n $spawn($group($GroupMember),hp,pct)<31 /goto :DivineLight
  /goto :nextmember

:Caster
  /if n $spawn($group($GroupMember),hp,pct)<71 {
    /if n $char(mana,pct)>75 /goto :CelestialHealing
  }
  /if n $spawn($group($GroupMember),hp,pct)<51 /goto :DivineLight
  /if n $spawn($group($GroupMember),hp,pct)<31 /goto :Remedy
  /goto :nextmember

:CompleteHeal
         /if n $group($GroupMember)==$char(id) /press F1 
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
         /stand 
         /delay 5
         /face 
         /g Complete Heal on %T 
         /call SpellSub 1 105 
         /sit 
         /goto :nextmember

:DivineLight
         /if n $group($GroupMember)==$char(id) /press F1 
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
         /stand 
         /delay 5
         /face 
         /g Divine Light on %T 
         /call SpellSub 2 50 
         /sit 
         /goto :nextmember

:Remedy
         /if n $group($GroupMember)==$char(id) /press F1 
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
         /stand 
         /delay 5
         /face 
         /g Remedy on %T 
         /call SpellSub 3 35 
         /sit 
         /goto :nextmember

:CelestialHealing
         /if n $group($GroupMember)==$char(id) /press F1 
         /if n $group($GroupMember)!=$char(id) /target id $group($GroupMember) 
         /stand 
         /delay 5
         /face 
         /g Celestial Healing on %T 
         /call SpellSub 4 45 
         /sit 
         /goto :nextmember

:nextmember 
      } 
   /next GroupMember 
   /goto :chkevent 
/return 

I R monk
orc pawn
orc pawn
Posts: 28
Joined: Tue Dec 10, 2002 4:29 pm

Post by I R monk » Tue Dec 10, 2002 4:36 pm

Nice macro might I sugest you change it form
/face
/delay 11
/stand

to

/stand
/delay 11
/face

and also noticed some problems with $lasttell corupting over time might change to

$p1

tryed the last changes sugested by Svarten
wouldnt recomend them, with the heal over time cleric spells it takes time to start so the cleric ends up casting the spell 2 to 3 times, waist way to much mana.

Svarten
decaying skeleton
decaying skeleton
Posts: 3
Joined: Mon Dec 02, 2002 4:19 am
Location: Sweden

Post by Svarten » Tue Dec 10, 2002 7:17 pm

When I get the energy to do it, I will put in a timer on the DoT Heals so they don't continualy trigger... Just don't feel I need them right now so have them comented out atm :)

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Fri Jan 17, 2003 7:34 pm

Hmm, I was trying both the original of this, and the modded version, working with a druid rather then a cleric, and it ends the mac as soon as I start it.

I've been looking through the code, and I just can't seem to find the reason for it, anyone have any ideas?

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Fri Jan 17, 2003 7:45 pm

Ok, figured out that the mac is still running after it says the macro has ended, now I'm just tyring to figure out WHAT macro has ended...

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

Subject? Whats that?

Post by SingleServing » Fri Jan 17, 2003 9:28 pm

insanitywiz wrote:Ok, figured out that the mac is still running after it says the macro has ended, now I'm just tyring to figure out WHAT macro has ended...
Are you using his loot and spell code?

Did you change the spells to reflect druid spells and names?

Just some ideas.
[color=DarkBlue]Everything,[/color] [color=DarkBlue][b]is[/b][/color] [color=black]black[/color] [color=DarkBlue]and[/color] [color=white]white[/color][color=DarkBlue], when you zoom out it looks[/color] [color=gray]grey[/color][color=DarkBlue].[/color]

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Sun Jan 19, 2003 4:01 am

Yes, changed the spells to be druid, and I am using all his includes except loot, because I use the new UI and loot uses clicks. Will have to break it down into components to see whats going on.