Wolf5's Amazing Beastlord Macro

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Saelinye
a lesser mummy
a lesser mummy
Posts: 31
Joined: Thu Jun 03, 2004 8:17 am

Wolf5's Amazing Beastlord Macro

Post by Saelinye » Tue Jun 15, 2004 8:22 am

Just wanted this in correct Forum... It was in pre-data for some reason.

Wolf5 is the original developer and deserves full credit.. im just moving the post.

Code: Select all

#event SelfSlain "#*#You have been slain by#*# " 
#event SlainTarget "#*#You have slain#*# " 
#event NoOverWrite "Your spell would not have taken hold on your target." 
#event LostTarget "#*#You no longer have a target#*#" 
#event Encumbered "#*#You are encumbered!#*# " 

#turbo 30 
#include spellcast.inc 


#define THE_SLACK_DEGREE 25 
#define SEARCH_RADIUS 499 

|If the PCT of your pet and yourself differs from this number, you will back off 
#define LET_PET_TANK_IF_DIFFERENCE 20 

#define LOOT_ABOVE_LEVEL 20 
#define LOOT_ITEMS False 
#define INITIALIZE_ATTACK_RANGE 150 

#define ARE_WE_RESTLESS True 
#define RESTLESS_RANGE 200 

#define FORCE_ATTACK_WHEN_MOB_BELOW 30 

#define MAX_RANGE_FROM_HOMEPOINT 1000 

#define ALLWAYS_HAVE_PET True 
#define MAX_PET_RANGE_BEFORE_SUMMON 250 
#define PET_SPELL "Spirit of Zehkes" 
#define PET_GEM 7 


#define DO_SLOW_ON_PULL True 
#define SEND_PET_BEFORE_SLOW True 
#define SLOW_GREENS False 
#define SLOW_ABOVE_LEVEL 30 
#define SLOW_SPELL "Sha's Lethargy" 
#define SLOW_GEM 2 

#define DO_NUKE_ON_PULL True 
#define NUKE_ABOVE_MANA_PCT 80 
#define NUKE_ABOVE_LEVEL 30 
#define NUKE_SPELL "Ice Shard" 
#define NUKE_GEM 1 

#define HEAL_BELOW_PCT 65 
#define HEAL_SPELL "Healing" 
#define HEAL_GEM 4 
#define ALARM_HEALTH_BELOW_PCT 40 

#define HEAL_PET_BELOW_PCT 50 
#define HEAL_PET_SPELL "Sha's Restoration" 
#define HEAL_PET_GEM 5 

#define MIN_MANA_BEFORE_MEDITATE 30 

|Buffs to be kept up on self 
#define SELF_SPELL1 "Spirit of Wolf" 
#define SELF_GEM1 8 
#define SELF_SPELL2 "Chloroplast" 
#define SELF_GEM2 6 
#define SELF_SPELL3 "Deftness" 
#define SELF_GEM3 3 
#define SELF_SPELL4 "Furious Strength" 
#define SELF_GEM4 3 
#define SELF_SPELL5 "Spiritual Radiance" 
#define SELF_GEM5 3 
#define SELF_SPELL6 "Frenzy" 
#define SELF_GEM6 6 

|Buffs to be kept up on pet 
#define PET_SPELL1 "Spirit of Wolf" 
#define PET_GEM1 8 
#define PET_SPELL2 "Spirit of the Storm" 
#define PET_GEM2 6 
#define PET_SPELL3 "Bond of the Wild" 
#define PET_GEM3 3 
#define PET_SPELL4 "Deftness" 
#define PET_GEM4 4 

|-------------------------------------------------------------------------------- 
|SUB: Main 
|-------------------------------------------------------------------------------- 
Sub Main 
   /echo Starting macro 
   /declare rand int outer       |random var 
   /declare rand2 int outer       |random var 
   /declare TargetDist float outer   |Distance to Target 
   /declare TargetLevel int outer   |Level of Target 
   /declare TargetName string outer |Name of Target 

   /declare tmp string outer      |Just a tmp string 
   /declare tmpint int outer      |Just a tmp int 
   /declare tmpint2 int outer      |Just a tmp int 
   /declare tmpint3 int outer      |Just a tmp int 
   /declare tmpint4 int outer      |Just a tmp int 
   /declare killcnt int outer      |Kill counter (loot counter) 
   /varset killcnt 0 
    
   /declare homeX float outer      |Our homepoint 
   /declare homeY float outer      |Our homepoint 
   /declare rndX float outer      |Our homepoint 
   /declare rndY float outer      |Our homepoint 
   /varset homeX ${Me.X} 
   /varset homeY ${Me.Y} 
   /varset rndX ${Me.X} 
   /varset rndY ${Me.Y} 
    
   /echo Homepoint: ${Me.X} ${Me.Y} 

   /declare leftdown bool outer   |Are we turning left 
   /declare rightdown bool outer   |Are we turning right 
   /declare forwarddown bool outer |Are we moving forward 
   /declare petattacking bool outer    |Is pet attacking 

   /declare theslack int outer    |the global slack on FaceTarget 
   /varset theslack THE_SLACK_DEGREE 

   /declare oldposx float outer   |Used to determine if we are stuck 
   /declare oldposy float outer   |Used to determine if we are stuck 

   /declare slackcounter int outer   |Used to unstuck ourselves 
   /declare slackchance int outer   |Used to unstuck ourselves 
   /varset slackcounter 10000       

   /declare cnt1 int outer 
   /varset cnt1 0 

   /declare waitcounter int outer   |How many times shall we get no target found before we do something (run/wait/gohome) 
   /varset waitcounter 0 



   |Getting targets 
   /declare numbtargs int outer     
   /declare target1 string outer 
   /if (${Defined[Param0]}) /varset target1 ${Param0} 

   /varcalc numbtargs ${target1.Count["|"]} + 1 
   /declare targets[${numbtargs}] string outer     

   /echo Targets: ${numbtargs} 
   /varset tmpint4 1 
:nexttarget 

   /varcalc tmpint ${target1.Find["|"]} - 1 
   /if ( ${tmpint}>-1 ) { 
      /varcalc tmpint2 ${target1.Length} - ${tmpint} - 1 
       /echo targets[${tmpint4}] ${target1.Left[${tmpint}]} 

       /varset targets[${tmpint4}] ${target1.Left[${tmpint}]} 
       /varcalc tmpint4 ${tmpint4} + 1 

       /varset target1 ${target1.Right[${tmpint2}]} 
       
      /goto :nexttarget 

   } else { 
       /echo targets[${tmpint4}] ${target1} 
       /varset targets[${tmpint4}] ${target1} 
   } 


   /declare repeat bool outer 
    
   /declare myRequiredTarget bool outer 
   /goto :FirstTime 

|The main loop. After an attack we go here to aquire a new target 
:MainLoop1 
   /doevents 
   /varset TargetLevel ${Target.Level} 
   /varset TargetName ${Target.CleanName} 
   /call StopAttack 
   |/echo mainloop 


   /if ( ${Target.ID} && ${Target.Type.Equal["NPC"]} ) { 
      /echo Fight in progress: ${Target.CleanName} 
      /goto :MainAttackLoop 
   } 
   /varset cnt1 ${Math.Calc[${cnt1} + 1]} 
   /if ( ${cnt1}>=3 ) { 
      /call AssistPet 
      /delay 1s 
      /varset cnt1 0 
      /varset TargetLevel ${Target.Level} 
      /varset TargetName ${Target.CleanName} 
       
      /if ( ${Target.ID} && ${Target.Type.Equal["NPC"]} ) { 
         /echo Assisting pet: ${Target.CleanName} 
         /varset petattacking True 
         /goto :MainAttackLoop 
      } 
   } 
    
    
   /if ( ${Target.ID} ) /keypress ESC 

:FirstTime 

   /call MoveForwardStop 

   /varset repeat False 
   /varset myRequiredTarget False 
    
| Check if we are low on mana or health. Heal or sit down if low 
   /call ManaAndHealth    
   /if ( ${repeat} ) /goto :MainLoop1 

| Make sure pet is up + all its buffs are on it 
   /call MaintainPet 
   /if ( ${repeat} ) /goto :MainLoop1 

| Make sure all buffs on self are up 
   /call MaintainSelf 
   /if ( ${repeat} ) /goto :MainLoop1 
    
| If I don't have a target, aquire a new target 
   |/echo Target: ${Target.CleanName} 


   /varset petattacking False 
   /if ( !${Target.ID}  ) { 
| Target next NPC 
      |/echo Do target 
      /varset TargetDist ${Math.Distance[${homeY},${homeX},0:${Me.Y},${Me.X},0]} 
      /if ( ${TargetDist}>MAX_RANGE_FROM_HOMEPOINT ) { 
         |Run to homespot 
         /echo To far away (${TargetDist})! Running home. 
         /call RunToSpot ${homeX} ${homeY} 
         /call MoveForwardStop 

         /if ( ${TargetDist}<40 ) /varset waitcounter 0 

         /goto :MainLoop1 
      } 

      /call TargetIt 

      /varset TargetDist ${Math.Distance[${homeY},${homeX},0:${Me.Y},${Me.X},0]} 
      /if ( ${TargetDist}>40 ) { 
         |If we are not at homespot, count till we run home 
         /varset waitcounter ${Math.Calc[${waitcounter} + 1]} 
      } else { 
         |If we are restless, run around after a little while 
         /if ( ${Bool[ARE_WE_RESTLESS]} ) { 
            /varset waitcounter ${Math.Calc[${waitcounter} - 1]} 
       
            /if ( ${waitcounter}<-5 ) { 
:Retarget 
               /echo We are restless. Running a bit. ${rndX}, ${rndY} 
                /for tmpint 0 to 10 
                  /call StepToSpot ${rndX} ${rndY} 
                  /delay 1 
                /next tmpint  
                /call MoveForwardStop 
    
               /call TargetIt 

               /varset TargetDist ${Math.Distance[${rndY},${rndX},0:${Me.Y},${Me.X},0]} 
               /if ( ${TargetDist}<40 ) { 
                  /varset waitcounter 0 
                  /if ( ${Math.Rand[10]} < 5 ) { 
                     /varset rndX ${Math.Calc[ ${Me.X} + ${Math.Rand[RESTLESS_RANGE]} * 2 ]} 
                  } else { 
                     /varset rndX ${Math.Calc[ ${Me.X} - ${Math.Rand[RESTLESS_RANGE]} * 2 ]} 
                  } 
                  /if ( ${Math.Rand[10]} < 5 ) { 
                     /varset rndY ${Math.Calc[ ${Me.Y} + ${Math.Rand[RESTLESS_RANGE]} * 2 ]} 
                  } else { 
                     /varset rndY ${Math.Calc[ ${Me.Y} - ${Math.Rand[RESTLESS_RANGE]} * 2 ]} 
                  } 
                  /varset waitcounter 0 
                  /goto :MainLoop1 
               } 
                
               /if ( !${Target.ID} ) /goto :Retarget 
            } 
         } 
          
      } 

      /if ( !${Target.ID} && ${waitcounter}==1 ) { 
         /if ( !${Me.Sitting} ) /sit 
      } 

      /if ( ${waitcounter}>3 ) { 
         |Run to homespot 
         /echo Running home. 

         /for rand 0 to 5 
            /call StepToSpot ${homeX} ${homeY} 
            /delay 1 
         /next rand  
         /call MoveForwardStop 

         /varset TargetDist ${Math.Distance[${homeY},${homeX},0:${Me.Y},${Me.X},0]} 
         /if ( ${TargetDist}<40 ) /varset waitcounter 0 

         /goto :MainLoop1 
      } 

      /if (!${Target.ID}) { 
            /delay 4s 
             /goto :MainLoop1 
       } 

      /varset myRequiredTarget True 
       
      |A target. If its 100% we go for it 
      /if ( ${Target.ID} && ${Target.PctHPs}<100 ) { 
         /echo Target aquired is < 100% 
         /keypress ESC 
         /delay 2s 
         /goto :MainLoop1    
      } 

      /varset TargetLevel ${Target.Level} 
      /varset TargetName ${Target.CleanName} 
   } 
    
   |Not having a npc in target means we have to try again 
   /if ( !${Target.Type.Equal["NPC"]} ) { 
      /delay 1s 
      /keypress ESC 
      /goto :MainLoop1 
   } 

   /echo Target: ${Target.CleanName} ${Target.Level} ${Target.Class} 


|The main attack loop - Here all the attacking will take place 
:MainAttackLoop 
   /doevents 
   /varset waitcounter 0 
    
   |Beep when we get below alarm health level 
   /if ( ${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT ) { 
      /beep 
   } 

   /if ( !${Target.ID} ) { 
      /echo Ending fight, No Target 
       
      /call MoveForwardStop 
       
      /call DoTheLooting 

      /if ( ${Target} ) {   /keypress ESC 

   } 
    
   |Assisting pet 
   /if (!${Target.ID}) { 
      /call AssistPet 
:WaitUntill 
      /if ( ${Target.Type.Equal["Pet"]} ) { 
         /delay 1 
         /goto :WaitUntill 
      } 
   } 

   |/echo TargetType: ${Target.Type} 

   /if (!${Target.ID} || ${Target.Type.Equal["Corpse"]}) { 
      /call MoveForwardStop 
      /delay ${Math.Rand[30]} 
      /goto :MainLoop1 
   } 
    
   /if ( !${Target.Type.Equal["NPC"]} ) { 
      /call MoveForwardStop 
      /delay ${Math.Rand[70]} 
      /echo Ending fight, No NPC 
      /keypress ESC 
      /goto :MainLoop1 
   } 

|   Stop when close so we dont run around in circle and KICK 
   /varset TargetDist ${Math.Calc[ ${Target.DistancePredict} - (${Target.MaxRangeTo}/1.2) ]} 
   /if (${TargetDist}<6) { 
      /if ( ${Me.AbilityReady["kick"]} ) /doability "kick" 
      /call MoveForwardStop 
   } 
    
    
|   Initialize attack 
   /if ( ${TargetDist}<INITIALIZE_ATTACK_RANGE && !${petattacking} ) { 
      /if ( ${Target.PctHPs}<100 && ${myRequiredTarget} ) { 
         | If this target is below 100% and I targeted it manually it is probably just snatched before me 
         /keypress ESC 
         /echo Ending fight, Target < 100% 
         /goto :MainLoop1 
      } 

      /if (${Bool[SEND_PET_BEFORE_SLOW]}) { 
         /pet attack 
         /varset petattacking True 
         /echo Attacking ${Target.CleanName}! 
      } 

      /if (${Bool[DO_SLOW_ON_PULL]}) { 
         /if ( ${Bool[SLOW_GREENS]} || ( !${Bool[SLOW_GREENS]} && !${Target.ConColor.Equal["GREEN"]} ) ) { 
            /if ( ${Target.Level}>SLOW_ABOVE_LEVEL) { 
               /echo Casting slow! 
               /call Cast "SLOW_SPELL" gem2 
            } 
         } 
      } 

      /if (!${Me.Combat} && ${Target.PctHPs}<100) { 
         | Someone else grabbed it before I got the chance to charge (maybe during slow) 
         /pet back 
         /delay 1 
         /pet back 
         /keypress ESC 
         /echo Ending fight, Not Attacking + Target < 100% before Slow went in 
         /goto :MainLoop1    
      } 

      /if (!${Bool[SEND_PET_BEFORE_SLOW]}) { 
         /pet attack 
         /varset petattacking True 
         /echo Attacking ${Target.CleanName}! 
      } 
       
      /call DoTheNuke 
   } 
    
   /if ( ${TargetDist}>200) { 
      |If we are not attacking and the health of the mob is below 100% asume someone else has it. back off! 
      /if (!${Me.Combat} && ${Target.PctHPs}<100) { 
         /echo Ending fight, Not Attacking + Target < 100% 
         /keypress ESC          
         /goto :MainLoop1    
      } 
   } 

   /if ( ${Target.Type.Equal["NPC"]} && ${Target.PctHPs}>FORCE_ATTACK_WHEN_MOB_BELOW ) /call BackoffForPet 

   /call CheckGM 
   /call StepToTarget 
    
   /delay 1 

   |If we are moving forward, check if we are stuck, and remedy it if we are    
   /if (${forwarddown}) /call StuckFixTarget 

   |Add a little bit of strafing - Add to natural movement 
   /varset rand ${Math.Rand[600]} 
   /if ( ${rand}<100 ) { 
      /keypress strafe_right hold    
   } else /if ( ${rand}<200 ) { 
      /keypress strafe_left hold    
   } else 
      /keypress strafe_right 
      /keypress strafe_left 
   } 


   /goto :MainAttackLoop 
    
:EndMacro 
/endmacro 

Sub DestroyCopper 
   /windowstate InventoryWindow open 
   /shift /notify InventoryWindow IW_Money3 leftmouseup 
   |Are we sure we want to destroy it? Give me 10 seconds to drop in autoinv 
   /delay 1s 
   /destroy 
   |/windowstate InventoryWindow close 
   /keypress I 
/return 

Sub DestroySilver 
   /windowstate InventoryWindow open 
   /shift /notify InventoryWindow IW_Money2 leftmouseup 
   |Are we sure we want to destroy it? Give me 10 seconds to drop in autoinv 
   /delay 1s 
   /destroy 
   /keypress I 
   |/windowstate InventoryWindow close 
/return 

|-------------------------------------------------------------------------------- 
|SUB: TargetIt 
|-------------------------------------------------------------------------------- 
Sub TargetIt 
   /for tmpint 1 to ${numbtargs} 
      /target npc radius SEARCH_RADIUS nopcnear 200 ${targets[${tmpint}]} 
      /if ( ${Target.ID} ) /return 
   /next tmpint 
/return 

|-------------------------------------------------------------------------------- 
|SUB: DoTheNuke 
|-------------------------------------------------------------------------------- 
Sub DoTheNuke 
   /if (${Bool[DO_NUKE_ON_PULL]}) { 
      /if ( ${Me.PctMana}>NUKE_ABOVE_MANA_PCT) { 
         /if ( ${Target.Level}>SLOW_ABOVE_LEVEL) { 
            /call Cast "NUKE_SPELL" gem1 
         } 
      } 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: BackoffForPet 
|-------------------------------------------------------------------------------- 
Sub BackoffForPet 
   /declare TargDist float local 
   /if ( ${Math.Calc[ ${Me.Pet.PctHPs} - ${Me.PctHPs} ]} > LET_PET_TANK_IF_DIFFERENCE ) { 
      /keypress back hold 
:BackOff1 
      /varset TargDist ${Math.Calc[ ${Target.Distance} - (${Target.MaxRangeTo}/1.2) - 15 ]} 
      /if ( ${TargDist}<0 ) { 
         /delay 1 
         /goto :BackOff1 
      } 
      /attack off 
      /keypress back 
       
:Repeat1 


      /echo Letting pet tank some! 
      /call MaintainPet 
      /keypress ESC 
      /if ( !${Me.Sitting} ) /sit 
      |/delay 1s 
      |/if ( ${Target.ID} ) /return 
             
      |What if mob is dead 
      /call AssistPet 
      /delay 1s 
      /if ( !${Target.Type.Equal["Corpse"]} ) /return 

      /if ( !${Target.ID} ) /return 
       
      /if ( ${Target.PctHPs}<FORCE_ATTACK_WHEN_MOB_BELOW ) /return 

      /if ( !${Me.Sitting} ) /sit 
       
      /call MaintainSelf 

      /if ( !${Me.Sitting} ) /sit 
      |Nuke some! 
      /call DoTheNuke 

      /if ( !${Me.Sitting} ) /sit 

      |Will wait and help the pet til it reaches same % of health as self 
      /if ( ${Math.Calc[ ${Me.Pet.PctHPs} - ${Me.PctHPs} ]} > 0 ) /goto :Repeat1 
      /call MaintainPet 
   }    
/return 

|-------------------------------------------------------------------------------- 
|SUB: StartAttack 
|-------------------------------------------------------------------------------- 
Sub StartAttack 
   /if ( !${Me.Combat} ) /attack on 
/return 

|-------------------------------------------------------------------------------- 
|SUB: StopAttack 
|-------------------------------------------------------------------------------- 
Sub StopAttack 
   /if ( ${Me.Combat} ) /attack off 
/return 

|-------------------------------------------------------------------------------- 
|SUB: AssistPet 
|-------------------------------------------------------------------------------- 
Sub AssistPet 
   /if ( !${Target.ID} ) { 
      |/pet target 
      |/delay 2 
      /keypress ESC 
      /keypress F1 
      /keypress F1 
      /assist 
      /delay 2 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: StepToTarget 
|-------------------------------------------------------------------------------- 
Sub StepToTarget(float X, float Y) 
   |When stuck, run towards target with a large slack (120 degrees) for a little while - narrowing the slack 
   /if ( ${theslack} == 95   ) { 
      /varset theslack 94 
      /varset slackcounter 0 
      /varset slackchance ${Math.Calc[${Math.Rand[80]}]} 
   } 
   /if ( ${theslack} > THE_SLACK_DEGREE   ) { 
      /varset slackcounter ${Math.Calc[${slackcounter}+1]} 
   } 
   /if ( ${slackcounter} == 20 ) { 
      /varset theslack 70 
   } 
   /if ( ${slackcounter} == 40 ) { 
      /varset theslack 50 
   } 
   /if ( ${slackcounter} == 60 ) { 
      /varset theslack 30 
   } 
   /if ( ${slackcounter} == ${slackchance} ) { 
      /varset theslack THE_SLACK_DEGREE 
      /varset slackcounter 10000 
   } 
   |/echo Counter: ${slackcounter} 

   /call FaceTarget 

   /declare TargDist float local 
   /varset TargDist ${Math.Calc[ ${Target.DistancePredict} - (${Target.MaxRangeTo}/1.2) ]} 
    
   /if ( ${TargDist} < 0 ) { 
      /call StartAttack 
      /call MoveForwardStop 
      /return 
   } 

   /call MoveForward 

/return 

|-------------------------------------------------------------------------------- 
|SUB: DoTheLooting 
|-------------------------------------------------------------------------------- 
Sub DoTheLooting 
   /if (${TargetLevel}>LOOT_ABOVE_LEVEL) { 
      /target ${TargetName}'s corpse 
      /delay 1s 
      /call RunToSpotTarget 
      /if ( ${Target.Type.Equal["Corpse"]} ) { 
         /varcalc killcnt ${killcnt}+1 
         /echo Looting corpse #${killcnt} 
         /call LootMob 
         /varset theslack THE_SLACK_DEGREE 
         /varset slackcounter 10000 
         |/varset oldposx 99999 
         |/varset oldposy 99999 
         /call MoveForward 
      } 
   } else { 
      /keypress ESC 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: ManaAndHealth 
|-------------------------------------------------------------------------------- 
Sub ManaAndHealth 
   /if ( ${Me.PctHPs}<HEAL_BELOW_PCT && ${Me.PctMana}<50 ) { 
      /delay 1s 
      /if ( !${Me.Sitting} ) /sit 
      /varset repeat True 
      /return 
   } 


   |Meditate? 
   /if ( ${Me.PctMana}<MIN_MANA_BEFORE_MEDITATE ) { 
      /echo Mana below MIN_MANA_BEFORE_MEDITATE%. Meditating. 
      /if ( !${Me.Sitting} ) /sit 
      /delay 10s 
      /if ( ${Me.PctMana}<MIN_MANA_BEFORE_MEDITATE ) { 
         /varset repeat True 
         /return 
      } 
      /echo Mana OK now. 
   } 
    
    
   |Heal? 
   /if ( ${Me.PctHPs}<HEAL_BELOW_PCT ) { 
      /target ${Me.Name} 
      /call Cast "HEAL_SPELL" gemHEAL_GEM 
      /if ( !${Me.Sitting} ) /sit 
      /varset repeat True 
      /return 
   } 
/return 



|-------------------------------------------------------------------------------- 
|SUB: MaintainPet 
|-------------------------------------------------------------------------------- 
Sub MaintainPet 
   |If we have pet    
   /varset tmp ${Me.Pet} 
   /if ( ${Bool[ALLWAYS_HAVE_PET]} ) { 
      /if ( ${tmp.Equal["NULL"]} ) { 
         /echo Creating new pet 
         /call Cast "PET_SPELL" gemPET_GEM 
         /varset repeat True 
         /return 
      } 
    
      /if ( MAX_PET_RANGE_BEFORE_SUMMON>0 ) { 
         /if ( ${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON ) { 
            /echo Summoning pet. Its range is ${Me.Pet.Distance} 
            /call Cast "Summon Companion" gem7 
            /delay 1s 
            /varset repeat True 
            /return 
         } 
       
      } 
      |KeepUpBuffsOnPet 
      /varset tmp ${Me.PetBuff["PET_SPELL1"]} 
      /if ( ${tmp.Equal["NULL"]} ) { 
         /target ${Me.Pet.Name} 
         /call Cast "PET_SPELL1" gemPET_GEM1 
         /varset repeat True 
         /return 
      } 
      /varset tmp ${Me.PetBuff["PET_SPELL2"]} 
      /if ( ${tmp.Equal["NULL"]} ) { 
         /target ${Me.Pet.Name} 
         /call Cast "PET_SPELL2" gemPET_GEM2 
         /varset repeat True 
         /return 
      } 
      /varset tmp ${Me.PetBuff["PET_SPELL3"]} 
      /if ( ${tmp.Equal["NULL"]} ) { 
         /target ${Me.Pet.Name} 
         /call Cast "PET_SPELL3" gemPET_GEM3 
         /varset repeat True 
         /return 
      } 
      /varset tmp ${Me.PetBuff["PET_SPELL4"]} 
      /if ( ${tmp.Equal["NULL"]} ) { 
         /target ${Me.Pet.Name} 
         /call Cast "PET_SPELL4" gemPET_GEM4 
         /varset repeat True 
         /return 
      } 
      /if ( ${Me.Pet.PctHPs}<HEAL_PET_BELOW_PCT ) { 
         /keypress ESC 
         /keypress F1 
         /keypress F1 
         /call Cast "HEAL_PET_SPELL" gemHEAL_PET_GEM 
         /if ( !${Me.Sitting} ) /sit 
         /varset repeat True 
      /return 
   } 

   } 
/return 



|-------------------------------------------------------------------------------- 
|SUB: MaintainSelf 
|-------------------------------------------------------------------------------- 
Sub MaintainSelf 
   |KeepUpBuffsOnMe 
   /varset tmp "SELF_SPELL1" 
   /if ( ${tmp.Length}>0 ) { 
      /if ( !${Me.Buff["SELF_SPELL1"].ID} ) { 
         /target ${Me.Name} 
         /call Cast "SELF_SPELL1" gemSELF_GEM1 
         /varset repeat True 
         /return 
      } 
   } 
   /varset tmp "SELF_SPELL2" 
   /if ( ${tmp.Length}>0 ) { 
      /if ( !${Me.Buff["SELF_SPELL2"].ID} ) { 
         /target ${Me.Name} 
         /call Cast "SELF_SPELL2" gemSELF_GEM2 
         /varset repeat True 
         /return 
      } 
   } 
   /varset tmp "SELF_SPELL3" 
   /if ( ${tmp.Length}>0 ) { 
      /if ( !${Me.Buff["SELF_SPELL3"].ID} ) { 
         /target ${Me.Name} 
         /call Cast "SELF_SPELL3" gemSELF_GEM3 
         /varset repeat True 
         /return 
      } 
   } 
   /varset tmp "SELF_SPELL4" 
   /if ( ${tmp.Length}>0 ) { 
      /if ( !${Me.Buff["SELF_SPELL4"].ID} ) { 
         /target ${Me.Name} 
         /call Cast "SELF_SPELL4" gemSELF_GEM4 
         /varset repeat True 
         /return 
      } 
   } 
   /varset tmp "SELF_SPELL5" 
   /if ( ${tmp.Length}>0 ) { 
      /if ( !${Me.Buff["SELF_SPELL5"].ID} ) { 
         /target ${Me.Name} 
         /call Cast "SELF_SPELL5" gemSELF_GEM5 
         /varset repeat True 
         /return 
      } 
   } 
   /varset tmp "SELF_SPELL6" 
   /if ( ${tmp.Length}>0 ) { 
      /if ( !${Me.Buff["SELF_SPELL6"].ID} ) { 
         /target ${Me.Name} 
         /call Cast "SELF_SPELL6" gemSELF_GEM6 
         /varset repeat True 
         /return 
      } 
   } 
/return 



|-------------------------------------------------------------------------------- 
|SUB: MoveForward 
|-------------------------------------------------------------------------------- 
Sub MoveForward 
   /keypress forward hold 
   /varset forwarddown True 
/return 
Sub MoveForwardStop 
   /if ( ${forwarddown} ) { 
      /keypress forward 
      /varset forwarddown False 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: MoveLeft 
|-------------------------------------------------------------------------------- 
Sub MoveLeft 
   /keypress left hold 
   /varset leftdown True 
/return 
Sub MoveLeftStop 
   /if ( ${leftdown} ) { 
      /keypress left 
      /varset leftdown False 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: MoveRight 
|-------------------------------------------------------------------------------- 
Sub MoveRight 
   /keypress right hold 
   /varset rightdown True 
/return 
Sub MoveRightStop 
   /if ( ${rightdown} ) { 
      /keypress right 
      /varset rightdown False 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: FaceTarget 
|-------------------------------------------------------------------------------- 
Sub FaceTarget 
   /call FacePosition ${Target.X} ${Target.Y} 
/return 

|-------------------------------------------------------------------------------- 
|SUB: FacePosition 
|-------------------------------------------------------------------------------- 
Sub FacePosition(float X, float Y) 
   |Face towards target - At a 'slack' degrees slack - more natural 
    
   /declare currdeg int local    
   /varset currdeg ${Me.Heading.DegreesCCW} 

   /declare targdeg string local    
   /varset targdeg ${Heading[${Y},${X}].DegreesCCW} 

   /if ( ${currdeg}<${targdeg} ) { 
      /if ( ${Math.Abs[${currdeg}-${targdeg}]} > ${theslack} ) { 
         /if (${Math.Calc[${targdeg}-${currdeg}]} < 180 ) { 
            /call MoveLeft 
            /delay ${Math.Rand[2]} 
         } else { 
            /call MoveRight 
            /delay ${Math.Rand[2]} 
         } 
      } else { 
         /call MoveLeftStop 
         /call MoveRightStop 
      } 
   } else { 
      /if ( ${Math.Abs[${targdeg}-${currdeg}]} > ${theslack} ) { 
         /if (${Math.Calc[${currdeg}-${targdeg}]} < 180 ) { 
            /call MoveRight 
            /delay ${Math.Rand[2]} 
         } else { 
            /call MoveLeft 
            /varset leftdown True 
            /delay ${Math.Rand[2]} 
         } 
      } else { 
         /call MoveLeftStop 
         /call MoveRightStop 
      } 
   } 

/return 

|-------------------------------------------------------------------------------- 
|SUB: StuckFixTarget 
|-------------------------------------------------------------------------------- 
Sub StuckFixTarget 
   /declare targpct int local 
   /varset targpct ${Target.PctHPs} 
   /if ( ${Target.ID} ) { 
      /if ( ${targpct}==100 ) { |To prevent movement during fight when one stands still 
         /call StuckFix 
      } 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: StuckFix 
|-------------------------------------------------------------------------------- 
Sub StuckFix 
   /declare moved float local 
   /declare rnd int local 

   |Trying to get out of a spot where we are stuck 
   /varset moved ${Math.Distance[${oldposy},${oldposx},0:${Me.Y},${Me.X},0]} 
    
   /varset rnd ${Math.Rand[1500]} 
    
   /if ( ${moved}<100 ) { 
      /if ( ${rnd}<250 ) { 
         /if ( ${moved}<0.10 ) { 
            /echo Back off1 
            /keypress back hold 
            /delay ${Math.Rand[15]} 
            /call MoveRight 
            /delay ${Math.Rand[15]} 
            /keypress back 
            /call MoveRightStop 
            /varset theslack 95 
         } 
      } else /if ( ${rnd}<500 ) { 
         /if ( ${moved}==0 ) { 
            /echo Back off2 
            /keypress back hold 
            /delay ${Math.Rand[15]} 
            /call MoveLeft 
            /delay ${Math.Rand[15]} 
            /keypress back 
            /call MoveLeftStop 
            /varset theslack 95 
         }       
      } else { 
         |/echo Dont back off 
         |There is a chance to do nothing. 
      } 
   } 

   /varset oldposx ${Me.X} 
   /varset oldposy ${Me.Y} 

/return 

|-------------------------------------------------------------------------------- 
|SUB: CheckGM 
|-------------------------------------------------------------------------------- 
Sub CheckGM 
   /if (${Spawn[gm].ID}) { 
      /echo "QUITTING" 
         /endmacro 
   } 
/return 


|-------------------------------------------------------------------------------- 
|SUB: RunToSpot 
|-------------------------------------------------------------------------------- 
Sub RunToSpotTarget 
   /varset tmp ${Target} 
   /if ( ${tmp.Equal["NULL"]} ) /return 
   /call RunToSpot ${Target.X} ${Target.Y} 
/return 


Sub StepToSpot(float X, float Y) 
      /declare TargDist float local   |Distance to Target 
|:RunLoop 
|bytt til RANGE istedet for antall sekunder bak 
      /call FacePosition ${X} ${Y} 
      /varset TargDist ${Math.Distance[${Y},${X},0:${Me.Y},${Me.X},0]} 
      /if ( ${TargDist}<20 ) /return 
      /call MoveForward 
      /delay 2 
      /echo Distance to target ${TargDist} 
       
      /if (${forwarddown}) { 
         /call StuckFix 
      } 
       
      /if ( ${TargDist}<5 ) { 
         |/echo We are HOOOOOOOOME! 
         /call MoveForwardStop 
         /return 
      } 
|      /goto :RunLoop 

/return 



Sub RunToSpot(float X, float Y) 
      /declare TargDist float local   |Distance to Target 
:RunLoop 
|bytt til RANGE istedet for antall sekunder bak 
      /call FacePosition ${X} ${Y} 
      /varset TargDist ${Math.Distance[${Y},${X},0:${Me.Y},${Me.X},0]} 
      /if ( ${TargDist}<20 ) /return 
      /call MoveForward 
      /delay 2 
      /echo Distance to spot ${TargDist} 
       
      /if (${forwarddown}) { 
         /call StuckFix 
      } 
       
      /if ( ${TargDist}<5 ) { 
         |/echo We are HOOOOOOOOME! 
         /call MoveForwardStop 
         /return 
      } 
      /goto :RunLoop 

/return 



|-------------------------------------------------------------------------------- 
|SUB: Looting 
|-------------------------------------------------------------------------------- 
Sub LootMob 

   /declare LootSlot    int inner  0 
   /declare LootCheck   int inner  0 
   /declare LootTotal   int inner  0 
    
   /call FaceTarget 
   /delay 1 
    
   /keypress forward 
   /keypress back 
    
   /fastdrop on 
   /lootn never 
   /delay 1s 
   /loot 
   /delay 1s 
   /if (!${Corpse.Items}) { 
      /echo NO LOOT! Cheap Bastard! 
      /keypress ESC 
      /keypress ESC 
      /return 
   } 
   /if (${Bool[LOOT_ITEMS]}) { 

      /varset LootTotal ${Corpse.Items} 
      /for LootSlot 1 to ${LootTotal} 
         /itemnotify loot${LootSlot} leftmouseup 
         /delay 1s 
         |/if (${RV_LootAllItems}) { 
            /echo Keeping a ${Cursor.Name}... WOOT! 
            /autoinventory 
            /delay 1s 
         |} else { 
         |   /for LootCheck 1 to ${RV_LootArray.Size} 
         |      /if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) { 
         |         /echo Keeping a ${Cursor.Name}... WOOT! 
         |         /varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1 
         |         /autoinventory 
         |         /delay 1s 
         |      } 
         |   /next LootCheck 
         |} 
         |/if (${Cursor.ID}) { 
         |   /echo Destroying a ${Cursor.Name}... 
         |   /destroy 
         |   /delay 1s 
         |} 
      /next LootSlot 
   } 
   /keypress ESC 
   /keypress ESC 

/return 

Sub Event_LostTarget 
   /call StopAttack 
/return 

Sub Event_NoOverWrite 
/return 

Sub Event_SlainTarget 
/return 

Sub Event_SelfSlain 
   /call MoveForwardStop 
   /call MoveLeftStop 
   /call MoveRightStop 
    /endmacro 
/return 

Sub Event_Encumbered 
   /call DestroyCopper 
   /delay 1 
   /call DestroySilver 
/return

Saelinye
a lesser mummy
a lesser mummy
Posts: 31
Joined: Thu Jun 03, 2004 8:17 am

Sweet Perfection - in my opinion of course :p

Post by Saelinye » Tue Jun 15, 2004 8:31 am

I use a druid/Beastlord combo, and i find for my druid.. genbot is sweet... since i can command drive him from my beastlord...


Yours is sweet perfection for my beastlord though... However, I plan on modifying it like so :

First off, include rebuffs for druid buffs, like (pseudocode)

if(!buff.id)
/tell druidbot snt shield of thorns on pc myname

Also, since the wander bit doesnt really work since i have 2.. id like to modify it.. so it goes out.. in the radius you define.. which you do... and pull mob with dot.. then run to anchorhome... and /pet attack.. followed by slow.

This will cause mob to come to you.. and you begin to bash with pet working him too.. if mob not within range 8 distance.. you nuke... eventually he will come...

If you are interested in me posting my results.. let me know.. i will do.

Sae.

By the way, In particular what i like about this code is the CSE programming style he shows :P Excellent commenting and structure :P
Oh.. and Flame Away... but he deserves credit for the style. :lol:

wolf5
a ghoul
a ghoul
Posts: 89
Joined: Wed Jun 02, 2004 12:58 pm

Post by wolf5 » Mon Jun 21, 2004 4:57 am

Look at the macro depot 3.0. Posted the latest of the code. Fixed the spell-list by input from ab2304.

Should be more structure there. Have subbified the code a lot more.

-Wolf5