• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->
  • Unfortunately, yes, there is a suspension wave happening around the new tlp launch. :'( Please keep regular discussion to Suspension MegaThread and please consider submitting a Suspension report to RG.

AFK agro killer (1 Viewer)

eqjustlooking

New member
Joined
Feb 26, 2006
RedCents
Hmm ... I'm looking for a VERY simple modification to the poular Hunter.mac.

I just want the character to stand there and if anything agros on him, he turns faces it and fights using the standard fight / heal from the Hunter.mac. When there is no more mobs, I want him to buff like normal.

Here is the modified code I'm using. I changed it a bit from the original to use for my Pally. The thing is I'm working on 2 spawns and there is 1 roamer additional.

I'm VERY new to this and mainly made the adjustments by trial and error. The rest works very well except the Adds section. Can anyone help?

Thanks again for all the incredible work everyone has done here. I've just recently found it and am AMAZED at the incredible depth that's been accomplished.

Rich (BB code):
| Hunter Macro 
| Author : ins 
| Original Code: Robdawg 
| Usage : : /macro Hunter 
| Requirements: You need MQ2MoveUtils and spellroutines.inc              
|----------------------------------------------------------- 

#event SnareLand "#*# has been ensnared." 
#event OORange "Your target is too far away, get closer!" 
#event OORLoot "You are too far away to loot that corpse." 
#event Dead "You have been slain #*#" 
#event Exp "You gain#*#" 
#event SpellBlocked "Your spell did not #*#" 
#event SpellBlocked "Your spell would not #*#" 
#event GotSummoned  "You have been summoned!" 
#event NoSeeTarget  "#*#You cannot see your target.#*#" 
| #event TargetTooFar "#*#Your target is too far away, get closer#*#" 

#include spell_routines.inc 
#turbo 10 

Sub Main 
|------------------------------------------------------------ 
|Code: User Variables 
|------------------------------------------------------------ 

   /declare HPHealFight int outer 50 
   /declare HPHealRest int outer 90 
   /declare ManaforPull int outer 80 

   /declare MaxRadius int outer 200
   /declare MaxZDistance int outer 200 
   /declare Range int outer 12 
   /declare SnareNPC int outer 0 
   /declare NukeNPC int outer 0 
   /declare BuffSpells int outer 9 

   /declare DDSpell string outer "Cease"
   /declare HealSpell string outer "Light of Piety" 
   /declare SnareSpell string outer "Celestial Stun"
   /declare BuffSpell1 string outer "Grim Aura" 
   /declare BuffSpell2 string outer "Brell's Brawny Bulwark" 
   /declare BuffSpell3 string outer "Valor of Marr" 
   /declare BuffSpell4 string outer "Affirmation" 
   /declare BuffSpell5 string outer "Pious Fury"  
   /declare BuffSpell6 string outer "Form of Defense III"
   /declare BuffSpell7 string outer "Primal Guard"
   /declare BuffSpell8 string outer "Frost Guard"
   /declare BuffSpell9 string outer "Hateful Guard"
   /declare BuffSpell10 string outer
   /declare BuffSpell11 string outer 
   /declare BuffSpell12 string outer  

   /declare DDSpellName string outer "Cease"
   /declare HealSpellName string outer "Light of Piety" 
   /declare SnareSpellName string outer "Celestial Stun"
   /declare BuffSpellName1 string outer "Reaper's Ring" 
   /declare BuffSpellName2 string outer "Brell's Brawny Bulwark" 
   /declare BuffSpellName3 string outer "Valor of Marr" 
   /declare BuffSpellName4 string outer "Affirmation" 
   /declare BuffSpellName5 string outer "Pious Fury" 
   /declare BuffSpellName6 string outer "Hanvar's Hoop" 
   /declare BuffSpellName7 string outer "Prism of Dark Hues" 
   /declare BuffSpellName8 string outer "Pauldron of Dark Auspices"
   /declare BuffSpellName9 string outer "Mask of Lament"
   /declare BuffSpellName10 string outer
   /declare BuffSpellName11 string outer 
   /declare BuffSpellName12 string outer 


   /declare DDSpellGem string outer "gem1"
   /declare HealSpellGem string outer "gem4" 
   /declare SnareSpellGem string outer "alt"
   /declare BuffSpellGem1 string outer "item" 
   /declare BuffSpellGem2 string outer "gem7" 
   /declare BuffSpellGem3 string outer "gem2" 
   /declare BuffSpellGem4 string outer "gem8" 
   /declare BuffSpellGem5 string outer "gem2" 
   /declare BuffSpellGem6 string outer "item" 
   /declare BuffSpellGem7 string outer "item"
   /declare BuffSpellGem8 string outer "item"
   /declare BuffSpellGem9 string outer "item"


|------------------------------------------------------------ 
|Warning: Stop editing here. 
|------------------------------------------------------------ 
|Code: Array & Variable Information. 
|------------------------------------------------------------ 

   /declare BuffSub int outer 1 
   /declare BuffBlock[${BuffSpells}] int outer 0 
   /declare TargetID int outer 0 
   /declare AddCounter int outer 1 
   /declare AddIDArray[10] int outer 0 
   /declare AddIDCounter int outer 1 
   /declare FastRange int outer 
   /declare RangeMax int outer 
   /declare RangeMin int outer 
   /varcalc FastRange ${Range}+3 
   /varcalc RangeMax ${Range}+1 
   /varcalc RangeMin ${Range}-1 
   /declare MyXLOCA int outer 0 
   /declare MyYLOCA int outer 0 
   /declare BreakLoop int outer 0  
   /declare xDistance int outer 0 
   /declare AnchorX int outer ${Me.X} 
   /declare AnchorY int outer ${Me.Y} 
   /declare MyTargetName string outer 
   /declare MyTargetDead int outer 0 
   /declare InvalidTargetID int outer 0 
   /declare RandomWait int outer 0 
   /declare Fighting int outer 0 
   /declare TargetDead int outer 0 
   /declare Snared int outer 0 
   /declare MyXLOC int outer 0 
   /declare MyYLOC int outer 0 
   /declare Oktopull int outer 1 
   /declare Mobstoloot int outer 0 
   /call ReadINI HunterMob.ini "${Zone.Name}" Mob 
   /if (!${Defined[MobArray]}) { 
      /echo Mob Array Creation Error, ending macro... 
      /endmacro 
   } 
   /call ReadINI HunterLoot.ini "${Zone.Name}" Loot 
   /if (!${Defined[LootArray]}) { 
      /echo No Loot Array Created... 
   } 
   /cleanup 
   /fastdrop on 
   /lootn never 


|-------------------------------------------------------------------------------- 
|Code: Main Loop 
|-------------------------------------------------------------------------------- 

   :Start 
   /squelch /target clear 
   /doevents 
   /call CheckAdds
   /call CheckHP 
   /if (${Spawn[npc radius 100].ID}==0) /call CheckBuffs 
   |/if (${Oktopull}>0&&${Int[${Me.PctHPs}]}>90) /call GetTarget 
   /call CheckAdds 
   /call CheckAnchor 
   /if (!${TargetID}) { 
      /call CheckBuffs 
      /call CheckHP 
      /call CheckMana 
   } 
   /goto :Start 
/return 

|-------------------------------------------------------------------------------- 
|Code: Aquire Target 
|-------------------------------------------------------------------------------- 
Sub GetTarget 
   /declare SpawnSub int local 
   /declare CheckSpawnSub int local 
   /declare IDArray[${MobArray.Size}] int local 
   /for SpawnSub 1 to ${MobArray.Size} 
      /varset IDArray[${SpawnSub}] ${NearestSpawn[npc radius ${MaxRadius} nopcnear "${MobArray[${SpawnSub}]}"].ID} 
   /next SpawnSub 
   /for CheckSpawnSub 1 to ${MobArray.Size} 
      /if (!${IDArray[${CheckSpawnSub}]}) /next CheckSpawnSub 
      /if (${TargetID}==0) /varset TargetID ${IDArray[${CheckSpawnSub}]} 
      /if ((${Spawn[npc id ${IDArray[${CheckSpawnSub}]}].Distance}<${MaxRadius}) && (${Spawn[npc id ${IDArray[${CheckSpawnSub}]}].DistanceZ}<${MaxZDistance})) { 
         /if (${Spawn[npc id ${IDArray[${CheckSpawnSub}]}].Distance}<${Spawn[npc id ${TargetID}].Distance}) { 
            /varset TargetID ${IDArray[${CheckSpawnSub}]} 
         } 
      } 
   /next CheckSpawnSub 
   /if (${TargetID}!=0) { 
      /squelch /target npc id ${TargetID} 
      /call CombatSub 
   } 
/return 

|-------------------------------------------------------------------------------- 
|Code: Get Closer 
|-------------------------------------------------------------------------------- 
Sub MoveTo200 
  :MoveLoop 
  /if (${Target.Distance} > 200) { 
    /face fast 
    /keypress forward hold 
    /delay 2 
    /goto :MoveLoop 
  } else { 
    /keypress forward 
    /keypress back 
  } 
/return 
|-------------------------------------------------------------------------------- 
|Code: Combat 
|-------------------------------------------------------------------------------- 
Sub CombatSub 
   /delay 1s 
   /stand 
   /echo Attacking ${Target.CleanName} NOW! 
   /varset Fighting 1 
   /varset TargetDead 0 
   /face nolook 
   /if (${SnareNPC}==1) /call Cast ${SnareSpell} ${SnareSpellGem} 
   :CombatStart 
   /if (${Int[${Target.Distance}]}>20) { 
      /delay 5
      /doevents
      /call cast ${DDSpell} ${DDSpellgem} 
     | /if (${Int[${Target.Distance}]}>40) {
     | /ranged 
     | /goto :CombatStart 
   } 
   :CombatLoop 
   /squelch /target npc id ${TargetID} 
   /squelch /stick ${Range} 
   /squelch /attack on 
   /doevents 
   /if ((${Me.AbilityReady[Kick]}) && (${Me.State.NotEqual[STUNNED]})) /doability Kick 
   /if ((${Me.AbilityReady[Taunt]}) && (${Me.State.NotEqual[STUNNED]})) /doability Taunt 
   /call CheckHP 
   /if ((${Target.PctHPs}>30&&${Me.PctMana}>90) && (${Me.State.NotEqual[STUNNED]}) && (${NukeNPC}==1)) /call cast ${DDSpell} ${DDSpellgem} 
   /if ((${Snared}<1) && (${Spawn[npc id ${TargetID}].ID}!=NULL) && (${Me.State.NotEqual[STUNNED]}) && (${SnareNPC}==1)) /call Cast ${SnareSpell} ${SnareSpellGem} 
   /if (${Spawn[corpse id ${TargetID}].ID}!=NULL) { 
     | /squelch /attack off 
     | /squelch /target clear 
      /doevents 
      /varset Snared 0 
      /call CheckAdds 
      /varset TargetDead 1 
      /varset Fighting 0 
   } 

   /if (${Spawn[npc id ${TargetID}].ID}!=NULL) /goto :CombatLoop  
   /call CheckAdds
   /squelch /attack off 
   /call ClearCorpses 
/return 


|-------------------------------------------------------------------------------- 
|Code: Check Buffs 
|-------------------------------------------------------------------------------- 
Sub CheckBuffs 
   /for BuffSub 1 to ${BuffSpells} 
      /if ((${Me.Buff[${BuffSpell${BuffSub}}].Duration}<30)&&(${BuffBlock[${BuffSub}]}!=1)) { 
         /target ${Me.Name} 
         /call Cast ${BuffSpellName${BuffSub}}  ${BuffSpellGem${BuffSub}} 
      } 
      /doevents 
   /next BuffSub 
   /varset BuffSub 1 
/return 

|-------------------------------------------------------------------------------- 
|Code: Check for Adds 
|-------------------------------------------------------------------------------- 
Sub CheckAdds 
   /squelch /target clear 
   /delay 2s 
   |No target. 
   /if (${Target.ID}==0) /return 
   |Target is NPC, but not TargetID and TargetID is still alive~ 
   /if ((${Target.Type.Equal[NPC]}) && (${Target.ID}!=${TargetID}) && (${Spawn[npc id ${TargetID}].ID}!=NULL)) { 
      /varset AddIDArray[${AddIDCounter}] ${Target.ID} 
      /varcalc AddIDCounter ${AddIDCounter}+1 
      /squelch /target ${TargetID} 
      /return 
   } 

   |No Target, but NPCs on list. 
   /if ((${AddCounter}<${AddIDCounter}) && (${Target.ID}==NULL)) { 
      /echo OMG KILLING ADDS111 
      /varset TargetID ${AddIDArray[${AddCounter}]} 
      /varset AddIDArray[${AddCounter}] 0 
      /varcalc AddCounter ${AddCounter}+1 
      /squelch /target ${TargetID} 
      /varset Fighting 1 
      /return 
   } 

   |Target NPC isn't my target... but I don't have one, kill it~ 
   /if ((${Target.Type.Equal[NPC]}) && (${Spawn[npc id ${TargetID}].ID}==0)) { 
      /varset TargetID ${Target.ID} 
      /squelch /target npc id ${TargetID} 
      /call CombatSub      
      /return 
   } 
/return 

|-------------------------------------------------------------------------------- 
|Code: HP/Mana Upkeep 
|-------------------------------------------------------------------------------- 

Sub CheckHP 
   |Do I need to heal during fight? 
   /if ((${Int[${Me.PctHPs}]}<${HPHealFight})&&${Fighting}) { 
      /call Heal 
   } 
   |Do I need to heal during downtime? 
   /if ((${Int[${Me.PctHPs}]}<${HPHealRest}) &&!${Fighting}) { 
      /call Heal 
      /squelch /target clear 
   } 
/return 

Sub CheckMana 
   |Enough Mana to pull? 
   /if (${Int[${Me.PctMana}]}<${ManaforPull}) { 
      /varset Oktopull 0 
   } 
   /if (${Int[${Me.PctMana}]}>${ManaforPull}) { 
      /varset Oktopull 1 
   } 
/return 

Sub Heal 
   /if ((${Me.Gem[${HealSpell}]})&&(${Me.SpellReady[${HealSpell}]})) { 
      /squelch /stick off 
      /squelch /attack off 
      /declare TempID int inner 0 
      /varset TempID ${Target.ID} 
      /target ${Me.Name} 
      /call Cast ${HealSpell} ${HealSpellGem} 
      /squelch /target id ${TempID} 
   } 
/return 

|-------------------------------------------------------------------------------- 
|Code: Looting 
|-------------------------------------------------------------------------------- 
Sub ClearCorpses 
   /declare CorpseSub int local 
   /for CorpseSub 1 to ${Mobstoloot} 
      /call LootMob  
   /next CorpseSub 
   /call ResetSub 
/return 

Sub LootMob 
   /declare LootSlot int inner 0 
   /declare LootCheck int inner 0 
   /declare LootTotal int inner 0 
   /declare LootLoop int local 0 
   :WaitLootMobWnd 
   /squelch /target corpse radius 100 
   /delay 5 
   /squelch /stick 
   /if (${Target.Type.Equal[CORPSE]}) /loot 
   /delay 5 
   /varcalc LootLoop ${LootLoop}+1 
   /if (${LootLoop}>3) /return 
   /if (!${Corpse}) /goto :WaitLootMobWnd 
   /if (!${Corpse.Items}) { 
      /echo NO LOOT! Cheap Bastard! 
      /notify LootWnd DoneButton leftmouseup 
      /delay 2 
      /return 
   } 
   /squelch /stick off 
   /varset LootTotal ${Corpse.Items} 
   /for LootSlot 1 to ${LootTotal} 
      /itemnotify loot${LootSlot} leftmouseup 
      /delay 1s 
      /for LootCheck 1 to ${LootArray.Size} 
         /if (${Cursor.Name.Find[${LootArray[${LootCheck}]}]}) { 
            /echo Keeping a ${Cursor.Name}... WOOT! 
            /varcalc LootStats[${LootCheck}] ${LootStats[${LootCheck}]}+1 
            /autoinventory 
            /delay 1s 
         } 
      /next LootCheck 
      /if (${Cursor.Value}>9000 && ${Cursor.Stackable}) { 
         /echo Keeping a ${Cursor.Name}... 
         /autoi 
         /delay 1s 
      }  
      /if (${Cursor.NoDrop}&&!${Cursor.Magic}) { 
         /echo Destroying a ${Cursor.Name}... 
         /des 
         /delay 1s 
      }  
      /if (${Cursor.NoDrop}&&${Cursor.WornSlots}<1) { 
         /echo Destroying a ${Cursor.Name}... 
         /des 
         /delay 1s 
      }  
      /if (${Cursor.ID}) { 
         /echo Dropping a ${Cursor.Name}... 
         /drop 
         /delay 1s 
      } 
   /next LootSlot 
   /notify LootWnd DoneButton leftmouseup 
/return 



|-------------------------------------------------------------------------------- 
|Code: Reset 
|-------------------------------------------------------------------------------- 
Sub ResetSub 
   /keypress esc 
   /keypress esc 
   /keypress esc 
   /keypress esc 

   /varset Mobstoloot 0 
   /varset AddIDCounter 1 
   /varset AddCounter 1 
   /varset TargetID 0 
   /varset TargetDead 0 
   /varset Fighting 0 
   /varset RandomWait ${Math.Rand[3]} 
   /varcalc RandomWait ${RandomWait}+1 
   /echo Paranoia - Waiting ${RandomWait} seconds before resuming 
   /delay ${RandomWait}s 
/return 

|-------------------------------------------------------------------------------- 
|Code: Reading from an INI File 
|-------------------------------------------------------------------------------- 
Sub ReadINI(FileName,SectionName,ArrayType) 
   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}... 
   /delay 1s 
   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) { 
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro... 
      /delay 1s 
      /return 
   } 
   /declare nValues int local 1 
   /declare nArray int local 0 
   /declare KeySet string local ${Ini[${FileName},${SectionName}]} 
   :CounterLoop 
    
/if (${Ini[${FileName},${SectionName},${ArrayType}${nValues},NOTFOUND].Equal[NOTFOUND]}) { 

      /varcalc nValues ${nValues}-1 
      /goto :MakeArray 
   } 
   /varcalc nValues ${nValues}+1 
   /goto :CounterLoop 
   :MakeArray 
   /if (!${nValues}) /return 
   /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) { 
      /echo Declaring Mob Array... 
      /declare MobArray[${nValues}] string outer 
      /declare MobStats[${nValues}] string outer 
   } 
   /if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) { 
      /echo Declaring Loot Array... 
      /declare LootArray[${nValues}] string outer 
      /declare LootStats[${nValues}] string outer 
   } 
   /for nArray 1 to ${nValues} 
      /if (${FileName.Equal["HunterMob.ini"]}) { 
         /varset MobArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]} 
         /varset MobStats[${nArray}] 0 
      } 
      /if (${FileName.Equal["HunterLoot.ini"]}) { 
         /varset LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]} 
         /varset LootStats[${nArray}] 0 
      } 
   /next nArray 
   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 
   /delay 1s 
/return 

|-------------------------------------------------------------------------------- 
|Code: Anchor 
|-------------------------------------------------------------------------------- 
Sub MoveToAnchor 
   /declare iCount int local 
   /varset iCount 0 
   /echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}. 
   :AnchorMoveLoop 
   /delay 1 
   /doevents 
   /face fast nolook loc ${AnchorY},${AnchorX} 
   /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) { 
      /keypress forward hold 
   } else { 
      /keypress forward 
      /face fast away nolook loc ${AnchorY},${AnchorX} 
      /return 
   } 
   /if (${iCount}>2) { 
      /call CheckObstacle 
      /face fast nolook loc ${AnchorY},${AnchorX} 
      /varset iCount 0 
   } 
   /varcalc iCount ${iCount}+1 
   /goto :AnchorMoveLoop 
/return 

Sub CheckAnchor 
   /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor 
/return 

|-------------------------------------------------------------------------------- 
|Code: Obstacle 
|-------------------------------------------------------------------------------- 
sub Obstacle 
   /keypress forward 
   /keypress back hold 
   /delay 3 
   /keypress back 
   /if (${Math.Rand[2]}) { 
      /keypress strafe_right hold 
      /delay 1 
      /keypress strafe_right 
   } else { 
      /keypress strafe_left hold 
      /delay 1 
      /keypress strafe_left 
   } 
   /keypress forward hold 
/return 

sub CheckObstacle 
   /varset MyXLOCA ${Me.X} 
   /varset MyYLOCA ${Me.Y} 
   /delay 2 
   /if (${MyXLOCA}==${Me.X} && ${MyYLOCA}==${Me.Y}) /call Obstacle 
/return 

Sub HitObstacle 
   /echo Obstacle hit, moving around it... 
   /keypress forward 
   /keypress back hold 
   /delay 2 
   /keypress back 
   /if (${Math.Rand[100]}+1>50) { 
      /keypress strafe_right hold 
   } else { 
      /keypress strafe_left hold 
   } 
   /delay 3 
   /keypress strafe_right 
   /keypress strafe_left 
   /keypress forward hold 
/return 

|-------------------------------------------------------------------------------- 
|Code: Events 
|-------------------------------------------------------------------------------- 

Sub Event_TargetTooFar 
  /keypress back hold 
  /delay 1 
  /keypress back 
/return 

Sub Event_NoSeeTarget 
  /keypress back hold 
  /delay 1 
  /keypress back 
/return 


Sub Event_GotSummoned 
  /keypress back hold 
  /delay 1 
  /keypress back 
/return 

Sub Event_SpellBlocked 
   /varset BuffBlock[${BuffSub}] 1 
   /echo Not buffing with ${BuffSpell${BuffSub}} 
/return 

Sub Event_Exp 
   /varset Snared 0 
   /varcalc Mobstoloot ${Mobstoloot}+1 
/return 

Sub Event_OORange 
   /call CheckObstacle 
/return 

Sub Event_OORLoot 
   /call CheckObstacle 
/return 

Sub Event_SnareLand 
   /varcalc Snared ${Snared}+1 
/return 

Sub Event_Dead 
   /exit 
/return
 
Hmmm looking at this it seems like it should pick up the adds and kill them as well. You are saying that it does not correct? If it's not then maybe someone else can find the error in here. To me it looks like it does in fact check to see if there is something beating on you once your target is dead. It does this by checking if you have a target or not. If not it returns to the begining of the cycle. If it does then it moves to engage the target. One thing that you might want to make sure before we go much farther is that you do in fact have MQ2Moveutils loaded and spellroutines.inc in the MQ2 directory so it can be utilized. If you move into chat you may catch Alatyami who is a excellent macro maker and proofreader. If your not sure how to join chat just scroll to the top of this page and its along the top on the right hand side.
 
I believe I have the Move utilities in, because he goes back to starting location after killing, but it seems that if adds are around then he just sits there looking for another target. It clears the target over and over again. The effect of this is that it overloads the ADD counter.
 
After talking to you in chat ... try this ...

Rich (BB code):
|--------------------------------------------------------------------------------
|Code: Main Loop
|--------------------------------------------------------------------------------

   :Start
   /doevents
   /call CheckHP
   /if (${Target.ID}) /call CombatSub
   /delay 1s
   /if (!${TargetID}) {
      /call CheckBuffs
      /call CheckHP
      /call CheckMana
   }
   /goto :Start
/return

You don't need to check for adds if all you want is to kill what ever wants to kill you.

After doing events this will:
1 - Check Your Hp
2 - If you have a target, run the combat function.
3 - After the combat function is completed, wait one second and then check buffs, HP, and Mana.
4 - start over again.
 
I'm currently using this one .. but targeting seems off after the initial adds are dead.

Rich (BB code):
 :Start
   /if (${Target.ID}) /call CombatSub
   /if (${Target.ID}==0) {
      /call CheckBuffs
      /call CheckHP
      /call CheckMana
      /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor
    }
   /goto :Start
/return
 
Here's the whole thing as it stands.

Rich (BB code):
| Hunter Macro 
| Author : ins 
| Original Code: Robdawg 
| Usage : : /macro Hunter 
| Requirements: You need MQ2MoveUtils and spellroutines.inc              
|----------------------------------------------------------- 

#event SnareLand "#*# has been ensnared." 
#event OORange "Your target is too far away, get closer!" 
#event OORLoot "You are too far away to loot that corpse." 
#event Dead "You have been slain #*#" 
#event Exp "You gain#*#" 
#event SpellBlocked "Your spell did not #*#" 
#event SpellBlocked "Your spell would not #*#" 
#event GotSummoned  "You have been summoned!" 
#event NoSeeTarget  "#*#You cannot see your target.#*#" 
| #event TargetTooFar "#*#Your target is too far away, get closer#*#" 

#include spell_routines.inc 
#turbo 10 

Sub Main 
|------------------------------------------------------------ 
|Code: User Variables 
|------------------------------------------------------------ 

   /declare HPHealFight int outer 50 
   /declare HPHealRest int outer 50 
   /declare ManaforPull int outer 80 

   /declare MaxRadius int outer 50
   /declare MaxZDistance int outer 50 
   /declare Range int outer 12 
   /declare SnareNPC int outer 0 
   /declare NukeNPC int outer 0 
   /declare BuffSpells int outer 9 

   /declare DDSpell string outer "Cease"
   /declare HealSpell string outer "Light of Piety" 
   /declare SnareSpell string outer "Celestial Stun"
   /declare BuffSpell1 string outer "Grim Aura" 
   /declare BuffSpell2 string outer "Brell's Brawny Bulwark" 
   /declare BuffSpell3 string outer "Valor of Marr" 
   /declare BuffSpell4 string outer "Affirmation" 
   /declare BuffSpell5 string outer "Pious Fury"  
   /declare BuffSpell6 string outer "Form of Defense III"
   /declare BuffSpell7 string outer "Primal Guard"
   /declare BuffSpell8 string outer "Frost Guard"
   /declare BuffSpell9 string outer "Hateful Guard"
   /declare BuffSpell10 string outer
   /declare BuffSpell11 string outer 
   /declare BuffSpell12 string outer  

   /declare DDSpellName string outer "Cease"
   /declare HealSpellName string outer "Light of Piety" 
   /declare SnareSpellName string outer "Celestial Stun"
   /declare BuffSpellName1 string outer "Reaper's Ring" 
   /declare BuffSpellName2 string outer "Brell's Brawny Bulwark" 
   /declare BuffSpellName3 string outer "Valor of Marr" 
   /declare BuffSpellName4 string outer "Affirmation" 
   /declare BuffSpellName5 string outer "Pious Fury" 
   /declare BuffSpellName6 string outer "Hanvar's Hoop" 
   /declare BuffSpellName7 string outer "Prism of Dark Hues" 
   /declare BuffSpellName8 string outer "Pauldron of Dark Auspices"
   /declare BuffSpellName9 string outer "Mask of Lament"
   /declare BuffSpellName10 string outer
   /declare BuffSpellName11 string outer 
   /declare BuffSpellName12 string outer 


   /declare DDSpellGem string outer "gem1"
   /declare HealSpellGem string outer "gem4" 
   /declare SnareSpellGem string outer "alt"
   /declare BuffSpellGem1 string outer "item" 
   /declare BuffSpellGem2 string outer "gem7" 
   /declare BuffSpellGem3 string outer "gem2" 
   /declare BuffSpellGem4 string outer "gem8" 
   /declare BuffSpellGem5 string outer "gem2" 
   /declare BuffSpellGem6 string outer "item" 
   /declare BuffSpellGem7 string outer "item"
   /declare BuffSpellGem8 string outer "item"
   /declare BuffSpellGem9 string outer "item"


|------------------------------------------------------------ 
|Warning: Stop editing here. 
|------------------------------------------------------------ 
|Code: Array & Variable Information. 
|------------------------------------------------------------ 

   /declare BuffSub int outer 1 
   /declare BuffBlock[${BuffSpells}] int outer 0 
   /declare TargetID int outer 0 
   /declare AddCounter int outer 1 
   /declare AddIDArray[10] int outer 0 
   /declare AddIDCounter int outer 1 
   /declare FastRange int outer 
   /declare RangeMax int outer 
   /declare RangeMin int outer 
   /varcalc FastRange ${Range}+3 
   /varcalc RangeMax ${Range}+1 
   /varcalc RangeMin ${Range}-1 
   /declare MyXLOCA int outer 0 
   /declare MyYLOCA int outer 0 
   /declare BreakLoop int outer 0  
   /declare xDistance int outer 0 
   /declare AnchorX int outer ${Me.X} 
   /declare AnchorY int outer ${Me.Y} 
   /declare MyTargetName string outer 
   /declare MyTargetDead int outer 0 
   /declare InvalidTargetID int outer 0 
   /declare RandomWait int outer 0 
   /declare Fighting int outer 0 
   /declare TargetDead int outer 0 
   /declare Snared int outer 0 
   /declare MyXLOC int outer 0 
   /declare MyYLOC int outer 0 
   /declare Oktopull int outer 1 
   /declare Mobstoloot int outer 0 
   /call ReadINI HunterMob.ini "${Zone.Name}" Mob 
   /if (!${Defined[MobArray]}) { 
      /echo Mob Array Creation Error, ending macro... 
      /endmacro 
   } 
   /call ReadINI HunterLoot.ini "${Zone.Name}" Loot 
   /if (!${Defined[LootArray]}) { 
      /echo No Loot Array Created... 
   } 
   /cleanup 
   /fastdrop on 
   /lootn never 


|-------------------------------------------------------------------------------- 
|Code: Main Loop 
|-------------------------------------------------------------------------------- 

 :Start
   /if (${Target.ID}) /call CombatSub
   /if (${Target.ID}==0) {
      /call CheckBuffs
      /call CheckHP
      /call CheckMana
      /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor
    }
   /goto :Start
/return 

|-------------------------------------------------------------------------------- 
|Code: Combat 
|-------------------------------------------------------------------------------- 
Sub CombatSub 
   /delay 1s 
   /stand 
   /echo Attacking ${Target.CleanName} NOW! 
   /varset Fighting 1 
   /varset TargetDead 0 
   /face nolook 
   /if (${SnareNPC}==1) /call Cast ${SnareSpell} ${SnareSpellGem} 
   :CombatLoop 
   /squelch /target npc id ${TargetID} 
   /squelch /stick ${Range} 
   /squelch /attack on 
   /doevents 
   /if ((${Me.AbilityReady[Kick]}) && (${Me.State.NotEqual[STUNNED]})) /doability Kick 
   /if ((${Me.AbilityReady[Taunt]}) && (${Me.State.NotEqual[STUNNED]})) /doability 

Taunt 
   /call CheckHP 
   /if ((${Target.PctHPs}>30&&${Me.PctMana}>90) && (${Me.State.NotEqual[STUNNED]}) && 

(${NukeNPC}==1)) /call cast ${DDSpell} ${DDSpellgem} 
   /if ((${Snared}<1) && (${Spawn[npc id ${TargetID}].ID}!=NULL) && 

(${Me.State.NotEqual[STUNNED]}) && (${SnareNPC}==1)) /call Cast ${SnareSpell} 

${SnareSpellGem} 
   /if (${Spawn[corpse id ${TargetID}].ID}!=NULL) { 
      /doevents 
      /varset Snared 0 
      /varset TargetDead 1 
      /varset Fighting 0 
      /squelch /attack off 
   } 
   /if (${Spawn[npc id ${TargetID}].ID}!=NULL) /goto :CombatLoop  
   /call ClearCorpses 
/return 


|-------------------------------------------------------------------------------- 
|Code: Check Buffs 
|-------------------------------------------------------------------------------- 
Sub CheckBuffs 
   /for BuffSub 1 to ${BuffSpells} 
      /if ((${Me.Buff[${BuffSpell${BuffSub}}].Duration}<30)&&(${BuffBlock

[${BuffSub}]}!=1)) { 
         /target ${Me.Name} 
         /call Cast ${BuffSpellName${BuffSub}}  ${BuffSpellGem${BuffSub}} 
      } 
      /doevents 
   /next BuffSub 
   /varset BuffSub 1 
/return 

|-------------------------------------------------------------------------------- 
|Code: HP/Mana Upkeep 
|-------------------------------------------------------------------------------- 

Sub CheckHP 
   |Do I need to heal during fight? 
   /if ((${Int[${Me.PctHPs}]}<${HPHealFight})&&${Fighting}) { 
      /call Heal 
   } 
   |Do I need to heal during downtime? 
   /if ((${Int[${Me.PctHPs}]}<${HPHealRest}) &&!${Fighting}) { 
      /call Heal 
      /squelch /target clear 
   } 
/return 

Sub CheckMana 
   |Enough Mana to pull? 
   /if (${Int[${Me.PctMana}]}<${ManaforPull}) { 
      /varset Oktopull 0 
   } 
   /if (${Int[${Me.PctMana}]}>${ManaforPull}) { 
      /varset Oktopull 1 
   } 
/return 

Sub Heal 
   /if ((${Me.Gem[${HealSpell}]})&&(${Me.SpellReady[${HealSpell}]})) { 
      /squelch /stick off 
      /squelch /attack off 
      /declare TempID int inner 0 
      /varset TempID ${Target.ID} 
      /target ${Me.Name} 
      /call Cast ${HealSpell} ${HealSpellGem} 
      /squelch /target id ${TempID} 
   } 
/return 

|-------------------------------------------------------------------------------- 
|Code: Looting 
|-------------------------------------------------------------------------------- 
Sub ClearCorpses 
   /declare CorpseSub int local 
   /for CorpseSub 1 to ${Mobstoloot} 
      /call LootMob  
   /next CorpseSub 
   /call ResetSub 
/return 

Sub LootMob 
   /declare LootSlot int inner 0 
   /declare LootCheck int inner 0 
   /declare LootTotal int inner 0 
   /declare LootLoop int local 0 
   :WaitLootMobWnd 
   /squelch /target corpse radius 100 
   /delay 5 
   /squelch /stick 
   /if (${Target.Type.Equal[CORPSE]}) /loot 
   /delay 5 
   /varcalc LootLoop ${LootLoop}+1 
   /if (${LootLoop}>3) /return 
   /if (!${Corpse}) /goto :WaitLootMobWnd 
   /if (!${Corpse.Items}) { 
      /echo NO LOOT! Cheap Bastard! 
      /notify LootWnd DoneButton leftmouseup 
      /delay 2 
      /return 
   } 
   /squelch /stick off 
   /varset LootTotal ${Corpse.Items} 
   /for LootSlot 1 to ${LootTotal} 
      /itemnotify loot${LootSlot} leftmouseup 
      /delay 1s 
      /for LootCheck 1 to ${LootArray.Size} 
         /if (${Cursor.Name.Find[${LootArray[${LootCheck}]}]}) { 
            /echo Keeping a ${Cursor.Name}... WOOT! 
            /varcalc LootStats[${LootCheck}] ${LootStats[${LootCheck}]}+1 
            /autoinventory 
            /delay 1s 
         } 
      /next LootCheck 
      /if (${Cursor.Value}>9000 && ${Cursor.Stackable}) { 
         /echo Keeping a ${Cursor.Name}... 
         /autoi 
         /delay 1s 
      }  
      /if (${Cursor.NoDrop}&&!${Cursor.Magic}) { 
         /echo Destroying a ${Cursor.Name}... 
         /des 
         /delay 1s 
      }  
      /if (${Cursor.NoDrop}&&${Cursor.WornSlots}<1) { 
         /echo Destroying a ${Cursor.Name}... 
         /des 
         /delay 1s 
      }  
      /if (${Cursor.ID}) { 
         /echo Dropping a ${Cursor.Name}... 
         /drop 
         /delay 1s 
      } 
   /next LootSlot 
   /notify LootWnd DoneButton leftmouseup 
/return 



|-------------------------------------------------------------------------------- 
|Code: Reset 
|-------------------------------------------------------------------------------- 
Sub ResetSub 
   /keypress esc 
   /keypress esc 
   /keypress esc 
   /keypress esc 

   /varset Mobstoloot 0 
   /varset AddIDCounter 1 
   /varset AddCounter 1 
   /varset TargetID 0 
   /varset TargetDead 0 
   /varset Fighting 0 
   /varset RandomWait ${Math.Rand[3]} 
   /varcalc RandomWait ${RandomWait}+1 
   /echo Paranoia - Waiting ${RandomWait} seconds before resuming 
   /delay ${RandomWait}s 
/return 

|-------------------------------------------------------------------------------- 
|Code: Reading from an INI File 
|-------------------------------------------------------------------------------- 
Sub ReadINI(FileName,SectionName,ArrayType) 
   /echo Attempting to Read Section "${SectionName}" Zone Information from 

${FileName}... 
   /delay 1s 
   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) { 
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending 

macro... 
      /delay 1s 
      /return 
   } 
   /declare nValues int local 1 
   /declare nArray int local 0 
   /declare KeySet string local ${Ini[${FileName},${SectionName}]} 
   :CounterLoop 
    
/if (${Ini[${FileName},${SectionName},${ArrayType}${nValues},NOTFOUND].Equal

[NOTFOUND]}) { 

      /varcalc nValues ${nValues}-1 
      /goto :MakeArray 
   } 
   /varcalc nValues ${nValues}+1 
   /goto :CounterLoop 
   :MakeArray 
   /if (!${nValues}) /return 
   /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) { 
      /echo Declaring Mob Array... 
      /declare MobArray[${nValues}] string outer 
      /declare MobStats[${nValues}] string outer 
   } 
   /if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) { 
      /echo Declaring Loot Array... 
      /declare LootArray[${nValues}] string outer 
      /declare LootStats[${nValues}] string outer 
   } 
   /for nArray 1 to ${nValues} 
      /if (${FileName.Equal["HunterMob.ini"]}) { 
         /varset MobArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}

${nArray}]} 
         /varset MobStats[${nArray}] 0 
      } 
      /if (${FileName.Equal["HunterLoot.ini"]}) { 
         /varset LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}

${nArray}]} 
         /varset LootStats[${nArray}] 0 
      } 
   /next nArray 
   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 
   /delay 1s 
/return 

|-------------------------------------------------------------------------------- 
|Code: Anchor 
|-------------------------------------------------------------------------------- 
Sub MoveToAnchor 
   /declare iCount int local 
   /varset iCount 0 
   /echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}. 
   :AnchorMoveLoop 
   /delay 1 
   /doevents 
   /face fast nolook loc ${AnchorY},${AnchorX} 
   /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) { 
      /keypress forward hold 
   } else { 
      /keypress forward 
      /face fast away nolook loc ${AnchorY},${AnchorX} 
      /return 
   } 
   /if (${iCount}>2) { 
      /call CheckObstacle 
      /face fast nolook loc ${AnchorY},${AnchorX} 
      /varset iCount 0 
   } 
   /varcalc iCount ${iCount}+1 
   /goto :AnchorMoveLoop 
/return 

Sub CheckAnchor 
   /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor 
/return 

|-------------------------------------------------------------------------------- 
|Code: Get Closer 
|-------------------------------------------------------------------------------- 
Sub MoveToTarget 
  :MoveLoop 
  /if (${Target.Distance} > 20) { 
    /face fast 
    /keypress forward hold 
    /delay 2 
    /goto :MoveLoop 
  } else { 
    /keypress forward 
    /keypress back 
  } 
/return 

|-------------------------------------------------------------------------------- 
|Code: Obstacle 
|-------------------------------------------------------------------------------- 
sub Obstacle 
   /keypress forward 
   /keypress back hold 
   /delay 3 
   /keypress back 
   /if (${Math.Rand[2]}) { 
      /keypress strafe_right hold 
      /delay 1 
      /keypress strafe_right 
   } else { 
      /keypress strafe_left hold 
      /delay 1 
      /keypress strafe_left 
   } 
   /keypress forward hold 
/return 

sub CheckObstacle 
   /varset MyXLOCA ${Me.X} 
   /varset MyYLOCA ${Me.Y} 
   /delay 2 
   /if (${MyXLOCA}==${Me.X} && ${MyYLOCA}==${Me.Y}) /call Obstacle 
/return 

Sub HitObstacle 
   /echo Obstacle hit, moving around it... 
   /keypress forward 
   /keypress back hold 
   /delay 2 
   /keypress back 
   /if (${Math.Rand[100]}+1>50) { 
      /keypress strafe_right hold 
   } else { 
      /keypress strafe_left hold 
   } 
   /delay 3 
   /keypress strafe_right 
   /keypress strafe_left 
   /keypress forward hold 
/return 

|-------------------------------------------------------------------------------- 
|Code: Events 
|-------------------------------------------------------------------------------- 

Sub Event_TargetTooFar 
  /keypress back hold 
  /delay 1 
  /keypress back 
/return 

Sub Event_NoSeeTarget 
  /keypress back hold 
  /delay 1 
  /keypress back 
/return 

Sub Event_GotSummoned 
  /keypress back hold 
  /delay 1 
  /keypress back 
/return 

Sub Event_SpellBlocked 
   /varset BuffBlock[${BuffSub}] 1 
   /echo Not buffing with ${BuffSpell${BuffSub}} 
/return 

Sub Event_Exp 
   /varset Snared 0 
   /varcalc Mobstoloot ${Mobstoloot}+1 
/return 

Sub Event_OORange 
   /call CheckObstacle 
/return 

Sub Event_OORLoot 
   /call CheckObstacle 
/return 

Sub Event_SnareLand 
   /varcalc Snared ${Snared}+1 
/return 

Sub Event_Dead 
   /exit 
/return
 
Well it's working fairly well as AFK agro. Another use for it is that if you need to leave to go to the bathroom, grab some food or drink, start the macro and any agro gets taken care of.

Here's the latest version, but I'm still having issues ...

1 - Every so often he gets knocked out of range when trying to loot a mob and cant' reach it, so he keeps it on target and slowly gets killed by the adds.

2 - I can't figure out why, but every so often he gets himself on target and looks like he's attacking himself, and again the add mob slowly kills him.

These are the only 2 issues left at the moment. Thanks again for all the help.

Rich (BB code):
| Hunter Macro 
| Author : ins 
| Original Code: Robdawg 
| Usage : : /macro Hunter 
| Requirements: You need MQ2MoveUtils and spellroutines.inc              
|----------------------------------------------------------- 

#event SnareLand "#*# has been ensnared." 
#event OORange "Your target is too far away, get closer!" 
#event OORLoot "You are too far away to loot that corpse." 
#event Dead "You have been slain #*#" 
#event Exp "You gain#*#" 
#event SpellBlocked "Your spell did not #*#" 
#event SpellBlocked "Your spell would not #*#" 
#event GotSummoned  "You have been summoned!" 
#event NoSeeTarget  "#*#You cannot see your target.#*#" 
#event TargetTooFar "#*#Your target is too far away, get closer#*#" 
#event CantHitThem  "You can't hit them from here."
#event TooFarCorpse "You are too far away to loot that corpse."
#event SelfAttack "Try attacking someone other then yourself#.#"


#include spell_routines.inc 
#turbo 10 

Sub Main 
|------------------------------------------------------------ 
|Code: User Variables 
|------------------------------------------------------------ 

   /declare HPHealFight int outer 60 
   /declare HPHealRest int outer 80 
   /declare ManaforPull int outer 80 

   /declare MaxRadius int outer 50
   /declare MaxZDistance int outer 50 
   /declare Range int outer 12 
   /declare SnareNPC int outer 0 
   /declare NukeNPC int outer 0 
   /declare BuffSpells int outer 9 
   /declare CorpseLoot int 1

   /declare DDSpell string outer "Cease"
   /declare HealSpell string outer "Light of Piety" 
   /declare SnareSpell string outer "Celestial Stun"
   /declare BuffSpell1 string outer "Grim Aura" 
   /declare BuffSpell2 string outer "Brell's Brawny Bulwark" 
   /declare BuffSpell3 string outer "Valor of Marr" 
   /declare BuffSpell4 string outer "Affirmation" 
   /declare BuffSpell5 string outer "Pious Fury"  
   /declare BuffSpell6 string outer "Form of Defense III"
   /declare BuffSpell7 string outer "Primal Guard"
   /declare BuffSpell8 string outer "Frost Guard"
   /declare BuffSpell9 string outer "Hateful Guard"
   /declare BuffSpell10 string outer
   /declare BuffSpell11 string outer 
   /declare BuffSpell12 string outer  

   /declare DDSpellName string outer "Cease"
   /declare HealSpellName string outer "Light of Piety" 
   /declare SnareSpellName string outer "Celestial Stun"
   /declare BuffSpellName1 string outer "Reaper's Ring" 
   /declare BuffSpellName2 string outer "Brell's Brawny Bulwark" 
   /declare BuffSpellName3 string outer "Valor of Marr" 
   /declare BuffSpellName4 string outer "Affirmation" 
   /declare BuffSpellName5 string outer "Pious Fury" 
   /declare BuffSpellName6 string outer "Hanvar's Hoop" 
   /declare BuffSpellName7 string outer "Prism of Dark Hues" 
   /declare BuffSpellName8 string outer "Pauldron of Dark Auspices"
   /declare BuffSpellName9 string outer "Mask of Lament"
   /declare BuffSpellName10 string outer
   /declare BuffSpellName11 string outer 
   /declare BuffSpellName12 string outer 


   /declare DDSpellGem string outer "gem1"
   /declare HealSpellGem string outer "gem4" 
   /declare SnareSpellGem string outer "alt"
   /declare BuffSpellGem1 string outer "item" 
   /declare BuffSpellGem2 string outer "gem7" 
   /declare BuffSpellGem3 string outer "gem2" 
   /declare BuffSpellGem4 string outer "gem8" 
   /declare BuffSpellGem5 string outer "gem2" 
   /declare BuffSpellGem6 string outer "item" 
   /declare BuffSpellGem7 string outer "item"
   /declare BuffSpellGem8 string outer "item"
   /declare BuffSpellGem9 string outer "item"


|------------------------------------------------------------ 
|Warning: Stop editing here. 
|------------------------------------------------------------ 
|Code: Array & Variable Information. 
|------------------------------------------------------------ 

   /declare BuffSub int outer 1 
   /declare BuffBlock[${BuffSpells}] int outer 0 
   /declare TargetID int outer 0 
   /declare AddCounter int outer 1 
   /declare AddIDArray[10] int outer 0 
   /declare AddIDCounter int outer 1 
   /declare FastRange int outer 
   /declare RangeMax int outer 
   /declare RangeMin int outer 
   /varcalc FastRange ${Range}+3 
   /varcalc RangeMax ${Range}+1 
   /varcalc RangeMin ${Range}-1 
   /declare MyXLOCA int outer 0 
   /declare MyYLOCA int outer 0 
   /declare BreakLoop int outer 0  
   /declare xDistance int outer 0 
   /declare AnchorX int outer ${Me.X} 
   /declare AnchorY int outer ${Me.Y} 
   /declare MyTargetName string outer 
   /declare MyTargetDead int outer 0 
   /declare InvalidTargetID int outer 0 
   /declare RandomWait int outer 0 
   /declare Fighting int outer 0 
   /declare TargetDead int outer 0 
   /declare Snared int outer 0 
   /declare MyXLOC int outer 0 
   /declare MyYLOC int outer 0 
   /declare Oktopull int outer 1 
   /declare Mobstoloot int outer 0 
   /call ReadINI HunterMob.ini "${Zone.Name}" Mob 
   /if (!${Defined[MobArray]}) { 
      /echo Mob Array Creation Error, ending macro... 
      /endmacro 
   } 
   /call ReadINI HunterLoot.ini "${Zone.Name}" Loot 
   /if (!${Defined[LootArray]}) { 
      /echo No Loot Array Created... 
   } 
   /cleanup 
   /fastdrop on 
   /lootn never 


|-------------------------------------------------------------------------------- 
|Code: Main Loop 
|-------------------------------------------------------------------------------- 

 :Start
  :Start 
   /if (${Target.ID}) /call CombatSub 
   else { 
      /call CheckBuffs 
      /call CheckHP 
      /call CheckMana 
      /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor 
    } 
   /goto :Start 
/return 

|-------------------------------------------------------------------------------- 
|Code: Combat 
|-------------------------------------------------------------------------------- 
Sub CombatSub 
   /delay 1s 
   /stand 
   /echo Attacking ${Target.CleanName} NOW! 
   /varset Fighting 1 
   /varset TargetDead 0 
   /face nolook 
   /if (${SnareNPC}==1) /call Cast ${SnareSpell} ${SnareSpellGem} 
   :CombatLoop 
   | /squelch /target npc id ${TargetID} 
   /squelch /stick ${Range} 
   /squelch /attack on 
   /doevents 
   /if ((${Me.AbilityReady[Kick]}) && (${Me.State.NotEqual[STUNNED]})) /doability Kick 
   /if ((${Me.AbilityReady[Taunt]}) && (${Me.State.NotEqual[STUNNED]})) /doability Taunt 
   /call CheckHP 
   /if ((${Target.PctHPs}>30&&${Me.PctMana}>90) && (${Me.State.NotEqual[STUNNED]}) && 

(${NukeNPC}==1)) /call cast ${DDSpell} ${DDSpellgem} 
   /if ((${Snared}<1) && (${Spawn[npc id ${TargetID}].ID}!=NULL) && (${Me.State.NotEqual

[STUNNED]}) && (${SnareNPC}==1)) /call Cast ${SnareSpell} ${SnareSpellGem} 
   /if (${Target.ID}) /goto :CombatLoop  
   /doevents 
   /varset Snared 0 
   /varset TargetDead 1 
   /varset Fighting 0 
   /squelch /attack off 
   /if (${CorpseLoot}==1) /call ClearCorpses
/return 


|-------------------------------------------------------------------------------- 
|Code: Check Buffs 
|-------------------------------------------------------------------------------- 
Sub CheckBuffs 
   /for BuffSub 1 to ${BuffSpells} 
      /if ((${Me.Buff[${BuffSpell${BuffSub}}].Duration}<30)&&(${BuffBlock[${BuffSub}]}!=1)) 

{ 
         /target ${Me.Name} 
         /call Cast ${BuffSpellName${BuffSub}}  ${BuffSpellGem${BuffSub}} 
         /target clear
      } 
      /doevents 
   /next BuffSub 
   /varset BuffSub 1 
/return 

|-------------------------------------------------------------------------------- 
|Code: HP/Mana Upkeep 
|-------------------------------------------------------------------------------- 

Sub CheckHP 
   |Do I need to heal during fight? 
   /if ((${Int[${Me.PctHPs}]}<${HPHealFight})&&${Fighting}) { 
      /call Heal 
   } 
   |Do I need to heal during downtime? 
   /if ((${Int[${Me.PctHPs}]}<${HPHealRest}) &&!${Fighting}) { 
      /call Heal 
      /squelch /target clear 
   } 
/return 

Sub CheckMana 
   |Enough Mana to pull? 
   /if (${Int[${Me.PctMana}]}<${ManaforPull}) { 
      /varset Oktopull 0 
   } 
   /if (${Int[${Me.PctMana}]}>${ManaforPull}) { 
      /varset Oktopull 1 
   } 
/return 

Sub Heal 
   /if ((${Me.Gem[${HealSpell}]})&&(${Me.SpellReady[${HealSpell}]})) { 
      /squelch /stick off 
      /squelch /attack off 
      /declare TempID int inner 0 
      /varset TempID ${Target.ID} 
      /target ${Me.Name} 
      /call Cast ${HealSpell} ${HealSpellGem}
      /squelch /target id ${TempID} 
   } 
/return 

|-------------------------------------------------------------------------------- 
|Code: Looting 
|-------------------------------------------------------------------------------- 
Sub ClearCorpses 
   /declare CorpseSub int local 
   /for CorpseSub 1 to ${Mobstoloot} 
      /if (${CorpseLoot}==0) /return
      /call LootMob
   /next CorpseSub 
   /call ResetSub 
/return 

Sub LootMob 
   /declare LootSlot int inner 0 
   /declare LootCheck int inner 0 
   /declare LootTotal int inner 0 
   /declare LootLoop int local 0 
   :WaitLootMobWnd 
   /squelch /target corpse radius 100 
   /call MoveToTarget
   /if (${CorpseLoot}==0) /return
   /delay 5 
   /squelch /stick 
   /if (${Target.Type.Equal[CORPSE]}) /loot 
   /delay 5 
   /varcalc LootLoop ${LootLoop}+1 
   /if (${LootLoop}>3) /return 
   /if (!${Corpse}) /goto :WaitLootMobWnd 
   /if (!${Corpse.Items}) { 
      /echo NO LOOT! Cheap Bastard! 
      /notify LootWnd DoneButton leftmouseup 
      /delay 2 
      /return 
   } 
   /squelch /stick off 
   /varset LootTotal ${Corpse.Items} 
   /for LootSlot 1 to ${LootTotal} 
      /itemnotify loot${LootSlot} leftmouseup 
      /delay 1s 
      /for LootCheck 1 to ${LootArray.Size} 
         /if (${Cursor.Name.Find[${LootArray[${LootCheck}]}]}) { 
            /echo Keeping a ${Cursor.Name}... WOOT! 
            /varcalc LootStats[${LootCheck}] ${LootStats[${LootCheck}]}+1 
            /autoinventory 
            /delay 1s 
         } 
      /next LootCheck 
      /if (${Cursor.Value}>9000 && ${Cursor.Stackable}) { 
         /echo Keeping a ${Cursor.Name}... 
         /autoi 
         /delay 1s 
      }  
      /if (${Cursor.NoDrop}&&!${Cursor.Magic}) { 
         /echo Destroying a ${Cursor.Name}... 
         /des 
         /delay 1s 
      }  
      /if (${Cursor.NoDrop}&&${Cursor.WornSlots}<1) { 
         /echo Destroying a ${Cursor.Name}... 
         /des 
         /delay 1s 
      }  
      /if (${Cursor.ID}) { 
         /echo Dropping a ${Cursor.Name}... 
         /drop 
         /delay 1s 
      } 
   /next LootSlot 
   /notify LootWnd DoneButton leftmouseup 
/return 



|-------------------------------------------------------------------------------- 
|Code: Reset 
|-------------------------------------------------------------------------------- 
Sub ResetSub 
   /keypress esc 
   /keypress esc 
   /keypress esc 
   /keypress esc 

   /varset Mobstoloot 0 
   /varset AddIDCounter 1 
   /varset AddCounter 1 
   /varset TargetID 0 
   /varset TargetDead 0 
   /varset Fighting 0 
   /varset RandomWait ${Math.Rand[3]} 
   /varcalc RandomWait ${RandomWait}+1 
   /echo Paranoia - Waiting ${RandomWait} seconds before resuming 
   /delay ${RandomWait}s 
/return 

|-------------------------------------------------------------------------------- 
|Code: Reading from an INI File 
|-------------------------------------------------------------------------------- 
Sub ReadINI(FileName,SectionName,ArrayType) 
   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}... 
   /delay 1s 
   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) { 
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro... 
      /delay 1s 
      /return 
   } 
   /declare nValues int local 1 
   /declare nArray int local 0 
   /declare KeySet string local ${Ini[${FileName},${SectionName}]} 
   :CounterLoop 
    
/if (${Ini[${FileName},${SectionName},${ArrayType}${nValues},NOTFOUND].Equal[NOTFOUND]}) { 

      /varcalc nValues ${nValues}-1 
      /goto :MakeArray 
   } 
   /varcalc nValues ${nValues}+1 
   /goto :CounterLoop 
   :MakeArray 
   /if (!${nValues}) /return 
   /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) { 
      /echo Declaring Mob Array... 
      /declare MobArray[${nValues}] string outer 
      /declare MobStats[${nValues}] string outer 
   } 
   /if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) { 
      /echo Declaring Loot Array... 
      /declare LootArray[${nValues}] string outer 
      /declare LootStats[${nValues}] string outer 
   } 
   /for nArray 1 to ${nValues} 
      /if (${FileName.Equal["HunterMob.ini"]}) { 
         /varset MobArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}

${nArray}]} 
         /varset MobStats[${nArray}] 0 
      } 
      /if (${FileName.Equal["HunterLoot.ini"]}) { 
         /varset LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}

${nArray}]} 
         /varset LootStats[${nArray}] 0 
      } 
   /next nArray 
   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 
   /delay 1s 
/return 

|-------------------------------------------------------------------------------- 
|Code: Anchor 
|-------------------------------------------------------------------------------- 
Sub MoveToAnchor 
   /declare iCount int local 
   /varset iCount 0 
   /echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}. 
   :AnchorMoveLoop 
   /delay 1 
   /doevents 
   /face fast nolook loc ${AnchorY},${AnchorX} 
   /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) { 
      /keypress forward hold 
   } else { 
      /keypress forward 
      /face fast away nolook loc ${AnchorY},${AnchorX} 
      /return 
   } 
   /if (${iCount}>2) { 
      /call CheckObstacle 
      /face fast nolook loc ${AnchorY},${AnchorX} 
      /varset iCount 0 
   } 
   /varcalc iCount ${iCount}+1 
   /goto :AnchorMoveLoop 
/return 

Sub CheckAnchor 
   /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor 
/return 

|-------------------------------------------------------------------------------- 
|Code: Get Closer 
|-------------------------------------------------------------------------------- 
Sub MoveToTarget 
  :MoveLoop 
  /echo Moving to ${Target.CleanName}! 
  /if (${Target.Distance} > 5) { 
    /face fast 
    /keypress forward hold 
    /delay 2 
    /goto :MoveLoop 
  } else { 
    /keypress forward 
    /keypress back 
  } 
/return 

|-------------------------------------------------------------------------------- 
|Code: Obstacle 
|-------------------------------------------------------------------------------- 
sub Obstacle 
   /keypress forward 
   /keypress back hold 
   /delay 3 
   /keypress back 
   /if (${Math.Rand[2]}) { 
      /keypress strafe_right hold 
      /delay 1 
      /keypress strafe_right 
   } else { 
      /keypress strafe_left hold 
      /delay 1 
      /keypress strafe_left 
   } 
   /keypress forward hold 
/return 

sub CheckObstacle 
   /varset MyXLOCA ${Me.X} 
   /varset MyYLOCA ${Me.Y} 
   /delay 2 
   /if (${MyXLOCA}==${Me.X} && ${MyYLOCA}==${Me.Y}) /call Obstacle 
/return 

Sub HitObstacle 
   /echo Obstacle hit, moving around it... 
   /keypress forward 
   /keypress back hold 
   /delay 2 
   /keypress back 
   /if (${Math.Rand[100]}+1>50) { 
      /keypress strafe_right hold 
   } else { 
      /keypress strafe_left hold 
   } 
   /delay 3 
   /keypress strafe_right 
   /keypress strafe_left 
   /keypress forward hold 
/return 

|-------------------------------------------------------------------------------- 
|Code: Events 
|-------------------------------------------------------------------------------- 

Sub Event_TargetTooFar 
  /call MoveToTarget 
  /delay 1 
  /keypress back 
/return 

Sub TooFarCorpse
   /target clear
   /varset CorpseLoot 0
/return

Sub SelfAttack
   /target clear
/return

Sub CantHitThem
  /call MoveToTarget 
  /delay 1 
  /keypress back 
/return 

Sub Event_NoSeeTarget 
  /keypress back hold 
  /delay 1 
  /keypress back 
/return 

Sub Event_GotSummoned 
  /keypress back hold 
  /delay 1 
  /keypress back 
/return 

Sub Event_SpellBlocked 
   /varset BuffBlock[${BuffSub}] 1 
   /echo Not buffing with ${BuffSpell${BuffSub}} 
/return 

Sub Event_Exp 
   /varset Snared 0 
   /varcalc Mobstoloot ${Mobstoloot}+1 
/return 

Sub Event_OORange 
   /call CheckObstacle 
/return 

Sub Event_OORLoot 
   /call CheckObstacle 
/return 

Sub Event_SnareLand 
   /varcalc Snared ${Snared}+1 
/return 

Sub Event_Dead 
   /exit 
/return
 
AFK agro killer

Users who are viewing this thread

Back
Top