• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Mandrack's Necro macro Total AFK macro 55-70 Necro then aa's.

Also noticed something after zoning back in it will go to a new mob to fight but not summon pet and it fears be for snaring
 
You should add that when it zones back in the macro resets itself completly.

for me this has solved about 99% of the problems in the DOT version..

just add a docommands /mac necrofear in the zonein..that will reset the whole macro.
 
alright so I found where this instance is, but I can't get one with low enough level mobs for me to be able to kill there...
the macro works fine, my only problem is I keep getting mobs that are above level 60. but i am level 65 and do not have a fear that lands on anything above 60.

I don't have another account to help get myself a lower level instance.
does anyone have any suggestions?
I really would like to enjoy something like this.
 
Last edited:
alright. this is not a "Total AFK" macro. I started it, it ran fine for one mob, I got up and walked away and i came back dead.

it started fine, buffed me buffed the pet, then warps to the first mob, summons pet, then snares, sicks pet, and as soon as the mob agros.......
the macro runs me across the room and doesn't stop even if theres a wall, and then it just starts trying to cast, then runs back and forth while the pet and my necro get pummled.

oh it also zones back into the instance too soon after leaving. can anyone please point out where you alter how much mana / hp one has before rentering the instance after it exits you, from being beaten on?

this has happened every time I've tried to use the macro.

any suggestions? anyone that could help if i posted my copy?
 
Last edited:
OK i have a 66 necro with a minor problem... I can not get low enough mobs to fear... Tones macro worked fine... I just could not fear the mobs. (level 62-65)

Until I hit 67.. and load the new fear spell... fear kiting FH is not gonna work.

The orignial Root Rot does not work. and the Root Rot sorenbro has .. had issues also.

So i figured let me take a stab at editing the macros...

Using tones fear mac... and sonenbro mac This is what i came up with.

It works BUT.. I do not know how to put a condition in there so that the DOTS only cast every X minutes or when the DOT message is not shown.

I also organized the spell definitions in here a bit.

PLEASE coders take a peak and let me know what i can do to fix this.


Line 484 is where i added dots casting.

Line 1049 is a copy of DoTheFear but with Root instead



thanks

Rich (BB code):
| Useage      : /macro necroroot
| Description : This macro will root Rot mobs of
|               The Forgotten Halls. It assumes you have an instance
|               And are inside already.
|------------------------------------------------------------------------------
#turbo 40

|edits are at 145 to change warp (push Control G in notepad and 144)
|line 19 and 20 to edit monsters level.
|spells to edit 79 to 116
|Edit Spell Set names Line 532 is PET Spells buffs and Line 342 is Dot Spells

| Define the ranges of mobs you can handle kiting here.
| If no mobs in this range exist in the instance, the macro
| will freeze.
#define MIN_MOB_LVL 63
#define MAX_MOB_LVL 66
|this is the place you need to edit the monsters level you are hunting.
#define CAST_SUCCESS 0
#define CAST_OUTOFRANGE 1
#define CAST_CANNOTSEE 2
#define CAST_RETRY 3
#define CAST_IN_PROGRESS 4
#define CAST_ABORT -1

#define PLUGIN_NEEDED "/call CheckPlug"
#define DELAY "/noparse /call Delay"

#event Blocked "The way is blocked to you.#*#"
#event NoMount "#*#You can not summon a mount#*#"
#event OOR "#*#too far away to loot#*#"
#event Retry "#*#Your spell fizzles#*#"
#event Retry "#*#Your casting has been interrupted#*#"
#event Retry "#*#Your spell is interrupted.#*#"
#event Retry "#*#You haven't recovered yet...#*#"
#event Retry "#*#Spell recovery time not yet met.#*#"
#event Retry "#*#Your target resisted the #*#"
#event Abort "#*#Insufficient Mana to cast this spell!#*#"
#event OutOfRange "#*#Your target is out of range, get closer!#*#"
#event NoLOS "#*#You cannot see your target.#*#"
#event Stunned "#*#You cannot cast while stunned#*#"
#event Stunned "#*#You *CANNOT* cast spells, you have been silenced!#*#"
#event Standing "#*#You must be standing to cast a spell#*#"
#event Standing "#*#has fallen to the ground.#*#"
#event Collapse "#*#Your gate is too unstable, and collapses.#*#"
#event Abort "#*#Your target is immune to changes in its attack speed.#*#"
#event Retry "#*#too distracted to cast#*#"
#event Zoned "You have entered#*#"
#event PetAggro "#*#pet is the focus of something#*#"

|Events for counting the money we loot.
#event CashLoot "You receive #1#"

|Event for re-rooting
#event root "#*#root spell has worn off#*#"

#event ImHit "|${Target.CleanName}|#*#YOU for#*#"

|-- The normal debug - for normal play.
| Enable: "/echo", Disable: "/squelch /echo"
#define DEBUG_1 /echo
|-- Deeper debugging - enable when trying to find bugs.
#define DEBUG_2 /echo
|-- The Deepest debugging - will spam a lot.
#define DEBUG_3 "/squelch /echo"

|-- Destroys Silver if you have more than the given amount! 0=disable
#define DESTROY_GOLD_IF_ABOVE 0
|-- Destroys Silver if you have more than the given amount! 0=disable
#define DESTROY_SILVER_IF_ABOVE 500
|-- Destroys Copper if you have more than the given amount! 0=disable
#define DESTROY_COPPER_IF_ABOVE 500

|-- At what range do we snare/send in pet?
#define INITIALIZE_ATTACK_RANGE 100
|here and down you need to edit the spell list, and the pet you want to use.
|-- What pet do we want?
#define PET_SPELL "Child of Bertoxxulous"
|-- Favorite gem spot for the pet (1-8)
#define PET_GEM 6
|-- How far off should the pet be before we summon it?
#define MAX_PET_RANGE_BEFORE_SUMMON 150
|-- How low on health should the pet be before we heal it (noncombat)
#define HEAL_PET_BELOW_PCT 70

|SPELL DEFINITION AREA
|Define Spell name
|Define Spell Gem Slot (1-8)

#define SUMMON_SPELL "Summon Companion"
#define SUMMON_GEM 1

| Change SPLURT_GEM to 0 if you lack it.
#define SPLURT_SPELL "Splurt"
#define SPLURT_GEM 1

|-- What snare spell
#define SNARE_SPELL "Insidious Retrogression"
#define SNARE_GEM 2

#define HEAT_DOT "Funeral Pyre of Kelador"
#define HEAT_DOT_GEM 3

|-- Name of pet healing spell
#define HEAL_PET_SPELL "Touch of Death"
#define HEAL_PET_GEM 4

|-- Name of LICH spell
#define LIFE_DOT "Saryrn's Kiss"
#define LIFE_DOT_GEM 5

#define DISEASE_DOT "Chaos Plague"
#define DISEASE_DOT_GEM 5

|What is our feign death spell of choice? (Requires it be already mem'd, memorizing before feigning = death)
#define FEIGN_SPELL "Feign Death"
#define FEIGN_GEM 6

#define POISON_DOT "Blood of Thule"
#define POISON_DOT_GEM 7

|-- Name of Conversion spell
#define LICH_SPELL "Seduction of Saryrn"
#define LICH_GEM 8

|-- Name of root spell
#define root_SPELL "Petrifying Earth"
#define root_GEM 8

|-- Name of pet haste spell
#define PET_HASTE "Rune of Death"
#define PET_HASTE_GEM 9

|-- Save a spell set called dots With Spells in this order
|-- Splurt / Insidious Retrogression / Funeral Pyre of Kelador
|-- Touch of Death / Chaos Plague / Feign Death
|-- Blood of Thule / Petrifying Earth / Rune of Death

|-- Save a spell set called afk-root With Spells in this order
|-- Shadow Guard Slot 1/DMF Slot 6/ Force Shield Slot 7 /Seduction of Saryrn Slot 8

|-- Name of Clickies
|#define ROD_NAME "Summoned: Modulating Rod"

|-- If your health gets below this lvl start /beep'ing and FD
#define ALARM_HEALTH_BELOW_PCT 40

|-- What is the minimum mana I should have, wait if below
#define MIN_MANA_BEFORE_MEDITATE 25

|--How many waypoints exist on the kiting path for the rats.
#define WP_SIZE 37
#define Y_COORD 1
#define X_COORD 2
#define Z_COORD 3

Sub CheckPlug(who)
   /if (${Plugin[${who}].Name.Length}==NULL) {
       /echo This requires the ${who} plugin to work.
       /echo Install and/or /plugin ${who} and try again.
       /beep
       /endmacro
   }
/return

|----------------------------------------------------------------------------
|SUB: Main - Declarations and Initialization
|----------------------------------------------------------------------------
Sub Main
   PLUGIN_NEEDED MQ2Ultrawarp
   |you have to edit the name of your warp in here.
   |Buffs to be kept up on self (max 15) - "Buff" or "Buff|GemSlot"
   /declare MyBuffs[3] string outer
   /varset MyBuffs[1] "Shadow Guard|1"
   /varset MyBuffs[2] "Dead Man Floating|6"
   /varset MyBuffs[3] "Force Shield|7"
  
   |Buffs to be kept up on pet (max 15) - "Buff" or "Buff|GemSlot"
   /declare PetBuffs[1] string outer
   |/varset PetBuffs[1] "Spirit Armor|8"
   /varset PetBuffs[1] "PET_HASTE|PET_HASTE_GEM"

   /declare weZoned bool outer FALSE
   /declare wayBlocked bool outer FALSE
   /declare mountFlag bool outer TRUE
   /declare result int outer
   /declare startingPP int outer ${Me.Platinum}
   /declare startingXP int outer ${Me.Exp}
   /declare wpY float outer
   /declare wpX float outer
   /declare wpZ float outer
   /declare waypoint[WP_SIZE,3] int outer
   /varset waypoint[1,Y_COORD] -598
   /varset waypoint[1,X_COORD] 101
   /varset waypoint[1,Z_COORD] 4
   /varset waypoint[2,Y_COORD] -596
   /varset waypoint[2,X_COORD] 108
   /varset waypoint[2,Z_COORD] 4
   /varset waypoint[3,Y_COORD] -597
   /varset waypoint[3,X_COORD] -40
   /varset waypoint[3,Z_COORD] 4
   /varset waypoint[4,Y_COORD] -556
   /varset waypoint[4,X_COORD] -50
   /varset waypoint[4,Z_COORD] 4
   /varset waypoint[5,Y_COORD] -556
   /varset waypoint[5,X_COORD] -160
   /varset waypoint[5,Z_COORD] 4
   /varset waypoint[6,Y_COORD] -473
   /varset waypoint[6,X_COORD] -41
   /varset waypoint[6,Z_COORD] 4
   /varset waypoint[7,Y_COORD] -398
   /varset waypoint[7,X_COORD] -45
   /varset waypoint[7,Z_COORD] 4
   /varset waypoint[8,Y_COORD] -402
   /varset waypoint[8,X_COORD] 1
   /varset waypoint[8,Z_COORD] 4
   /varset waypoint[9,Y_COORD] -329
   /varset waypoint[9,X_COORD] 0
   /varset waypoint[9,Z_COORD] 13
   /varset waypoint[10,Y_COORD] -596
   /varset waypoint[10,X_COORD] 157
   /varset waypoint[10,Z_COORD] 2
   /varset waypoint[11,Y_COORD] -600
   /varset waypoint[11,X_COORD] 198
   /varset waypoint[11,Z_COORD] 4
   /varset waypoint[12,Y_COORD] -721
   /varset waypoint[12,X_COORD] 45
   /varset waypoint[12,Z_COORD] -10
   /varset waypoint[13,Y_COORD] -664
   /varset waypoint[13,X_COORD] 45
   /varset waypoint[13,Z_COORD] -4
   /varset waypoint[14,Y_COORD] -635
   /varset waypoint[14,X_COORD] 45
   /varset waypoint[14,Z_COORD] 4
   /varset waypoint[15,Y_COORD] -814
   /varset waypoint[15,X_COORD] 45
   /varset waypoint[15,Z_COORD] -10
   /varset waypoint[16,Y_COORD] -814
   /varset waypoint[16,X_COORD] 190
   /varset waypoint[16,Z_COORD] -11
   /varset waypoint[17,Y_COORD] -814
   /varset waypoint[17,X_COORD] 335
   /varset waypoint[17,Z_COORD] -10
   /varset waypoint[18,Y_COORD] -814
   /varset waypoint[18,X_COORD] 488
   /varset waypoint[18,Z_COORD] -35
   /varset waypoint[19,Y_COORD] -473
   /varset waypoint[19,X_COORD] -6
   /varset waypoint[19,Z_COORD] 4
   /varset waypoint[20,Y_COORD] -473
   /varset waypoint[20,X_COORD] 20
   /varset waypoint[20,Z_COORD] -2
   /varset waypoint[21,Y_COORD] -473
   /varset waypoint[21,X_COORD] 56
   /varset waypoint[21,Z_COORD] -10
   /varset waypoint[22,Y_COORD] -473
   /varset waypoint[22,X_COORD] 135
   /varset waypoint[22,Z_COORD] -11
   /varset waypoint[23,Y_COORD] -405
   /varset waypoint[23,X_COORD] 135
   /varset waypoint[23,Z_COORD] -11
   /varset waypoint[24,Y_COORD] -405
   /varset waypoint[24,X_COORD] 93
   /varset waypoint[24,Z_COORD] -11
   /varset waypoint[25,Y_COORD] -290
   /varset waypoint[25,X_COORD] 93
   /varset waypoint[25,Z_COORD] -11
   /varset waypoint[26,Y_COORD] -290
   /varset waypoint[26,X_COORD] 183
   /varset waypoint[26,Z_COORD] -11
   /varset waypoint[27,Y_COORD] -290
   /varset waypoint[27,X_COORD] 275
   /varset waypoint[27,Z_COORD] -11
   /varset waypoint[28,Y_COORD] -409
   /varset waypoint[28,X_COORD] 275
   /varset waypoint[28,Z_COORD] -11
   /varset waypoint[29,Y_COORD] -397
   /varset waypoint[29,X_COORD] -40
   /varset waypoint[29,Z_COORD] 4
   /varset waypoint[30,Y_COORD] -397
   /varset waypoint[30,X_COORD] 0
   /varset waypoint[30,Z_COORD] 4
   /varset waypoint[31,Y_COORD] -337
   /varset waypoint[31,X_COORD] 1
   /varset waypoint[31,Z_COORD] 12
   /varset waypoint[32,Y_COORD] -235
   /varset waypoint[32,X_COORD] 0
   /varset waypoint[32,Z_COORD] 20
   /varset waypoint[33,Y_COORD] -167
   /varset waypoint[33,X_COORD] 0
   /varset waypoint[33,Z_COORD] 20
   /varset waypoint[34,Y_COORD] -127
   /varset waypoint[34,X_COORD] 0
   /varset waypoint[34,Z_COORD] 14
   /varset waypoint[35,Y_COORD] -86
   /varset waypoint[35,X_COORD] 0
   /varset waypoint[35,Z_COORD] 4
   /varset waypoint[36,Y_COORD] 4
   /varset waypoint[36,X_COORD] 0
   /varset waypoint[36,Z_COORD] -6
   /varset waypoint[37,Y_COORD] 53
   /varset waypoint[37,X_COORD] 0
   /varset waypoint[37,Z_COORD] 4

   DEBUG_1 Starting macro
   |Group of locked target data
   /declare TargetName string outer
   /declare TargetID int outer
   /declare fightTimer timer outer

   /call MainSub
   DEBUG_1 Exited normally!
/return


|----------------------------------------------------------------------------
|SUB: MainSub - The main sub
|----------------------------------------------------------------------------
Sub MainSub
   |The main loop. After an attack we go here to acquire a new target
   /cleanup
:NewTarget
   /varset TargetID
   /if (${Corpse.Open}) {
       /notify LootWnd DoneButton leftmouseup
       /cleanup
   }
   /call AlwaysCheck
   /if (${Macro.Return}) /return
   /call DowntimeWork
   /if (${Macro.Return}==0) /goto :NewTarget

   /call AcquireTarget
   /if (${Macro.Return}) /goto :NewTarget
   /call BackOffFromTarget 40
   |/mqpause
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /goto :NewTarget
   /if (${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON) /call SummonPet TRUE
   |/call MyCast "SNARE_SPELL" SNARE_GEM
   |/pet attack
   /memspellset dots
/delay 1m ${Window[SpellBookWnd]}==FALSE
   /call DoTheroot
   /if (${Int[SPLURT_GEM]}>0) /call MyCast "SPLURT_SPELL" SPLURT_GEM
   /call MyCast "LIFE_DOT" LIFE_DOT_GEM
   /call MainAttack
   /if (${Me.Pet.ID}) {
       /if (${Me.Pet.Distance}>20) /warp loc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
   } else {
       /warp succor
   }
   /goto :NewTarget
/return

| AlwaysCheck - health, aggro, zone, etc. ALSO CALLED FROM EVENTS.
| "/call AlwaysCheck nocast" to never perform casting (eg event calls)
| 0=no problem; 1=panic
Sub AlwaysCheck(string casting)
   /doevents Zoned
   /if (${Cursor.ID}) /autoinventory
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       /call NoLich
       /if (${Me.PctHPs}<=20) {
           /instacamp
           /endmacro
       }
       /if (${Spawn[${TargetID}].Type.Equal[NPC]} && ${Zone.Name.Find[forgotten]}!=0) {
           /call BailOut
           /return 1
       }
   }
   /if (${Me.PctMana}>90 || ${Me.PctHPs}<50) {
       /call NoLich
   }
   /if (${casting.Equal[nocast]}==FALSE) {
       /if (${Me.Pet.ID}!=0 && ${Me.PetBuff[PET_HASTE]}==0) /call MyCast "PET_HASTE" PET_HASTE_GEM
       /if (${Me.PctMana}<90 && ${Me.Buff[LICH_SPELL].ID}==NULL && ${Me.PctHPs}>50) /call MyCast "LICH_SPELL" LICH_GEM
       /if (${FindItem[ROD_NAME].ID}!=0) /cast item "ROD_NAME"
   }
   /if (${weZoned}) {
       /declare zoneDelay timer 3m
       /varset weZoned FALSE
       /varset wayBlocked FALSE
       /doevents flush
       /if (${Zone.Name.Find[forgotten]}==NULL) {
           /if (${Zone.Name.Find[nedaria]}==NULL) {
:quit
               /dismount
               /camp desktop
               /endmacro
           }
           /warp loc 1543 -670 96
           /keypress back
           /keypress forward
           /delay 1
           /sit
           /popup Waiting for health>50%...
           /delay 5m ${Me.PctHPs}>50
           /face fast loc 1543,-670
:zoning
           /delay 1s
           /click left 400 300
           /delay 5
           /click left 500 400
           /delay 5
           /click left 600 500
           /doevents Zoned
           /doevents Blocked
           /delay 1s ${weZoned}||${wayBlocked}
           /if (${wayBlocked}) /goto :quit
           /if (${weZoned}==FALSE && ${zoneDelay.Value}>0) /goto :zoning
           /if (${Zone.Name.Find[forgotten]}==NULL) /goto :quit
       }
   }
/return 0

Sub NoLich
   /declare slot int local
   /varcalc slot ${Me.Buff[LICH_SPELL].ID}-1
   /if (${slot}>=0) /notify BuffWindow Buff${slot} leftmouseup
/return

Sub BailOut
   /dismount
   /attack off
    /warp succor
   /delay 1
   /target npc a_harindi_guide
   |/warp loc -827 -30 -11
   /warp target 
   /delay 2
   /face fast nolook
:panic
   /say I am ready to leave!
   /delay 1
   /doevents Zoned
   /delay 5 ${weZoned}
   /if (${Zone.Name.Find[forgotten]}) {
       /keypress forward hold
       /delay 4
       /keypress forward
       /if (${Target.ID}) {
           /face fast nolook
       } else {
           /return
       }
       /goto :panic
   }
/return

|----------------------------------------------------------------------------
|SUB: MainAttack - Handles the kiting/killing
|----------------------------------------------------------------------------
Sub MainAttack
:attackAgain
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /doevents
   /target id ${TargetID}
   DELAY 1
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /call AlwaysCheck
   /if (${Macro.Return}) /return
   /if (${Target.ID}==${Me.Pet.ID}) {
       /assist
       DELAY 3 ${Target.ID}!=${Me.Pet.ID}
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${Me.PctHPs}>ALARM_HEALTH_BELOW_PCT && ${Me.Buff[LICH_SPELL].ID}==NULL) {
       DEBUG_3 Me.Buff[LICH_SPELL].ID==${Me.Buff[LICH_SPELL].ID}
       /call MyCast "LICH_SPELL" LICH_GEM
    }
   /call HealPet
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /face
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /call WarpCloser
   /if (${Me.Sitting}==FALSE && ${Me.Mount.ID}==0) /call Mount
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${fightTimer.Value}==0 && ${Target.PctHPs}>20) {
       /call DoTheroot
       /call MyCast "LIFE_DOT" LIFE_DOT_GEM
       /call MyCast "HEAT_DOT" HEAT_DOT_GEM
       /call MyCast "POISON_DOT" POISON_DOT_GEM
       /call MyCast "DISEASE_DOT" DISEASE_DOT_GEM
}
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${Target.PctHPs}>20 && ${Target.Speed}>50) {
       /warp target
       DELAY 1
       /call MyCast "SNARE_SPELL" SNARE_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}>0 && ${Target.Type.NotEqual[Corpse]}) /goto :attackAgain
:looties
   /call AlwaysCheck
   /if (${Zone.Name.Find[forgotten]}==NULL || ${Macro.Return}) /return
   /call DoTheLooting
   /varset TargetID
/return

|----------------------------------------------------------------------------
|SUB: DowntimeWork - Between fight rebuffs, etc.
|----------------------------------------------------------------------------
Sub DowntimeWork
| Check if we are low on mana or health. Heal or sit down if low
   /call CheckMana
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 1. Mana Checked

| Make sure pet is up + all its buffs are on it
   /call HealPet
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 2. Pet Health Checked

   /call MaintainPetBuffs
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 3. Pet Buffs Checked

| Make sure all buffs on self are up
   /call MaintainSelfBuffs
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 4. Buffs Checked

   /call AlwaysCheck
   /if (${Macro.Return}) /return 0

|-- SPELL SET for FH
   /memspellset afk-root
   /delay 1m ${Window[SpellBookWnd]}==FALSE
/return 1

Sub instaClicky
   /if (${FindItem[=Journeyman's Boots].ID}) /cast item "Journeyman's Boots"
   /if (${FindItem[=Shrunken Goblin Skull Earring].ID}) /cast item "Shrunken Goblin Skull Earring"
/return

|----------------------------------------------------------------------------
|SUB: AcquireTarget - Finding a target 0=success; 1=n/a
|----------------------------------------------------------------------------
Sub AcquireTarget
   /declare s int local
   /declare lvl int local
   /declare spn int local
   /squelch /target clear
   /varset TargetID
   /varset TargetName
:scan
   /varcalc s ${s}+1
   /varset spn ${LastSpawn[${s}].ID}
   /if (${spn}==0) /goto :acquired
   /if ((${Spawn[${spn}].CleanName.Find[squeaking]} || ${Spawn[${spn}].CleanName.Find[swooping]} || ${Spawn[${spn}].CleanName.Find[reject]}) && ${Spawn[${spn}].Type.Equal[Corpse]}==FALSE && ${Spawn[${spn}].Level}>=MIN_MOB_LVL && ${Spawn[${spn}].Level}<=MAX_MOB_LVL && ${Spawn[${spn}].Level}>${lvl}) {
       /if (${Spawn[${spn}].Y}<=-265 && ${Spawn[${spn}].Y}>=-429 && ${Spawn[${spn}].X}>=74 && ${Spawn[${spn}].X}<=298 && ${Spawn[${spn}].Level}>=47) {
           DEBUG_1 Ignoring mob in add area: ${Spawn[${spn}].CleanName}(L${Spawn[${spn}].Level})
       } else {
           /varset lvl ${Spawn[${spn}].Level}
           /varset TargetID ${Spawn[${spn}].ID}
       }
   }
   /goto :scan
:acquired
   /if (${TargetID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}!=0
       /if (${Target.CleanName.Find[${Me.CleanName}]}) {
           DEBUG_1 WTF? I got targeted!
           /return 1
       }
       /varset TargetID ${Target.ID}
       /varset TargetName ${Target.CleanName}
       /popup ${TargetName} (L${Target.Level})
       DEBUG_1 ${TargetName} (L${Target.Level})
       /return 0
   }
   DEBUG_3 AcquireTarget FAILED!
   /popup Waiting for mobs in range MIN_MOB_LVL-MAX_MOB_LVL...
   /call Mount
   /delay 5s
/return 1

| Find the closest WP in line-of-sight to our target
Sub FindWP
   /declare wp int local
   /declare Y int local
   /declare X int local
   /declare Z int local
   /declare dist float local 10000
   /varset wpY
   /varset wpX
   /varset wpZ
   /for wp 1 to WP_SIZE
       /varset Y ${waypoint[${wp},Y_COORD]}
       /varset X ${waypoint[${wp},X_COORD]}
       /varset Z ${waypoint[${wp},Z_COORD]}
       /if (${LineOfSight[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}    ]} && ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}    ]}<${dist}) {
           /varset wpY ${Y}
           /varset wpX ${X}
           /varset wpZ ${Z}
           /varset dist ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}    ]}
       }
   /next wp
/return

|warp closer to target, via WP if mob, or direct otherwise.
Sub WarpCloser
   /call AlwaysCheck nocast
   /if (${Macro.Return}) /return
   /if (${Target.ID}==0 || ${Target.ID}==${Me.ID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}>0
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /return
   /if (${Target.Type.Equal[Pet]}) {
       /warp target
   } else {
       /call FindWP
       /if (${wpY}!=0||${wpX}!=0||${wpZ}!=0) {
           /warp loc ${wpY} ${wpX} ${wpZ}
       } else {
           /if (${Me.Pet.ID}) /warp loc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
       }
   }
   DELAY 1
   /if (${Target.ID}) /face fast
/return

| DO NOT CALL DELAY FROM EVENTS!
| Parameters: delay timer setting + early exit condition
Sub Delay(string delayTime, string exitCond)
   /declare tmr timer local ${delayTime}
:moreDelay
   /call AlwaysCheck nocast
   /if (${tmr.Value}==0) /return
   /if (${exitCond}) {
       DEBUG_3 Early exit on condition: ${exitCond.Right[-1]}
       /return
   }
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Delay abort, ${tmr.Value} ticks left, LOW HEALTH!
       /return
   }
   /delay 1 ${exitCond}
   |/if (${Math.Calc[${tmr.Value}%10].Int}==0) DEBUG_3 /delay ${tmr.Value} ${exitCond.Right[-1]}:${exitCond}
   /doevents ImHit
   /doevents Retry
   /doevents Abort
   /doevents OutOfRange
   /doevents NoLOS
   /doevents Standing
   /doevents OOR
   /doevents CashLoot
   /doevents Zoned
   /doevents PetAggro
   /doevents NoMount
   /doevents Stunned
   /if (${Target.Type.Equal[NPC]}) /face
   /goto :moreDelay
/return

Sub MyCast(string spname, string gname)
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Corpse.Open}) /notify LootWnd DoneButton leftmouseup
   /if (!${Defined[spellName]}) /declare spellName string outer
   /varset spellName ${spname}
   /call DoCast ${gname}
   /doevents
   /if (${Target.ID}!=${TargetID} && ${TargetID}!=0) {
       /target id ${TargetID}
       DELAY 3 ${Target.ID}==${TargetID}
   }
   /if (${Target.Type.Equal[NPC]}) /face fast
/return

| Cast something with status return and event processing
| assumes outer variable spellName and TargetID
Sub DoCast(string gem)
   /declare tartype string local ${Spell[${spellName}].TargetType}
   /if (${gem.Equal[item]}) /varset tartype ${FindItem[=${spellName}].Spell.TargetType}
:recast
   /if (${tartype.Equal[Pet]} && ${Target.ID}!=${Me.Pet.ID}) {
       /if (${Me.Pet.ID}==0) /return
       /target id ${Me.Pet.ID}
       /delay 1
   } else /if (${tartype.Equal[Self]} && ${Target.ID}!=${Me.ID}) {
       /target myself
       /delay 1
   } else /if (${Target.Type.Equal[NPC]} && ${Target.ID}!=${TargetID}) {
       /target id ${TargetID}
       /delay 1
   }
   /if (${Target.Type.Equal[NPC]} && ${Target.PctHPs}<25) {
       DEBUG_3 Confusing/low health target (${Target.PctHPs}%)
       /return
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) {
       DEBUG_3 Target${Target.CleanName}(${Target.ID}) Dead?
       /return
   }
   /if (${Target.ID}!=${Me.ID}) {
       /face fast
       /if (!${LineOfSight[${Me.Y},${Me.X},${Me.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /call WarpCloser
   }
   /if (${gem.Equal[item]}) {
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast item "${spellName}"
   } else {
       /if (${Me.Gem[${spellName}]}==NULL) {
           /memspell ${gem} "${spellName}"
           DEBUG_3 book:${Window[SpellBookWnd]}; ${spellName}:${Me.SpellReady[${spellName}]}
           /delay 10s ${Window[SpellBookWnd]}==FALSE
           DELAY 15s ${Me.SpellReady[${spellName}]}
       } else {
           DEBUG_3 ${spellName}:${Me.SpellReady[${spellName}]}
           /if (!${Me.SpellReady[${spellName}]}) {
               DELAY 15s ${Me.SpellReady[${spellName}]}
           }
       }
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast "${spellName}"
   }
   /varset result CAST_IN_PROGRESS
   DELAY 2
   /doevents
   /if (${result}==CAST_IN_PROGRESS && ${Me.Casting.ID}==0) /goto :recast
   DELAY 30s ${Me.Casting.ID}==NULL
   /delay 1
   /doevents
   /if (${result}==CAST_IN_PROGRESS) /varset result CAST_SUCCESS
   DEBUG_3 Casting of ${spellName} complete, result=${result}
   /if (${result}==CAST_OUTOFRANGE || ${result}==CAST_CANNOTSEE) {
       /call WarpCloser
       /goto :recast
   } else /if (${result}==CAST_RETRY) {
       /if (!${Me.SpellReady[${spellName}]}) {
           /call instaClicky
           /varcalc result ${Spell[${spellName}].RecoveryTime}*10
           DELAY ${result} ${Me.SpellReady[${spellName}]}
       }
       /goto :recast
   }
/return

|----------------------------------------------------------------------------
|SUB: SummonPet - Summon pet if farther away than the defined range
|----------------------------------------------------------------------------
Sub SummonPet(bool force)
   /if (${force} || (MAX_PET_RANGE_BEFORE_SUMMON>0 && ${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON)) {
       DELAY 5s (${Me.Pet.Distance}<MAX_PET_RANGE_BEFORE_SUMMON||${force})
       /if (${Int[SUMMON_GEM]}<1 || ${Me.Pet.Distance}<MAX_PET_RANGE_BEFORE_SUMMON) /return
       DEBUG_1 Summoning pet. Its range is ${Me.Pet.Distance}
       /call MyCast "SUMMON_SPELL" SUMMON_GEM
   }
/return


|----------------------------------------------------------------------------
|SUB: HealPet - Heal pet if needed 0=just healed; 1=no problem
|----------------------------------------------------------------------------
Sub HealPet
   |Heal pet?
   /if ( ${Me.Pet.PctHPs}<HEAL_PET_BELOW_PCT && ${Me.PetBuff[HEAL_PET_SPELL]}==0 ) {
       /if ( ${Me.Pet.ID} ) {
           /target id ${Me.Pet.ID}
           DELAY 1
           /call MyCast "HEAL_PET_SPELL" HEAL_PET_GEM
           /return 0
       }
   }
/return 1

Sub Mount
   /if (${mountFlag}) {
       /if (${InvSlot[ammo].Item.Name.Find[Drum]}!=NULL && ${Me.Buff[Summon Drogmor].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else /if (${InvSlot[ammo].Item.Name.Find[Bridle]}!=NULL && ${Me.Buff[Summon Horse].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else {
           /if (!${Me.Sitting}) /sit
       }
   } else {
       /if (!${Me.Sitting}) /sit
   }
/return

|----------------------------------------------------------------------------
|SUB: CheckMana 0= need more med; 1=mana ok
| Now with histeresis - exit condition is above entry condition.
|----------------------------------------------------------------------------
Sub CheckMana
   /declare exitMana int local
   /declare exitHealth int local
   /varcalc exitMana MIN_MANA_BEFORE_MEDITATE+15
   /varcalc exitHealth ALARM_HEALTH_BELOW_PCT+20
   |Meditate?
   /if (${Me.PctMana}<MIN_MANA_BEFORE_MEDITATE || ${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Meditating.
       /popup Meditating...
       /call Mount
       /declare i int local
       /if ( ${Target.ID} ) /squelch /target clear
       /for i 1 to 10
           DELAY 1s
           /if ( ${Target.ID} ) /return 1
       /next i
       /if ( ${Me.PctMana}<${exitMana} || ${Me.PctHPs}<${exitHealth} ) {
           /return 0
       }
       DEBUG_2 Mana/health OK now.
   }
/return 1


|----------------------------------------------------------------------------
|SUB: MaintainPetBuffs - Heal pet and keep its buffs up
|   0= still busy; 1=all done
|----------------------------------------------------------------------------
Sub MaintainPetBuffs
   |If we have pet
   /if ( ${Me.Pet.ID}==0 ) {
       DEBUG_1 Creating new pet
       /call MyCast "PET_SPELL" PET_GEM
       /return 0
   }
   /call SummonPet
   /declare iCount int local
   /declare t string local
   /for iCount 1 to ${PetBuffs.Size}
       /call SplitString tmp_tmp ${PetBuffs[${iCount}]} "|"
       /varset t ${Me.PetBuff[${tmp_tmp[1]}]}
       /if ( ${t.Equal[NULL]} ) {
            /if ( !${Target.ID}!=${Me.Pet.ID} ) {
               /target id ${Me.Pet.ID}
            }
            |Cast with gemselection or default
            /if ( ${tmp_tmp.Size}>1 ) {
                /if (!${Me.SpellReady[${tmp_tmp[2]}]}) {
                   DELAY 15s ${Me.SpellReady[${tmp_tmp[2]}]}
               }
                DEBUG_3 Trying to cast "${tmp_tmp[1]}" ${tmp_tmp[2]}
                /call MyCast "${tmp_tmp[1]}" ${tmp_tmp[2]}
            } else {
                /if (!${Me.SpellReady[${tmp_tmp[1]}]}) {
                   DELAY 15s ${Me.SpellReady[${tmp_tmp[1]}]} 8 force
               }
                DEBUG_3 Trying to cast "${tmp_tmp[1]}"
                /call MyCast "${tmp_tmp[1]}" 8
            }
            |Return to top - so we dont keep buffing if being attacked
            /return 0
         }
   /next iCount
/return 1


|----------------------------------------------------------------------------
|SUB: MaintainSelfBuffs - Keep buffs up
|       0=still buffing; 1=all done
|----------------------------------------------------------------------------
Sub MaintainSelfBuffs
   /declare iCount int local
   /declare t string local
   /for iCount 1 to ${MyBuffs.Size}
       /call SplitString tmp_tmp ${MyBuffs[${iCount}]} "|"
       /varset t ${Me.Buff[${tmp_tmp[1]}]}
       /if ( ${t.Equal[NULL]} ) {
           /if ( !${Target.ID}!=${Me.ID} ) {
               /target myself
           }
           |Cast with gemselection or default
           /if ( ${tmp_tmp.Size}>1 ) {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}" ${tmp_tmp[2]}
               /call MyCast "${tmp_tmp[1]}" ${tmp_tmp[2]}
           } else {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}"
               /call MyCast "${tmp_tmp[1]}" 8
           }
           |Return to top - so we dont keep buffing if being attacked
           /return 0
       }
   /next iCount
/return 1

| Back off from current target so many units.
| Finds first line of sight on a horizontal, vertical, or
| diagonals that are at least as distant as desired.
Sub BackOffFromTarget(float dist)
   /declare by float local ${Target.Y}
   /declare bx float local ${Target.X}
   /varcalc by ${by}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /goto :backoff
   /varset by ${Target.Y}
   /varcalc bx ${bx}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /goto :backoff
   /varcalc by ${by}+${dist}
   /varset bx ${Target.X}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /goto :backoff
   /varset by ${Target.Y}
   /varcalc bx ${bx}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /goto :backoff
   /varcalc by ${by}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${    Target.Z}]}) /goto :backoff
   /face fast
   /keypress forward hold
   /delay 3s ${Target.Distance}>=${dist}
   /keypress forward
   /face fast
   /return
:backoff
   /warp loc ${by} ${bx} ${Target.Z}
   /delay 1
   /if (${Target.ID}) /face fast
/return


|----------------------------------------------------------------------------
|SUB: DoTheLooting
|----------------------------------------------------------------------------
Sub DoTheLooting
   /if (!${Defined[looted]}) /declare looted bool outer
   /target id ${TargetID}
   DELAY 1
   DEBUG_1 Going to loot
   DEBUG_3 DoTheLooting Target: ${Target.CleanName}, ID:${Target.ID}
   /warp target
   DELAY 1
   /loot
   /varset looted FALSE
   DELAY 6s (${Corpse.Open}&&${looted})
   /call LootMob
   /notify LootWnd DoneButton leftmouseup
   DELAY 1
   /doevents
   /declare xp int local
   /declare pp int local
   /declare level float local ${Me.Level}
   /varcalc level ${level}+${Math.Calc[${Me.Exp}/330.0].Milli}
   /varcalc xp ${Me.Exp}-${startingXP}
   /if (${xp}<0) /varcalc xp ${xp}+330
   /varcalc pp ${Me.Platinum}-${startingPP}
   /popup L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DEBUG_1 L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DELAY 5s
/return


|----------------------------------------------------------------------------
|SUB: LootMob
|----------------------------------------------------------------------------
Sub LootMob
   /declare LootSlot int local
   /if (!${Target.ID}) {
       /target npc corpse
       DELAY 1s ${Target.ID}>0
   }
   /loot
   DELAY 1s ${Corpse.Open}
   /if (${Corpse.Items}) {
       /for LootSlot 1 to ${Corpse.Items}
           /itemnotify loot${LootSlot} leftmouseup
           DELAY 1s ${Cursor.ID}>0
           /destroy
       /next LootSlot
   }
   /cleanup
/return


|----------------------------------------------------------------------------
|SUB: SplitString - A generic string splitter.
|----------------------------------------------------------------------------
Sub SplitString(string varname, string inputstring, string splitter)
   |/echo varname: "${varname}", inputstring: "${inputstring}", splitter: "${splitter}"
   /declare i int local
   /declare stringcnt int local

   |The normal splitter. Splitter string is just 1 in length.
   /if (${splitter.Length}==1) {
       /varcalc stringcnt ${inputstring.Count["${splitter}"]} + 1
       /if (!${Defined[${varname}]}) {
           /declare ${varname}[${stringcnt}] string outer
       } else {
           /deletevar ${varname}
           /declare ${varname}[${stringcnt}] string outer
       }
       /for i 1 to ${stringcnt}
           /varset ${varname}[${i}] ${inputstring.Token[${i},"${splitter}"]}
       /next i
   }
/return


|----------------------------------------------------------------------------
|SUB: DestroyCopper - Destroy all the copper
|----------------------------------------------------------------------------
Sub DestroyCopper
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money3 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DestroySilver - Destroy all the silver
|----------------------------------------------------------------------------
Sub DestroySilver
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money2 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DestroyGold - Destroy all the gold
|----------------------------------------------------------------------------
Sub DestroyGold
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money1 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return


|----------------------------------------------------------------------------
|SUB: DoTheFear - Fear target
|----------------------------------------------------------------------------
|Sub DoTheroot
|   /if ( ${Me.PctMana}>10 && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}>19) {
|       /call MyCast "FEAR_SPELL" FEAR_GEM
|       /varset fightTimer 31s
|   }
|/return
|----------------------------------------------------------------------------
|SUB: DoTheRoot - Root target
|----------------------------------------------------------------------------
Sub DoTheRoot
   /if ( ${Me.PctMana}>10 && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}>19) {
       /call MyCast "root_SPELL" root_GEM
       /varset fightTimer 31s
   }
/return

|----------------------------------------------------------------------------
|SUB: Event_CashLoot - Will count the loot so far running the macro
|----------------------------------------------------------------------------
Sub Event_CashLoot(string Line, string cash)
   /if ( DESTROY_GOLD_IF_ABOVE>0 && ${Me.Gold}>DESTROY_GOLD_IF_ABOVE ) /call DestroyGold

   /if ( DESTROY_SILVER_IF_ABOVE>0 && ${Me.Silver}>DESTROY_SILVER_IF_ABOVE )  /call DestroySilver

   /if ( DESTROY_COPPER_IF_ABOVE>0 && ${Me.Copper}>DESTROY_COPPER_IF_ABOVE )  /call DestroyCopper
   /varset looted TRUE
/return

Sub Event_root
   DEBUG_2 root me!
   /call DoTheroot
/return

Sub Event_ImHit
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
   /call BackOffFromTarget 80
/return

Sub Event_Retry
   /delay 2
   /varset result CAST_RETRY
/return

Sub Event_Abort
   /varset result CAST_ABORT
/return

Sub Event_OutOfRange
   /varset result CAST_OUTOFRANGE
/return

Sub Event_NoLOS
   /varset result CAST_CANNOTSEE
/return

Sub Event_Standing
   /stand
   /varset result CAST_RETRY
/return

Sub Event_OOR
   /warp target
   /delay 2
   /loot
   /delay 3
   /delay 3s ${Corpse.Open}
   /doevents OOR
/return

Sub Event_Blocked
   /varset wayBlocked TRUE
/return

Sub Event_Zoned
   /varset weZoned TRUE
/return

Sub Event_PetAggro
   /target id ${Me.Pet.ID}
   /warp target
   /delay 1
   /assist
   /delay 1
/return

Sub Event_NoMount
   /varset mountFlag FALSE
/return

Sub Event_Stunned
:gdStunned
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /delay 1
   /if (${Me.Stunned}) /goto :gdStunned
   /varset result CAST_RETRY
/return
 
oh darn forgot....

For those looking for FH.

Go to guild lobby (or other wayfarer magus) and

/say nedaria's landing
/target elderos Danmor
/warp target
/say interested in visiting
/target nideno eliagy
/warp target
/say Forgotten Halls

Then click the rock behind her
 
hmm no coders willing to take a peek?

...well i saw a post in questions.. may take another stab at it tomorrow
 
I will look at it over the weekend and see what I can do with it. Will just edit this post with what i find.
 
kool thanks.. i posted it in questions forum .. just incase none of the coders noticed this
 
Had a quick look and test run of this yesterday.
Macro didn't work.

Decided to have a quick look at the code and found that the macro makes a call to load a

gemset called fhalls.

A gemset is the spell line you save by right clicking on the book button in eq.

So i went ahead and created a gemset called fhalls. Being anal retentive the way I am i memmed the spells into the gem spots as defined by the Macro.

And off I go into a room/cave full a flappin wings big huge bats and all of them 60+

Needless to say when I warped then FD my pet was somewhere gettin his head kicked in.

Looked at my output and found that upon warping to the mob after summoning pet the macro was trying to cast a spell i didn't have memmed.

No biggy! Dive back into the script for a harder look at the gemslot definitions. Have worked it out but not tested yet.

I spent the better part of 2 hours just editing the script so it was readable. To many cut and paste jobs with definitions and declarations all over the place.

To some ppl

looking at a well written
script they wonder why
the code seems to be
all over the place

Just like this is

Thats because scripting/coding is a language and has structure with definitions declarations and all the little nests in the right place finding a problem is a breeze. Because you can follow the flow of the program/script.

When things are in block form you have to first go in and organize the structure so you can follow the flow.

And if you know better but are just to lazy then shame on you.

Having said that I do see the original scripting and it was a mighty nice Job. The person who wrote it Loves his language. This fella went to school and didn't fall asleep during lectures on Flowcharting.

You do know where the word hacking comes from?
Someone takes a program and re-writes some of the code. But they care not for how the program looks when they are done. So a real programmer looks at the code later and says what a HACK job on this.

Presto the person was a hack then became a hacker and the act of doing it became Hacking.

Back to this script
Will try and add a check routine pre-warp for proximity of other hostile mobs.

Will get rid of user having to edit in spells etc. May do this through an ini or better yet through the use of 2 saved gemsets in eq. One for buff/med one for combat.

Was asked about timing the dots and only thing i can think of is a custom UI and getting the dot time from that.

MQ2 is new to me and I know my limits until i fully grasp the differences. It would be at this point like taking a Leer JET to a VW mechanic to get it fixed. The VW mechanic will fix it but would you really want to fly in it?
 
This macro is worthless. Don't bother. I spent all day and night getting it to work, and while at the begining I was impressed. (actually killed A mob)

Once Fear resisted, and the macro tried to cast Lich again instead of another Fear, and over and over again...I've since had it running nearly an hour, and have only killed that one mob.

I've spent most of the time saying "I am ready to leave!" and leaving the zone to med.

Seriously folks. This ISN'T your solution.

Tone, thanks for the valiant effort.

Anyone with a script that actually DOES a good job at AFK grinding in FH?
 
when I still had a necro on FV, a week or two ago, this was doign the same thing as you described. but I actually took the time to look at it, figure out the order of commands and add timers. set hp / mana % to leave the zone when being hit. set the spells and so on. you really have to keep in mind that the person that posted it tailored it to thier character.

mine was working perfect untill I got the necro too high and the mobs were too high to fear anymore.

you just need to actually take the time to learn.
 
Uhmmm don't know where my post went....

But.

This macro doesn't work.

Maybe they nerfed it, meaning Unholy Howl (lvl 67 fear) gets resisted almost everytime, or drops quickly.

If someone has one that actually works....please post.

I spent far too much time getting this all to work. I even tried turning on Pet taunt, lowered the lvl of mobs to only include 63 and 64 mobs, but the same was true EVERYTIME. For over an hour. The first time I ran the macro, I kill ONE bat.

After that, spent the next hour zoning in and out.

Believe when I say I played with the macro....I adjust all the spells to my lvl etc. This may be viable at lower lvls, but these things hit for 400-600. Snare, should not be the first spell cast, and there should be a check to see if fear drops to spam it.

Not cast SoS instead of fearing while I'm getting raped by a bat. :rolleyes:
 
Dirtynumbangel,

Could you share some general tips and coding examples to help those of us who want to use this out?

I feel that I've done alot more than most people when I tell you I've fiddled. I mean, I could do some more tweaking, but I honestly can't see this being overly effective. Not the way everyone made it sound. Like, OMG infinite AA's etc.

Again, I'm not sure if SOE nerfed the zone by making them resist more etc, but...

As for the timers, how did you implement them? And to what degree that gave you a working macro?

Thanks!
 
Wow.

Sure, np I didn't think the point of this PAID forum was to get working material. And if not working, help to make it function.

/slaps self in the head


My bad.


Guess you didn't see the part in my post that I've gone through the script alot.

Nah. But it's cool though.

Anyone care to help out?
 
look I am a subscriber here also. and I had to read and learn, the point of having to pay is so that soe doesn't get info on our cracks, they frequent free sites. but not paid ones. thus the reason for the cost.

and if you're going to act like a dick no one is going to help you.
your very first post here you were being an ass hat, and a couple down more there you are being an asshat. yet I still tried to politely tell you to read the fucking manual.

I had to learn this shit too, and I personally get tired of script kiddies who just want everyone to drop what they are doing and custom make a plugin or macro to fit their needs.

all information on this site is from people who take time out of thier own lives to post it here.
The less you CAPITALIZE words to emphisize the fact that you're being a dick, the more people will be willing to help you.

I said I wasn't trying to be rude. and you can go through a script all day long, but if you don't know what the fuck you are doing nothing anyone can tell you will help you.
you are just walking in here bitching about a script not working, and demanding that I or anyone else here take our time. OUR time (see I can capitalize words and be a condicending asshole too.)
and fix the script for you. or post our working script for you. the person not willing to learn, and if you had RTFM, you would know how to fix this.

I wasn't kidding when I said you need to study up a bit then you can understand the help you are being given.
the things you want the macro to do are different than what I want it to do.

anyhow, I have no time or answers for someone who wants to demand things of anyone here, or all out be an asshole fromt heir initial post.
it's all volunteer work.

/rant off.
 
/agree dirtynumbangel

I came to this forum, and don't think i asked too much because i knew that i'd have to learn stuff, seeing as i was in a swg fourm(paid by the way) in which we had to learn how to do the stuff ourselves. lol, i didn't think my modification to the dain exp/faction macro would get honorable mention, but before that macro i didn't think i could script or, for that matter, modify someone elses macros. Letmein if you don't want to pay for what most of the members of this forum are benefiting from:
1.)leave the forum and never come back...
2.)create a macro/plugin/strategy that might get you free acces...

Anyways, bout this macro, heavily modified i got this working for my 61 necro with the occasional error, but like the post above, resists were very high on mobs and they were hitting fast for about 250 a hit min. was only kept alive cause i had druid running healer macro in there.
PS: I haven't gotten bard macro to be very beneficial in FH on either my 25 bard or my friend's 68 bard.
 
raistlin8989 said:
/agree dirtynumbangel

I came to this forum, and don't think i asked too much because i knew that i'd have to learn stuff, seeing as i was in a swg fourm(paid by the way) in which we had to learn how to do the stuff ourselves. lol, i didn't think my modification to the dain exp/faction macro would get honorable mention, but before that macro i didn't think i could script or, for that matter, modify someone elses macros. Letmein if you don't want to pay for what most of the members of this forum are benefiting from:
1.)leave the forum and never come back...
2.)create a macro/plugin/strategy that might get you free acces...

Anyways, bout this macro, heavily modified i got this working for my 61 necro with the occasional error, but like the post above, resists were very high on mobs and they were hitting fast for about 250 a hit min. was only kept alive cause i had druid running healer macro in there.
PS: I haven't gotten bard macro to be very beneficial in FH on either my 25 bard or my friend's 68 bard.

raistlin what problems you having with your Bard mac man? :D

i dont do FH but let me know your issues and ill test it out today
 
Macro Tutorial

good read

MORE macro coding stuff

in this one i have linked some good pages to try and get a better understanding of macros.. as i amlearing myself



PG3 of this thread

i ran into a problem with my 66 necro not being able to fear the mobs... (spell not high enough)

so i took a stab at editing the macro for ROT (Root/ DoT ) Killing

it needs a little fixing ... so that the dots are conditional ..

but




Like was stated above.. some macros are posted as is .. set to a certain persons character... other macros are set with instructions on how to set for you

do what you can with what you can

8-)
 
No Flaming please :) I agree that dirtynumbangel could have been a little nicer about it, but please don't answer a flame with another flame
 
Ok I like this macro but it still has some bugs.
I wonder if anyone else is finding that when you aquire a target, sometimes you just jump forward a few paces in the line of sight but get caught on a wall.
I find when the mob dies in a coridoor I get stuck in a wall trying to aquire a new one in the rat room or bat room.
If someone could help me sort that it would work fine,
I added tones potion belt thing so when my hp's get to 50 it casts healing.
Works great other than that
 
I have tweeked skorli's post of the necro macro a bit messing with the distances and it seems to work better, but i am still having issues when the target isnt in line of site. I can guess it is unable to find a waypoint close enough but im not sure. I was wondering if anyone could take a look at it. THe target issue doesnt happen all the time but it makes it so yoiu cant go afk. Usualy happens on the rats in the rat room or bats in the bat room.here is the code i use:

Rich (BB code):
| Useage      : /macro necrofear
| Description : This macro will fear kite mobs of
|               The Forgotten Halls. It assumes you have an instance
|               And are inside already.
|------------------------------------------------------------------------------
#turbo 40

|edits are at 145 to change warp (push Control G in notepad and 144)
|line 19 and 20 to edit monsters level.
|spells to edit 79 to 116

| Define the ranges of mobs you can handle kiting here.
| If no mobs in this range exist in the instance, the macro
| will freeze.
#define MIN_MOB_LVL 33
#define MAX_MOB_LVL 37
|this is the place you need to edit the monsters level you are hunting.
#define CAST_SUCCESS 0
#define CAST_OUTOFRANGE 1
#define CAST_CANNOTSEE 2
#define CAST_RETRY 3
#define CAST_IN_PROGRESS 4
#define CAST_ABORT -1

#define PLUGIN_NEEDED "/call CheckPlug"
#define DELAY "/noparse /call Delay"

#event Blocked "The way is blocked to you.#*#"
#event NoMount "#*#You can not summon a mount#*#"
#event OOR "#*#too far away to loot#*#"
#event Retry "#*#Your spell fizzles#*#"
#event Retry "#*#Your casting has been interrupted#*#"
#event Retry "#*#Your spell is interrupted.#*#"
#event Retry "#*#You haven't recovered yet...#*#"
#event Retry "#*#Spell recovery time not yet met.#*#"
#event Retry "#*#Your target resisted the #*#"
#event Abort "#*#Insufficient Mana to cast this spell!#*#"
#event OutOfRange "#*#Your target is out of range, get closer!#*#"
#event NoLOS "#*#You cannot see your target.#*#"
#event Stunned "#*#You cannot cast while stunned#*#"
#event Stunned "#*#You *CANNOT* cast spells, you have been silenced!#*#"
#event Standing "#*#You must be standing to cast a spell#*#"
#event Standing "#*#has fallen to the ground.#*#"
#event Collapse "#*#Your gate is too unstable, and collapses.#*#"
#event Abort "#*#Your target is immune to changes in its attack speed.#*#"
#event Retry "#*#too distracted to cast#*#"
#event Zoned "You have entered#*#"
#event PetAggro "#*#pet is the focus of something#*#"
#event MustStand "#*#You must be standing to cast a spell.#*#"
#event Drown "#*#You are drowning!#*#"

|Events for counting the money we loot.
#event CashLoot "You receive #1#"

|Event for re-fearing
#event fear "#*#fear spell has worn off#*#"

#event ImHit "|${Target.CleanName}|#*#YOU for#*#"

|-- The normal debug - for normal play.
| Enable: "/echo", Disable: "/squelch /echo"
#define DEBUG_1 /echo
|-- Deeper debugging - enable when trying to find bugs.
#define DEBUG_2 "/squelch /echo"
|-- The Deepest debugging - will spam a lot.
#define DEBUG_3 "/squelch /echo"

|-- Destroys Silver if you have more than the given amount! 0=disable
#define DESTROY_GOLD_IF_ABOVE 0
|-- Destroys Silver if you have more than the given amount! 0=disable
#define DESTROY_SILVER_IF_ABOVE 0
|-- Destroys Copper if you have more than the given amount! 0=disable
#define DESTROY_COPPER_IF_ABOVE 500

|-- At what range do we snare/send in pet?
#define INITIALIZE_ATTACK_RANGE 150
|here and down you need to edit the spell list, and the pet you want to use.
|-- What pet do we want?
#define PET_SPELL "Malignant Dead"
|-- Favorite gem spot for the pet (1-8)
#define PET_GEM 8
|-- How far off should the pet be before we summon it?
#define MAX_PET_RANGE_BEFORE_SUMMON 150
#define SUMMON_SPELL "Summon Companion"
#define SUMMON_GEM 1

#define SPLURT_SPELL "Splurt"
| Change SPLURT_GEM to 0 if you lack it.
#define SPLURT_GEM 0
|-- What snare spell
#define SNARE_SPELL "Dooming Darkness"
|-- Favorite gem spot for the snare (1-8)
#define SNARE_GEM 2

|-- Name of fear spell
#define FEAR_SPELL "Invoke Fear"
|-- Favorite gem spot for the fear (1-8)
#define FEAR_GEM 3

|-- How low on health should the pet be before we heal it (noncombat)
#define HEAL_PET_BELOW_PCT 70
|-- Name of pet healing spell
#define HEAL_PET_SPELL "Renew Bones"
|-- Favorite gem spot for the petheal (1-8)
#define HEAL_PET_GEM 4
#define PET_HASTE "Augment Death"
#define PET_HASTE_GEM 6
#define LICH_SPELL "Call of Bones"
#define LICH_GEM 8
#define LIFE_DOT "Vampiric Curse"
#define LIFE_DOT_GEM 5
#define ROD_NAME "Summoned: Modulating Rod"

|-- If your health gets below this lvl start /beep'ing and FD
#define ALARM_HEALTH_BELOW_PCT 40

|What is our feign death spell of choice? (Requires it be already mem'd, memorizing before feigning = death)
 #define FEIGN_SPELL "Feign Death"
#define FEIGN_GEM 7

|-- What is the minimum mana I should have, wait if below
#define MIN_MANA_BEFORE_MEDITATE 50

|--How many waypoints exist on the kiting path for the rats.
#define WP_SIZE 37
#define Y_COORD 1
#define X_COORD 2
#define Z_COORD 3

Sub CheckPlug(who)
   /if (${Plugin[${who}].Name.Length}==NULL) {
       /echo This requires the ${who} plugin to work.
       /echo Install and/or /plugin ${who} and try again.
       /beep
       /endmacro
   }
/return

|----------------------------------------------------------------------------
|SUB: Main - Declarations and Initialization
|----------------------------------------------------------------------------
Sub Main
   PLUGIN_NEEDED MQ2warp
   |you have to edit the name of your warp in here.
   |Buffs to be kept up on self (max 15) - "Buff" or "Buff|GemSlot"
   /declare MyBuffs[1] string outer
   /varset MyBuffs[1] "Arch Shielding|1"
     
   |Buffs to be kept up on pet (max 15) - "Buff" or "Buff|GemSlot"
   /declare PetBuffs[1] string outer
   /varset PetBuffs[1] "PET_HASTE|PET_HASTE_GEM"

   /declare weZoned bool outer FALSE
   /declare wayBlocked bool outer FALSE
   /declare mountFlag bool outer TRUE
   /declare result int outer
   /declare startingPP int outer ${Me.Platinum}
   /declare startingXP int outer ${Me.Exp}
   /declare wpY float outer
   /declare wpX float outer
   /declare wpZ float outer
   /declare waypoint[WP_SIZE,3] int outer
   /varset waypoint[1,Y_COORD] -598
   /varset waypoint[1,X_COORD] 101
   /varset waypoint[1,Z_COORD] 4
   /varset waypoint[2,Y_COORD] -596
   /varset waypoint[2,X_COORD] 108
   /varset waypoint[2,Z_COORD] 4
   /varset waypoint[3,Y_COORD] -597
   /varset waypoint[3,X_COORD] -40
   /varset waypoint[3,Z_COORD] 4
   /varset waypoint[4,Y_COORD] -556
   /varset waypoint[4,X_COORD] -50
   /varset waypoint[4,Z_COORD] 4
   /varset waypoint[5,Y_COORD] -556
   /varset waypoint[5,X_COORD] -160
   /varset waypoint[5,Z_COORD] 4
   /varset waypoint[6,Y_COORD] -473
   /varset waypoint[6,X_COORD] -41
   /varset waypoint[6,Z_COORD] 4
   /varset waypoint[7,Y_COORD] -398
   /varset waypoint[7,X_COORD] -45
   /varset waypoint[7,Z_COORD] 4
   /varset waypoint[8,Y_COORD] -402
   /varset waypoint[8,X_COORD] 1
   /varset waypoint[8,Z_COORD] 4
   /varset waypoint[9,Y_COORD] -329
   /varset waypoint[9,X_COORD] 0
   /varset waypoint[9,Z_COORD] 13
   /varset waypoint[10,Y_COORD] -596
   /varset waypoint[10,X_COORD] 157
   /varset waypoint[10,Z_COORD] 2
   /varset waypoint[11,Y_COORD] -600
   /varset waypoint[11,X_COORD] 198
   /varset waypoint[11,Z_COORD] 4
   /varset waypoint[12,Y_COORD] -721
   /varset waypoint[12,X_COORD] 45
   /varset waypoint[12,Z_COORD] -10
   /varset waypoint[13,Y_COORD] -664
   /varset waypoint[13,X_COORD] 45
   /varset waypoint[13,Z_COORD] -4
   /varset waypoint[14,Y_COORD] -635
   /varset waypoint[14,X_COORD] 45
   /varset waypoint[14,Z_COORD] 4
   /varset waypoint[15,Y_COORD] -814
   /varset waypoint[15,X_COORD] 45
   /varset waypoint[15,Z_COORD] -10
   /varset waypoint[16,Y_COORD] -814
   /varset waypoint[16,X_COORD] 190
   /varset waypoint[16,Z_COORD] -11
   /varset waypoint[17,Y_COORD] -814
   /varset waypoint[17,X_COORD] 335
   /varset waypoint[17,Z_COORD] -10
   /varset waypoint[18,Y_COORD] -814
   /varset waypoint[18,X_COORD] 488
   /varset waypoint[18,Z_COORD] -35
   /varset waypoint[19,Y_COORD] -473
   /varset waypoint[19,X_COORD] -6
   /varset waypoint[19,Z_COORD] 4
   /varset waypoint[20,Y_COORD] -473
   /varset waypoint[20,X_COORD] 20
   /varset waypoint[20,Z_COORD] -2
   /varset waypoint[21,Y_COORD] -473
   /varset waypoint[21,X_COORD] 56
   /varset waypoint[21,Z_COORD] -10
   /varset waypoint[22,Y_COORD] -473
   /varset waypoint[22,X_COORD] 135
   /varset waypoint[22,Z_COORD] -11
   /varset waypoint[23,Y_COORD] -405
   /varset waypoint[23,X_COORD] 135
   /varset waypoint[23,Z_COORD] -11
   /varset waypoint[24,Y_COORD] -405
   /varset waypoint[24,X_COORD] 93
   /varset waypoint[24,Z_COORD] -11
   /varset waypoint[25,Y_COORD] -290
   /varset waypoint[25,X_COORD] 93
   /varset waypoint[25,Z_COORD] -11
   /varset waypoint[26,Y_COORD] -290
   /varset waypoint[26,X_COORD] 183
   /varset waypoint[26,Z_COORD] -11
   /varset waypoint[27,Y_COORD] -290
   /varset waypoint[27,X_COORD] 275
   /varset waypoint[27,Z_COORD] -11
   /varset waypoint[28,Y_COORD] -409
   /varset waypoint[28,X_COORD] 275
   /varset waypoint[28,Z_COORD] -11
   /varset waypoint[29,Y_COORD] -397
   /varset waypoint[29,X_COORD] -40
   /varset waypoint[29,Z_COORD] 4
   /varset waypoint[30,Y_COORD] -397
   /varset waypoint[30,X_COORD] 0
   /varset waypoint[30,Z_COORD] 4
   /varset waypoint[31,Y_COORD] -337
   /varset waypoint[31,X_COORD] 1
   /varset waypoint[31,Z_COORD] 12
   /varset waypoint[32,Y_COORD] -235
   /varset waypoint[32,X_COORD] 0
   /varset waypoint[32,Z_COORD] 20
   /varset waypoint[33,Y_COORD] -167
   /varset waypoint[33,X_COORD] 0
   /varset waypoint[33,Z_COORD] 20
   /varset waypoint[34,Y_COORD] -127
   /varset waypoint[34,X_COORD] 0
   /varset waypoint[34,Z_COORD] 14
   /varset waypoint[35,Y_COORD] -86
   /varset waypoint[35,X_COORD] 0
   /varset waypoint[35,Z_COORD] 4
   /varset waypoint[36,Y_COORD] 4
   /varset waypoint[36,X_COORD] 0
   /varset waypoint[36,Z_COORD] -6
   /varset waypoint[37,Y_COORD] 53
   /varset waypoint[37,X_COORD] 0
   /varset waypoint[37,Z_COORD] 4

   DEBUG_1 Starting macro
   |Group of locked target data
   /declare TargetName string outer
   /declare TargetID int outer
   /declare fightTimer timer outer

   /call MainSub
   DEBUG_1 Exited normally!
/return


|----------------------------------------------------------------------------
|SUB: MainSub - The main sub
|----------------------------------------------------------------------------
Sub MainSub
   |The main loop. After an attack we go here to acquire a new target
   /cleanup
:NewTarget
   /varset TargetID
   /if (${Corpse.Open}) {
       /notify LootWnd DoneButton leftmouseup
       /cleanup
   }
   /call AlwaysCheck
   /if (${Macro.Return}) /return
   /call DowntimeWork
   /if (${Macro.Return}==0) /goto :NewTarget

   /call AcquireTarget
   /if (${Macro.Return}) /goto :NewTarget
   /call BackOffFromTarget 20
   |/mqpause
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /goto :NewTarget
   /if (${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON) /call SummonPet TRUE
   /call MyCast "SNARE_SPELL" SNARE_GEM
   /pet attack
   /call DoTheFear
   /if (${Int[SPLURT_GEM]}>0) /call MyCast "SPLURT_SPELL" SPLURT_GEM
   /call MyCast "LIFE_DOT" LIFE_DOT_GEM
   /call MainAttack
   /if (${Me.Pet.ID}) {
       /if (${Me.Pet.Distance}>20) /warp loc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
   } else {
       /warp succor
   }
   /goto :NewTarget
/return

| AlwaysCheck - health, aggro, zone, etc. ALSO CALLED FROM EVENTS.
| "/call AlwaysCheck nocast" to never perform casting (eg event calls)
| 0=no problem; 1=panic
Sub AlwaysCheck(string casting)
   /doevents Zoned
   /if (${Cursor.ID}) /autoinventory
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       /call NoLich
       /if (${Me.PctHPs}<=20) {
           /instacamp
           /endmacro
       }
       /if (${Spawn[${TargetID}].Type.Equal[NPC]} && ${Zone.Name.Find[forgotten]}!=0) {
           /call BailOut
           /return 1
       }
   }
   /if (${Me.PctMana}>90 || ${Me.PctHPs}<50) {
       /call NoLich
   }
   /if (${casting.Equal[nocast]}==FALSE) {
       /if (${Me.Pet.ID}!=0 && ${Me.PetBuff[PET_HASTE]}==0) /call MyCast "PET_HASTE" PET_HASTE_GEM
       /if (${Me.PctMana}<90 && ${Me.Buff[LICH_SPELL].ID}==NULL && ${Me.PctHPs}>50) /call MyCast "LICH_SPELL" LICH_GEM
       /if (${FindItem[ROD_NAME].ID}!=0) /cast item "ROD_NAME"
   }
   /if (${weZoned}) {
       /declare zoneDelay timer 3m
       /varset weZoned FALSE
       /varset wayBlocked FALSE
       /doevents flush
       /if (${Zone.Name.Find[forgotten]}==NULL) {
           /if (${Zone.Name.Find[nedaria]}==NULL) {
:quit
               /dismount
               /camp desktop
               /endmacro
           }
           /warp loc 1543 -670 96
           /keypress back
           /keypress forward
           /delay 1
           /sit
           /popup Waiting for health>60%...
           /delay 5m ${Me.PctHPs}>60
           /face fast loc 1543,-670
:zoning
           /delay 1s
           /click left 400 300
           /delay 5
           /click left 500 400
           /delay 5
           /click left 600 500
           /doevents Zoned
           /doevents Blocked
           /delay 1s ${weZoned}||${wayBlocked}
           /if (${wayBlocked}) /goto :quit
           /if (${weZoned}==FALSE && ${zoneDelay.Value}>0) /goto :zoning
           /docommands /mac necrofh
           /if (${Zone.Name.Find[forgotten]}==NULL) /goto :quit
       }
   }
/return 0

Sub NoLich
   /declare slot int local
   /varcalc slot ${Me.Buff[LICH_SPELL].ID}-1
   /if (${slot}>=0) /notify BuffWindow Buff${slot} leftmouseup
/return

Sub BailOut
   /dismount
   /attack off
    /warp succor
   /delay 1
   /target npc a_harindi_guide
   |/warp loc -827 -30 -11
   /warp target 
   /delay 2
   /face fast nolook
:panic
   /say I am ready to leave!
   /delay 1
   /doevents Zoned
   /delay 5 ${weZoned}
   /if (${Zone.Name.Find[forgotten]}) {
       /keypress forward hold
       /delay 4
       /keypress forward
       /if (${Target.ID}) {
           /face fast nolook
       } else {
           /return
       }
       /goto :panic
   }
/return

|----------------------------------------------------------------------------
|SUB: MainAttack - Handles the kiting/killing
|----------------------------------------------------------------------------
Sub MainAttack
:attackAgain
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /doevents
   /target id ${TargetID}
   DELAY 1
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /call AlwaysCheck
   /if (${Macro.Return}) /return
   /if (${Target.ID}==${Me.Pet.ID}) {
       /assist
       DELAY 3 ${Target.ID}!=${Me.Pet.ID}
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${Me.PctHPs}>ALARM_HEALTH_BELOW_PCT && ${Me.Buff[LICH_SPELL].ID}==NULL) {
       DEBUG_3 Me.Buff[LICH_SPELL].ID==${Me.Buff[LICH_SPELL].ID}
       /call MyCast "LICH_SPELL" LICH_GEM
   }
   /call HealPet
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /face
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /call WarpCloser
   /if (${Me.Sitting}==FALSE && ${Me.Mount.ID}==0) /call Mount
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${fightTimer.Value}==0 && ${Target.PctHPs}>20) {
       /call DoTheFear
       /call MyCast "LIFE_DOT" LIFE_DOT_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${Target.PctHPs}>20 && ${Target.Speed}>50) {
       /warp target
       DELAY 1
       /call MyCast "SNARE_SPELL" SNARE_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}>0 && ${Target.Type.NotEqual[Corpse]}) /goto :attackAgain
:looties
   /call AlwaysCheck
   /if (${Zone.Name.Find[forgotten]}==NULL || ${Macro.Return}) /return
   /call DoTheLooting
   /varset TargetID
/return

|----------------------------------------------------------------------------
|SUB: DowntimeWork - Between fight rebuffs, etc.
|----------------------------------------------------------------------------
Sub DowntimeWork
| Check if we are low on mana or health. Heal or sit down if low
   /call CheckMana
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 1. Mana Checked

| Make sure pet is up + all its buffs are on it
   /call HealPet
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 2. Pet Health Checked

   /call MaintainPetBuffs
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 3. Pet Buffs Checked

| Make sure all buffs on self are up
   /call MaintainSelfBuffs
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 4. Buffs Checked

   /call AlwaysCheck
   /if (${Macro.Return}) /return 0

   |/memspellset fhalls
   /delay 1m ${Window[SpellBookWnd]}==FALSE
/return 1

Sub instaClicky
   /if (${FindItem[=Journeyman's Boots].ID}) /cast item "Journeyman's Boots"
   /if (${FindItem[=Shrunken Goblin Skull Earring].ID}) /cast item "Shrunken Goblin Skull Earring"
/return

|----------------------------------------------------------------------------
|SUB: AcquireTarget - Finding a target 0=success; 1=n/a
|----------------------------------------------------------------------------
Sub AcquireTarget
   /declare s int local
   /declare lvl int local
   /declare spn int local
   /squelch /target clear
   /varset TargetID
   /varset TargetName
:scan
   /varcalc s ${s}+1
   /varset spn ${LastSpawn[${s}].ID}
   /if (${spn}==0) /goto :acquired
   /if ((${Spawn[${spn}].CleanName.Find[squeaking]} || ${Spawn[${spn}].CleanName.Find[swooping]} || ${Spawn[${spn}].CleanName.Find[reject]}) && ${Spawn[${spn}].Type.Equal[Corpse]}==FALSE && ${Spawn[${spn}].Level}>=MIN_MOB_LVL && ${Spawn[${spn}].Level}<=MAX_MOB_LVL && ${Spawn[${spn}].Level}>${lvl}) {
       /if (${Spawn[${spn}].Y}<=-265 && ${Spawn[${spn}].Y}>=-429 && ${Spawn[${spn}].X}>=74 && ${Spawn[${spn}].X}<=298 && ${Spawn[${spn}].Level}>=55) {
           DEBUG_1 Ignoring mob in add area: ${Spawn[${spn}].CleanName}(L${Spawn[${spn}].Level})
       } else {
           /varset lvl ${Spawn[${spn}].Level}
           /varset TargetID ${Spawn[${spn}].ID}
       }
   }
   /goto :scan
:acquired
   /if (${TargetID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}!=0
       /if (${Target.CleanName.Find[${Me.CleanName}]}) {
           DEBUG_1 WTF? I got targeted!
           /return 1
       }
       /varset TargetID ${Target.ID}
       /varset TargetName ${Target.CleanName}
       /popup ${TargetName} (L${Target.Level})
       DEBUG_1 ${TargetName} (L${Target.Level})
       /return 0
   }
   DEBUG_3 AcquireTarget FAILED!
   /popup Waiting for mobs in range MIN_MOB_LVL-MAX_MOB_LVL...
   /call Mount
   /delay 5s
/return 1

| Find the closest WP in line-of-sight to our target
Sub FindWP
   /declare wp int local
   /declare Y int local
   /declare X int local
   /declare Z int local
   /declare dist float local 10000
   /varset wpY
   /varset wpX
   /varset wpZ
   /for wp 1 to WP_SIZE
       /varset Y ${waypoint[${wp},Y_COORD]}
       /varset X ${waypoint[${wp},X_COORD]}
       /varset Z ${waypoint[${wp},Z_COORD]}
       /if (${LineOfSight[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}      ]} && ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}      ]}<${dist}) {
           /varset wpY ${Y}
           /varset wpX ${X}
           /varset wpZ ${Z}
           /varset dist ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}      ]}
       }
   /next wp
/return

|warp closer to target, via WP if mob, or direct otherwise.
Sub WarpCloser
   /call AlwaysCheck nocast
   /if (${Macro.Return}) /return
   /if (${Target.ID}==0 || ${Target.ID}==${Me.ID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}>0
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /return
   /if (${Target.Type.Equal[Pet]}) {
       /warp target
   } else {
       /call FindWP
       /if (${wpY}!=0||${wpX}!=0||${wpZ}!=0) {
           /warp loc ${wpY} ${wpX} ${wpZ}
       } else {
           /if (${Me.Pet.ID}) /warp loc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
       }
   }
   DELAY 1
   /if (${Target.ID}) /face fast
/return

| DO NOT CALL DELAY FROM EVENTS!
| Parameters: delay timer setting + early exit condition
Sub Delay(string delayTime, string exitCond)
   /declare tmr timer local ${delayTime}
:moreDelay
   /call AlwaysCheck nocast
   /if (${tmr.Value}==0) /return
   /if (${exitCond}) {
       DEBUG_3 Early exit on condition: ${exitCond.Right[-1]}
       /return
   }
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Delay abort, ${tmr.Value} ticks left, LOW HEALTH!
       /return
   }
   /delay 1 ${exitCond}
   |/if (${Math.Calc[${tmr.Value}%10].Int}==0) DEBUG_3 /delay ${tmr.Value} ${exitCond.Right[-1]}:${exitCond}
   /doevents ImHit
   /doevents Retry
   /doevents Abort
   /doevents OutOfRange
   /doevents NoLOS
   /doevents Standing
   /doevents OOR
   /doevents CashLoot
   /doevents Zoned
   /doevents PetAggro
   /doevents NoMount
   /doevents Stunned
   /doevents MustStand
   /if (${Target.Type.Equal[NPC]}) /face
   /goto :moreDelay
/return

Sub MyCast(string spname, string gname)
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Corpse.Open}) /notify LootWnd DoneButton leftmouseup
   /if (!${Defined[spellName]}) /declare spellName string outer
   /varset spellName ${spname}
   /call DoCast ${gname}
   /doevents
   /if (${Target.ID}!=${TargetID} && ${TargetID}!=0) {
       /target id ${TargetID}
       DELAY 3 ${Target.ID}==${TargetID}
   }
   /if (${Target.Type.Equal[NPC]}) /face fast
/return

| Cast something with status return and event processing
| assumes outer variable spellName and TargetID
Sub DoCast(string gem)
   /declare tartype string local ${Spell[${spellName}].TargetType}
   /if (${gem.Equal[item]}) /varset tartype ${FindItem[=${spellName}].Spell.TargetType}
:recast
   /if (${tartype.Equal[Pet]} && ${Target.ID}!=${Me.Pet.ID}) {
       /if (${Me.Pet.ID}==0) /return
       /target id ${Me.Pet.ID}
       /delay 1
   } else /if (${tartype.Equal[Self]} && ${Target.ID}!=${Me.ID}) {
       /target myself
       /delay 1
   } else /if (${Target.Type.Equal[NPC]} && ${Target.ID}!=${TargetID}) {
       /target id ${TargetID}
       /delay 1
   }
   /if (${Target.Type.Equal[NPC]} && ${Target.PctHPs}<25) {
       DEBUG_3 Confusing/low health target (${Target.PctHPs}%)
       /return
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) {
       DEBUG_3 Target${Target.CleanName}(${Target.ID}) Dead?
       /return
   }
   /if (${Target.ID}!=${Me.ID}) {
       /face fast
       /if (!${LineOfSight[${Me.Y},${Me.X},${Me.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /call WarpCloser
   }
   /if (${gem.Equal[item]}) {
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast item "${spellName}"
   } else {
       /if (${Me.Gem[${spellName}]}==NULL) {
           /memspell ${gem} "${spellName}"
           DEBUG_3 book:${Window[SpellBookWnd]}; ${spellName}:${Me.SpellReady[${spellName}]}
           /delay 10s ${Window[SpellBookWnd]}==FALSE
           DELAY 15s ${Me.SpellReady[${spellName}]}
       } else {
           DEBUG_3 ${spellName}:${Me.SpellReady[${spellName}]}
           /if (!${Me.SpellReady[${spellName}]}) {
               DELAY 15s ${Me.SpellReady[${spellName}]}
           }
       }
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast "${spellName}"
   }
   /varset result CAST_IN_PROGRESS
   DELAY 2
   /doevents
   /if (${result}==CAST_IN_PROGRESS && ${Me.Casting.ID}==0) /goto :recast
   DELAY 30s ${Me.Casting.ID}==NULL
   /delay 1
   /doevents
   /if (${result}==CAST_IN_PROGRESS) /varset result CAST_SUCCESS
   DEBUG_3 Casting of ${spellName} complete, result=${result}
   /if (${result}==CAST_OUTOFRANGE || ${result}==CAST_CANNOTSEE) {
       /call WarpCloser
       /goto :recast
   } else /if (${result}==CAST_RETRY) {
       /if (!${Me.SpellReady[${spellName}]}) {
           /call instaClicky
           /varcalc result ${Spell[${spellName}].RecoveryTime}*10
           DELAY ${result} ${Me.SpellReady[${spellName}]}
       }
       /goto :recast
   }
/return

|----------------------------------------------------------------------------
|SUB: SummonPet - Summon pet if farther away than the defined range
|----------------------------------------------------------------------------
Sub SummonPet(bool force)
   /if (${force} || (MAX_PET_RANGE_BEFORE_SUMMON>0 && ${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON)) {
       DELAY 5s (${Me.Pet.Distance}<MAX_PET_RANGE_BEFORE_SUMMON||${force})
       /if (${Int[SUMMON_GEM]}<1 || ${Me.Pet.Distance}<MAX_PET_RANGE_BEFORE_SUMMON) /return
       DEBUG_1 Summoning pet. Its range is ${Me.Pet.Distance}
       /call MyCast "SUMMON_SPELL" SUMMON_GEM
   }
/return


|----------------------------------------------------------------------------
|SUB: HealPet - Heal pet if needed 0=just healed; 1=no problem
|----------------------------------------------------------------------------
Sub HealPet
   |Heal pet?
   /if ( ${Me.Pet.PctHPs}<HEAL_PET_BELOW_PCT && ${Me.PetBuff[HEAL_PET_SPELL]}==0 ) {
       /if ( ${Me.Pet.ID} ) {
           /target id ${Me.Pet.ID}
           DELAY 1
           /call MyCast "HEAL_PET_SPELL" HEAL_PET_GEM
           /return 0
       }
   }
/return 1

Sub Mount
   /if (${mountFlag}) {
       /if (${InvSlot[ammo].Item.Name.Find[Drum]}!=NULL && ${Me.Buff[Summon Drogmor].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else /if (${InvSlot[ammo].Item.Name.Find[Bridle]}!=NULL && ${Me.Buff[Summon Horse].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else {
           /if (!${Me.Sitting}) /sit
       }
   } else {
       /if (!${Me.Sitting}) /sit
   }
/return

|----------------------------------------------------------------------------
|SUB: CheckMana 0= need more med; 1=mana ok
| Now with histeresis - exit condition is above entry condition.
|----------------------------------------------------------------------------
Sub CheckMana
   /declare exitMana int local
   /declare exitHealth int local
   /varcalc exitMana MIN_MANA_BEFORE_MEDITATE+15
   /varcalc exitHealth ALARM_HEALTH_BELOW_PCT+20
   |Meditate?
   /if (${Me.PctMana}<MIN_MANA_BEFORE_MEDITATE || ${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Meditating.
       /popup Meditating...
       /call Mount
       /declare i int local
       /if ( ${Target.ID} ) /squelch /target clear
       /for i 1 to 10
           DELAY 1s
           /if ( ${Target.ID} ) /return 1
       /next i
       /if ( ${Me.PctMana}<${exitMana} || ${Me.PctHPs}<${exitHealth} ) {
           /return 0
       }
       DEBUG_2 Mana/health OK now.
   }
/return 1


|----------------------------------------------------------------------------
|SUB: MaintainPetBuffs - Heal pet and keep its buffs up
|   0= still busy; 1=all done
|----------------------------------------------------------------------------
Sub MaintainPetBuffs
   |If we have pet
   /if ( ${Me.Pet.ID}==0 ) {
       DEBUG_1 Creating new pet
       /call MyCast "PET_SPELL" PET_GEM
       /return 0
   }
   /call SummonPet
   /declare iCount int local
   /declare t string local
   /for iCount 1 to ${PetBuffs.Size}
       /call SplitString tmp_tmp ${PetBuffs[${iCount}]} "|"
       /varset t ${Me.PetBuff[${tmp_tmp[1]}]}
       /if ( ${t.Equal[NULL]} ) {
            /if ( !${Target.ID}!=${Me.Pet.ID} ) {
               /target id ${Me.Pet.ID}
            }
            |Cast with gemselection or default
            /if ( ${tmp_tmp.Size}>1 ) {
                /if (!${Me.SpellReady[${tmp_tmp[2]}]}) {
                   DELAY 15s ${Me.SpellReady[${tmp_tmp[2]}]}
               }
                DEBUG_3 Trying to cast "${tmp_tmp[1]}" ${tmp_tmp[2]}
                /call MyCast "${tmp_tmp[1]}" ${tmp_tmp[2]}
            } else {
                /if (!${Me.SpellReady[${tmp_tmp[1]}]}) {
                   DELAY 15s ${Me.SpellReady[${tmp_tmp[1]}]} 8 force
               }
                DEBUG_3 Trying to cast "${tmp_tmp[1]}"
                /call MyCast "${tmp_tmp[1]}" 8
            }
            |Return to top - so we dont keep buffing if being attacked
            /return 0
         }
   /next iCount
/return 1


|----------------------------------------------------------------------------
|SUB: MaintainSelfBuffs - Keep buffs up
|       0=still buffing; 1=all done
|----------------------------------------------------------------------------
Sub MaintainSelfBuffs
   /declare iCount int local
   /declare t string local
   /for iCount 1 to ${MyBuffs.Size}
       /call SplitString tmp_tmp ${MyBuffs[${iCount}]} "|"
       /varset t ${Me.Buff[${tmp_tmp[1]}]}
       /if ( ${t.Equal[NULL]} ) {
           /if ( !${Target.ID}!=${Me.ID} ) {
               /target myself
           }
           |Cast with gemselection or default
           /if ( ${tmp_tmp.Size}>1 ) {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}" ${tmp_tmp[2]}
               /call MyCast "${tmp_tmp[1]}" ${tmp_tmp[2]}
           } else {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}"
               /call MyCast "${tmp_tmp[1]}" 8
           }
           |Return to top - so we dont keep buffing if being attacked
           /return 0
       }
   /next iCount
/return 1

| Back off from current target so many units.
| Finds first line of sight on a horizontal, vertical, or
| diagonals that are at least as distant as desired.
Sub BackOffFromTarget(float dist)
   /declare by float local ${Target.Y}
   /declare bx float local ${Target.X}
   /varcalc by ${by}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /goto :backoff
   /varset by ${Target.Y}
   /varcalc bx ${bx}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /goto :backoff
   /varcalc by ${by}+${dist}
   /varset bx ${Target.X}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /goto :backoff
   /varset by ${Target.Y}
   /varcalc bx ${bx}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /goto :backoff
   /varcalc by ${by}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${      Target.Z}]}) /goto :backoff
   /face fast
   /keypress forward hold
   /delay 3s ${Target.Distance}>=${dist}
   /keypress forward
   /face fast
   /return
:backoff
   /warp loc ${by} ${bx} ${Target.Z}
   /delay 1
   /if (${Target.ID}) /face fast
/return


|----------------------------------------------------------------------------
|SUB: DoTheLooting
|----------------------------------------------------------------------------
Sub DoTheLooting
   /if (!${Defined[looted]}) /declare looted bool outer
   /target id ${TargetID}
   DELAY 1
   DEBUG_1 Going to loot
   DEBUG_3 DoTheLooting Target: ${Target.CleanName}, ID:${Target.ID}
   /warp target
   DELAY 1
   /loot
   /varset looted FALSE
   DELAY 6s (${Corpse.Open}&&${looted})
   /call LootMob
   /notify LootWnd DoneButton leftmouseup
   DELAY 1
   /doevents
   /declare xp int local
   /declare pp int local
   /declare level float local ${Me.Level}
   /varcalc level ${level}+${Math.Calc[${Me.Exp}/330.0].Milli}
   /varcalc xp ${Me.Exp}-${startingXP}
   /if (${xp}<0) /varcalc xp ${xp}+330
   /varcalc pp ${Me.Platinum}-${startingPP}
   /popup L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DEBUG_1 L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DELAY 5s
/return


|----------------------------------------------------------------------------
|SUB: LootMob
|----------------------------------------------------------------------------
Sub LootMob
   /declare LootSlot int local
   /if (!${Target.ID}) {
       /target npc corpse
       DELAY 1s ${Target.ID}>0
   }
   /loot
   DELAY 1s ${Corpse.Open}
   /if (${Corpse.Items}) {
       /for LootSlot 1 to ${Corpse.Items}
           /itemnotify loot${LootSlot} leftmouseup
           DELAY 1s ${Cursor.ID}>0
           /destroy
       /next LootSlot
   }
   /cleanup
/return


|----------------------------------------------------------------------------
|SUB: SplitString - A generic string splitter.
|----------------------------------------------------------------------------
Sub SplitString(string varname, string inputstring, string splitter)
   |/echo varname: "${varname}", inputstring: "${inputstring}", splitter: "${splitter}"
   /declare i int local
   /declare stringcnt int local

   |The normal splitter. Splitter string is just 1 in length.
   /if (${splitter.Length}==1) {
       /varcalc stringcnt ${inputstring.Count["${splitter}"]} + 1
       /if (!${Defined[${varname}]}) {
           /declare ${varname}[${stringcnt}] string outer
       } else {
           /deletevar ${varname}
           /declare ${varname}[${stringcnt}] string outer
       }
       /for i 1 to ${stringcnt}
           /varset ${varname}[${i}] ${inputstring.Token[${i},"${splitter}"]}
       /next i
   }
/return


|----------------------------------------------------------------------------
|SUB: DestroyCopper - Destroy all the copper
|----------------------------------------------------------------------------
Sub DestroyCopper
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money3 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DestroySilver - Destroy all the silver
|----------------------------------------------------------------------------
Sub DestroySilver
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money2 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DestroyGold - Destroy all the gold
|----------------------------------------------------------------------------
Sub DestroyGold
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money1 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return


|----------------------------------------------------------------------------
|SUB: DoTheFear - Fear target
|----------------------------------------------------------------------------
Sub DoTheFear
   /if ( ${Me.PctMana}>10 && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}>19) {
       /call MyCast "FEAR_SPELL" FEAR_GEM
       /varset fightTimer 31s
   }
/return

|----------------------------------------------------------------------------
|SUB: Event_CashLoot - Will count the loot so far running the macro
|----------------------------------------------------------------------------
Sub Event_CashLoot(string Line, string cash)
   /if ( DESTROY_GOLD_IF_ABOVE>0 && ${Me.Gold}>DESTROY_GOLD_IF_ABOVE ) /call DestroyGold

   /if ( DESTROY_SILVER_IF_ABOVE>0 && ${Me.Silver}>DESTROY_SILVER_IF_ABOVE )  /call DestroySilver

   /if ( DESTROY_COPPER_IF_ABOVE>0 && ${Me.Copper}>DESTROY_COPPER_IF_ABOVE )  /call DestroyCopper
   /varset looted TRUE
/return

Sub Event_fear
   DEBUG_2 Fear me!
   /call DoTheFear
/return

Sub Event_ImHit
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
   /call BackOffFromTarget 40
/return

Sub Event_Retry
   /delay 2
   /varset result CAST_RETRY
/return

Sub Event_Abort
   /varset result CAST_ABORT
/return

Sub Event_OutOfRange
   /varset result CAST_OUTOFRANGE
/return

Sub Event_NoLOS
   /varset result CAST_CANNOTSEE
/return

Sub Event_Standing
   /stand
   /varset result CAST_RETRY
/return

Sub Event_MustStand
/warp target
/return

Sub Event_Drown
/warp succor
/return

Sub Event_OOR
   /warp target
   /delay 2
   /loot
   /delay 3
   /delay 3s ${Corpse.Open}
   /doevents OOR
/return

Sub Event_Blocked
   /varset wayBlocked TRUE
/return

Sub Event_Zoned
   /varset weZoned TRUE
/return

Sub Event_PetAggro
   /target id ${Me.Pet.ID}
   /warp target
   /delay 1
   /assist
   /delay 1
/return

Sub Event_NoMount
   /varset mountFlag FALSE
/return

Sub Event_Stunned
:gdStunned
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /delay 1
   /if (${Me.Stunned}) /goto :gdStunned
   /varset result CAST_RETRY
/return
 
Balroak said:
Ok I like this macro but it still has some bugs.
I wonder if anyone else is finding that when you aquire a target, sometimes you just jump forward a few paces in the line of sight but get caught on a wall.
I find when the mob dies in a coridoor I get stuck in a wall trying to aquire a new one in the rat room or bat room.
If someone could help me sort that it would work fine,
I added tones potion belt thing so when my hp's get to 50 it casts healing.
Works great other than that
where is the potion belt code and where did you add it :-P that would make this alot safer. The target thing is the only issue i seem to be having though.
 
Actually I LIED...
Sorry it was from the Master of Cool Mr Cade..

--------------------------------------------------------------------------------

Code:

| This macro made for www.Redguides.com
| Don't steal it or we'll punch your fase!
#turbo
#event camp "personingroup tells the group, 'lets roll'
#event dzadd "personyouwanttoadd tells you, 'add me'
#event invite "#*#invites you to join#*#"
#Event Zoned "#*#You have entered#*#"


Sub Main


:loopstart
/doevents
/call GMcheck
/if (${Me.PctHPs}<50) /potionbelt activate 1
/if (${Target.Level}>67) /tar npc next
/if (${Target.Distance}>220) /keypress esc
/if (${Target.ID}==FALSE) /tar NPC radius 220
/delay 10
/goto :loopstart
/return

Sub GMcheck
/if (${Spawn[gm].ID}) {
/echo Gm detected
/beep
/beep
/beep
/keypress 9
/endmac
/unload
/q
}
/return

Sub event_camp
/sit
/camp desk
/return

sub event_zoned
/delay 5s
/sit
/camp desk
/endmac
/return

sub event_dzadd
/dzadd personyouwanttoadd
/return

sub event_invite
/invite
/return


_________________________________________________________________


I won't edit it here, but it's not difficult to do.
Just put in what you need .
Put it in the sub main part, least thats what I did and it works...
To be honest Im a complete newb but try it, if it don't work, add more code *grin
You'll get it.
Just watch what number you specify for it to begin on, in FH if you get too low before you hit it then you will Panic and be outside before it kicks in.


Thx again Cade
 
Here is a working dot rotation that recasts the dots when they wear off. It's built to root and dot. Its pieced together from a Pugs mac.

Maybe someone can intergrate this macro with the FH afk macro and come up with something great for high level necros wants to grind exp/aa in FH while afk.

I'm working on doing just that, but I think I need to come up with a new strategy of targeting the mobs to start the attack.

PM if anyone has questions or comes up with anything. Thanks.


Rich (BB code):
|Name:  rootdot.mac 
|         
| 
|Requires spell_routines.inc by rusty, and the following: 
|Desecrating Darkness , Glyph of Darkness, Petrifying Earth , Dark Nightmare , Pyre of Mori , Chaos Venom , Blood of Thule , Dark Possession , Unholy Howl. Feel free to change accordingly.


#include spell_routines.inc

#event wCurse "#*#Your Dark Nightmare spell has worn off #*#"
#event wFear "#*#Your Unholy Howl spell has worn off #*#"
#event wSnare "#*#Your Desecrating Darkness spell has worn off #*#"
#event wPyre "#*#Your Pyre of Mori spell has worn off #*#"
#event wVenom "#*#Your Chaos Venom spell has worn off #*#"
#event wThule "#*#Your Blood of Thule spell has worn off #*#"
#event wRoot "#*#Your Petrifying Earth spell has worn off #*#"
#event wClickie "#*#Your Pyrocruor spell has worn off #*#"

#event rCurse "Your target resisted the Dark Nightmare spell."
#event rFear "Your target resisted the Unholy Howl spell."
#event rSnare "Your target resisted the Desecrating Darkness spell."
#event rPyre "Your target resisted the Pyre of Mori spell."
#event rVenom "Your target resisted the Chaos Venom spell."
#event rThule "Your target resisted the Blood of Thule spell."
#event rRoot "Your target resisted the Petrifying Earth spell."
#event rClickie "Your target resisted the Pyrocruor spell." 

#event Done "You gain experience!!"
#event ImHit "|${Target.CleanName}|#*#YOU for#*#" 

| 
| Main Sub 
|-------------------------------- 
sub Main 
   /popup Destroying targets...
   
   /declare cRoot int outer 0 
   /declare cSnare int outer 0
   /declare cCurse int outer 0
   /declare cFear int outer 0  
   /declare cPyre int outer 0 
   /declare cVenom int outer 0 
   /declare cThule int outer 0
   /declare cClickie int outer 0 
   
 
|  Call Mount
   /call Cast "Giant Black Drum" item
   /delay 5s 
   
|  Setting spells to cast...

   /varset cRoot 1
   /varset cSnare 1
   /varset cFear 1
   /varset cCurse 1 
   /varset cPyre 1
   /varset cVenom 1 
   /varset cThule 1
   /varset cClickie 1
  

:loop 
   /doevents 
   /call dotcheck

| Casting Block 
|------- 
   /if ( ${cRoot} && ${Me.SpellReady["Petrifying Earth"]} ) { 
      /call cast "Petrifying Earth" 
      /varset cRoot 0 
      /call dotcheck

   } 
   /if ( ${cSnare} && ${Me.SpellReady["Desecrating Darkness"]} ) { 
      /call cast "Desecrating Darkness" 
      /varset cSnare 0 
      /call dotcheck

   } 
   /if ( ${cFear} && ${Me.SpellReady["Unholy Howl"]} ) { 
      /call cast "Unholy Howl" 
      /varset cFear 0 
      /call dotcheck

   } 
   /if ( ${cCurse} && ${Me.SpellReady["Dark Nightmare"]} ) { 
      /call cast "Dark Nightmare" 
      /varset cCurse 0 
      /call dotcheck

   } 
   /if ( ${cPyre} && ${Me.SpellReady["Pyre of Mori"]} ) { 
      /call cast "Pyre of Mori" 
      /varset cPyre 0 
      /call dotcheck 

   } 
   /if ( ${cVenom} && ${Me.SpellReady["Chaos Venom"]} ) { 
      /call cast "Chaos Venom" 
      /varset cVenom 0 
      /call dotcheck

   } 
   /if ( ${cThule} && ${Me.SpellReady["Blood of Thule"]} ) { 
      /call cast "Blood of Thule" 
      /varset cThule 0 
      /call dotcheck

   } 
   /if ( ${cClickie} ) { 
      /call cast "Miragul's Greaves of Risen Souls" item 
      /varset cClickie 0 
      /call dotcheck

   } 

/goto :loop 
/endmacro 

| 
| dotcheck
|----------------------------------------- 
sub dotcheck
/return 

| 
| Wear Off Events 
|-------------------------------- 
sub Event_wRoot
   /varset cRoot 1 
/return 

sub Event_wSnare 
   /varset cSnare 1 
/return 

sub Event_wFear 
   /varset cFear 1 
/return 

sub Event_wCurse 
   /varset cCurse 1 
/return 

sub Event_wPyre
   /varset cPyre 1 
/return

sub Event_wVenom
   /varset cVenom 1 
/return 

sub Event_wThule
   /varset cThule 1 
/return

sub Event_wClickie
   /varset cClickie 1 
/return    

| 
| Resist Events 
|-------------------------------- 
sub Event_rRoot
   /varset cRoot 1 
/return 

sub Event_rSnare 
   /varset cSnare 1 
/return 

sub Event_rFear 
   /varset cFear 1 
/return 

sub Event_rCurse 
   /varset cCurse 1 
/return 

sub Event_rPyre
   /varset cPyre 1 
/return

sub Event_rVenom
   /varset cVenom 1 
/return 

sub Event_rThule
   /varset cThule 1 
/return

sub Event_rClickie
   /varset cClickie 1 
/return    

|----------------------
|- Feign Death sub
|----------------------

sub Event_ImHit

  /popup Oh no!
  /call cast "Death Peace" alt
  /delay 130s
/return


| 
| Other Events 
|---------------------
|sub Event_dostuff
| 
| 
|/return 

sub Event_Done 
| All Done 
   /popup All done, the target is dead..
/endmacro

edit - fixed typo
 
Last edited:
FG

whats this part in here for

Rich (BB code):
sub Event_Done 
| All Done 
   /popup All done, the target is dead..
/endmacro

just curious 8-)

i am trying to use the new FH mac for abrds and combine with your code .. to hopefully get a working necro FH ROT mac
 
The macro I posted can be used as a stand alone macro.

When this event is seen...

#event Done "You gain experience!!"

It drops down to "sub Event_Done"

Then displays as a pretty popup "All done, the target is dead.."

Then the macro terminates.

You might want to replace the /endmacro with a /return or goto so you can intergrate this with another macro.
 
Ok You guys seem to have problems where there should be no problems.

There are 2 macros, one in a rot dot macro (which works very well, and is posted on page 1 of this thread, i will repost a newer version for level 70 in a few), and one is a fear macro ...Below i only talk about the FEAR macro .

Things to look in the macro (to make it work):

The warp :

First you need to change the /Warploc and /succor to whatever the commands are for your warp.
If you see that you are warping in walls, no worries, it means you are using a warp where X is before Y..no worry open up notepad and look for every WARP and change X to be before Y.

Present spell set (as in the macro) :
-Arch Shielding 1
-Mana buff Call of bones
-Pet heal
-Augment death (pet speed)
-Splurt gem (in this case thep poison dot)
-Life tap dot
-Fear
-Snare gem

Save this as your spellset named fhalls.

And change the spells to your spells at the top of the macro.
here :

#define PET_SPELL "Malignant Dead"

to
|-- Name of fear spell
#define FEAR_SPELL "Invoke Fear"
|-- Favorite gem spot for the fear (1-8)
#define FEAR_GEM 7


Don't forget a bit lower :
/varset MyBuffs[1] "Arch Shielding|1"
/varset MyBuffs[2] "Spirit Armor|8"



I have presently removed the Pet summoning , because the necro was a little lower than the summon pet level ...to enable it again you can :

Line 320 remove the | in front , that will summon your pet.
Line 734 remove the /* and few lines below remove the */
Line 815 remove the | in front of the line.

Now on line 153 : PLUGIN_NEEDED MQ2Whatever , you can remove this or change it to a DLL you have ..exemple MQ2WARP..

If you followed the instructions above you should have a macro which runs flawlessly in the forgotten halls..It works better if you have the summon spell , but here it's without but still works great.

Code I am using :

Rich (BB code):
| Fearnecro.mac Mandrack V.3
|
| Thanks to     : Zornecro (waypoints) ,and Wolf5 (for the hunter routines)
| (Wolf5 v1.1.9 - 2004-07-11)
| Useage      : /macro fearnecro
| Description : This macro will fear kite mobs of
|               The Forgotten Halls. It assumes you have an instance
|               And are inside already.

#turbo 40

|edits are at 145 to change warp (push Control G in notepad and 144)
|line 19 and 20 to edit monsters level.
|spells to edit 79 to 116

| Define the ranges of mobs you can handle kiting here.
| If no mobs in this range exist in the instance, the macro
| will freeze.
#define MIN_MOB_LVL 1
#define MAX_MOB_LVL 60
|this is the place you need to edit the monsters level you are hunting.
#define CAST_SUCCESS 0
#define CAST_OUTOFRANGE 1
#define CAST_CANNOTSEE 2
#define CAST_RETRY 3
#define CAST_IN_PROGRESS 4
#define CAST_ABORT -1

#define PLUGIN_NEEDED "/call CheckPlug"
#define DELAY "/noparse /call Delay"


#event GMInZone "#*#tells you,#*# GM #*#"
#event GMInZone "#*#tells you,#*# Guide #*#"
#event GMInZone "#*#tells you,#*# gamemaster #*#"
#event GMInZone "#*#tells you,#*# Game Master #*#"
#event GMInZone "#*#tells you,#*# Customer Service #*#"
#event GMInZone "#*#tells you,#*# CSR #*#"
#event Blocked "The way is blocked to you.#*#"
#event NoMount "#*#You can not summon a mount#*#"
#event OOR "#*#too far away to loot#*#"
#event Retry "#*#Your spell fizzles#*#"
#event Retry "#*#Your casting has been interrupted#*#"
#event Retry "#*#Your spell is interrupted.#*#"
#event Retry "#*#You haven't recovered yet...#*#"
#event Retry "#*#Spell recovery time not yet met.#*#"
#event Retry "#*#Your target resisted the #*#"
#event Abort "#*#Insufficient Mana to cast this spell!#*#"
#event OutOfRange "#*#Your target is out of range, get closer!#*#"
#event NoLOS "#*#You cannot see your target.#*#"
#event Stunned "#*#You cannot cast while stunned#*#"
#event Stunned "#*#You *CANNOT* cast spells, you have been silenced!#*#"
#event Standing "#*#You must be standing to cast a spell#*#"
#event Standing "#*#has fallen to the ground.#*#"
#event Collapse "#*#Your gate is too unstable, and collapses.#*#"
#event Abort "#*#Your target is immune to changes in its attack speed.#*#"
#event Retry "#*#too distracted to cast#*#"
#event Zoned "You have entered#*#"
#event PetAggro "#*#pet is the focus of something#*#"

|Events for counting the money we loot.
#event CashLoot "You receive #1#"

|Event for re-fearing
#event fear "#*#fear spell has worn off#*#"

#event ImHit "|${Target.CleanName}|#*#YOU for#*#"

|-- The normal debug - for normal play.
| Enable: "/echo", Disable: "/squelch /echo"
#define DEBUG_1 /echo
|-- Deeper debugging - enable when trying to find bugs.
#define DEBUG_2 "/squelch /echo"
|-- The Deepest debugging - will spam a lot.
#define DEBUG_3 "/squelch /echo"


|-- Destroys Silver if you have more than the given amount! 0=disable 
#define DESTROY_GOLD_IF_ABOVE 0 
|-- Destroys Silver if you have more than the given amount! 0=disable 
#define DESTROY_SILVER_IF_ABOVE 500 
|-- Destroys Copper if you have more than the given amount! 0=disable 
#define DESTROY_COPPER_IF_ABOVE 500 

|-- At what range do we snare/send in pet? 
#define INITIALIZE_ATTACK_RANGE 100 

|-- What pet do we want? 

#define PET_SPELL "Malignant Dead" 
|-- Favorite gem spot for the pet (1-8) 
#define PET_GEM 1 
|-- How far off should the pet be before we summon it? 
|#define MAX_PET_RANGE_BEFORE_SUMMON 150 
|#define SUMMON_SPELL 
|#define SUMMON_GEM 0 

#define FIRE_SPELL "Ignite bones" 
| Change SPLURT_GEM to 0 if you lack it. 
#define FIRE_GEM 4 

#define SPLURT_SPELL "Chilling Embrace" 
| Change SPLURT_GEM to 0 if you lack it. 
#define SPLURT_GEM 5 
|-- What snare spell 
#define SNARE_SPELL "Dooming Darkness" 
|-- Favorite gem spot for the snare (1-8) 
#define SNARE_GEM 8 

|-- Name of fear spell 
#define FEAR_SPELL "Invoke Fear" 
|-- Favorite gem spot for the fear (1-8) 
#define FEAR_GEM 7 

|-- How low on health should the pet be before we heal it (noncombat) 
#define HEAL_PET_BELOW_PCT 70 
|-- Name of pet healing spell 
#define HEAL_PET_SPELL "Renew Bones" 
|-- Favorite gem spot for the petheal (1-8) 
#define HEAL_PET_GEM 3 
#define PET_HASTE "Augment Death" 
#define PET_HASTE_GEM 4 
#define LICH_SPELL "Call of Bones" 
#define LICH_GEM 2 
#define LIFE_DOT "Vampiric Curse" 
#define LIFE_DOT_GEM 6 
#define ROD_NAME "Summoned: Modulating Rod" 
|What is our feign death spell of choice? (Requires it be already mem'd, memorizing before feigning = death) 
#define FEIGN_SPELL "Feign Death" 
#define FEIGN_GEM 4 

|-- If your health gets below this lvl start /beep'ing and FD 
#define ALARM_HEALTH_BELOW_PCT 35 



|-- What is the minimum mana I should have, wait if below 
#define MIN_MANA_BEFORE_MEDITATE 64

|--How many waypoints exist on the kiting path for the rats.
#define WP_SIZE 37
#define Y_COORD 1
#define X_COORD 2
#define Z_COORD 3


Sub CheckPlug(who)
   /if (${Plugin[${who}].Name.Length}==NULL) {
       /echo This requires the ${who} plugin to work.
       /echo Install and/or /plugin ${who} and try again.
       /beep
       /endmacro
   }
/return

|----------------------------------------------------------------------------
|SUB: Main - Declarations and Initialization
|----------------------------------------------------------------------------
Sub Main
   PLUGIN_NEEDED MQ2Supercompilation
   |you have to edit the name of your warp in here.
   |Buffs to be kept up on self (max 15) - "Buff" or "Buff|GemSlot"
   /declare MyBuffs[2] string outer
   /varset MyBuffs[1] "Arch Shielding|1"
   /varset MyBuffs[2] "Spirit Armor|8"

   |Buffs to be kept up on pet (max 15) - "Buff" or "Buff|GemSlot"
   /declare PetBuffs[2] string outer
   /varset PetBuffs[1] "Spirit Armor|8"
   /varset PetBuffs[2] "PET_HASTE|PET_HASTE_GEM"

   /declare weZoned bool outer FALSE
   /declare wayBlocked bool outer FALSE
   /declare mountFlag bool outer TRUE
   /declare result int outer
   /declare startingPP int outer ${Me.Platinum}
   /declare startingXP int outer ${Me.Exp}
   /declare wpY float outer
   /declare wpX float outer
   /declare wpZ float outer
   /declare waypoint[WP_SIZE,3] int outer
   /varset waypoint[1,Y_COORD] -598
   /varset waypoint[1,X_COORD] 101
   /varset waypoint[1,Z_COORD] 4
   /varset waypoint[2,Y_COORD] -596
   /varset waypoint[2,X_COORD] 108
   /varset waypoint[2,Z_COORD] 4
   /varset waypoint[3,Y_COORD] -597
   /varset waypoint[3,X_COORD] -40
   /varset waypoint[3,Z_COORD] 4
   /varset waypoint[4,Y_COORD] -556
   /varset waypoint[4,X_COORD] -50
   /varset waypoint[4,Z_COORD] 4
   /varset waypoint[5,Y_COORD] -556
   /varset waypoint[5,X_COORD] -160
   /varset waypoint[5,Z_COORD] 4
   /varset waypoint[6,Y_COORD] -473
   /varset waypoint[6,X_COORD] -41
   /varset waypoint[6,Z_COORD] 4
   /varset waypoint[7,Y_COORD] -398
   /varset waypoint[7,X_COORD] -45
   /varset waypoint[7,Z_COORD] 4
   /varset waypoint[8,Y_COORD] -402
   /varset waypoint[8,X_COORD] 1
   /varset waypoint[8,Z_COORD] 4
   /varset waypoint[9,Y_COORD] -329
   /varset waypoint[9,X_COORD] 0
   /varset waypoint[9,Z_COORD] 13
   /varset waypoint[10,Y_COORD] -596
   /varset waypoint[10,X_COORD] 157
   /varset waypoint[10,Z_COORD] 2
   /varset waypoint[11,Y_COORD] -600
   /varset waypoint[11,X_COORD] 198
   /varset waypoint[11,Z_COORD] 4
   /varset waypoint[12,Y_COORD] -721
   /varset waypoint[12,X_COORD] 45
   /varset waypoint[12,Z_COORD] -10
   /varset waypoint[13,Y_COORD] -664
   /varset waypoint[13,X_COORD] 45
   /varset waypoint[13,Z_COORD] -4
   /varset waypoint[14,Y_COORD] -635
   /varset waypoint[14,X_COORD] 45
   /varset waypoint[14,Z_COORD] 4
   /varset waypoint[15,Y_COORD] -814
   /varset waypoint[15,X_COORD] 45
   /varset waypoint[15,Z_COORD] -10
   /varset waypoint[16,Y_COORD] -814
   /varset waypoint[16,X_COORD] 190
   /varset waypoint[16,Z_COORD] -11
   /varset waypoint[17,Y_COORD] -814
   /varset waypoint[17,X_COORD] 335
   /varset waypoint[17,Z_COORD] -10
   /varset waypoint[18,Y_COORD] -814
   /varset waypoint[18,X_COORD] 488
   /varset waypoint[18,Z_COORD] -35
   /varset waypoint[19,Y_COORD] -473
   /varset waypoint[19,X_COORD] -6
   /varset waypoint[19,Z_COORD] 4
   /varset waypoint[20,Y_COORD] -473
   /varset waypoint[20,X_COORD] 20
   /varset waypoint[20,Z_COORD] -2
   /varset waypoint[21,Y_COORD] -473
   /varset waypoint[21,X_COORD] 56
   /varset waypoint[21,Z_COORD] -10
   /varset waypoint[22,Y_COORD] -473
   /varset waypoint[22,X_COORD] 135
   /varset waypoint[22,Z_COORD] -11
   /varset waypoint[23,Y_COORD] -405
   /varset waypoint[23,X_COORD] 135
   /varset waypoint[23,Z_COORD] -11
   /varset waypoint[24,Y_COORD] -405
   /varset waypoint[24,X_COORD] 93
   /varset waypoint[24,Z_COORD] -11
   /varset waypoint[25,Y_COORD] -290
   /varset waypoint[25,X_COORD] 93
   /varset waypoint[25,Z_COORD] -11
   /varset waypoint[26,Y_COORD] -290
   /varset waypoint[26,X_COORD] 183
   /varset waypoint[26,Z_COORD] -11
   /varset waypoint[27,Y_COORD] -290
   /varset waypoint[27,X_COORD] 275
   /varset waypoint[27,Z_COORD] -11
   /varset waypoint[28,Y_COORD] -409
   /varset waypoint[28,X_COORD] 275
   /varset waypoint[28,Z_COORD] -11
   /varset waypoint[29,Y_COORD] -397
   /varset waypoint[29,X_COORD] -40
   /varset waypoint[29,Z_COORD] 4
   /varset waypoint[30,Y_COORD] -397
   /varset waypoint[30,X_COORD] 0
   /varset waypoint[30,Z_COORD] 4
   /varset waypoint[31,Y_COORD] -337
   /varset waypoint[31,X_COORD] 1
   /varset waypoint[31,Z_COORD] 12
   /varset waypoint[32,Y_COORD] -235
   /varset waypoint[32,X_COORD] 0
   /varset waypoint[32,Z_COORD] 20
   /varset waypoint[33,Y_COORD] -167
   /varset waypoint[33,X_COORD] 0
   /varset waypoint[33,Z_COORD] 20
   /varset waypoint[34,Y_COORD] -127
   /varset waypoint[34,X_COORD] 0
   /varset waypoint[34,Z_COORD] 14
   /varset waypoint[35,Y_COORD] -86
   /varset waypoint[35,X_COORD] 0
   /varset waypoint[35,Z_COORD] 4
   /varset waypoint[36,Y_COORD] 4
   /varset waypoint[36,X_COORD] 0
   /varset waypoint[36,Z_COORD] -6
   /varset waypoint[37,Y_COORD] 53
   /varset waypoint[37,X_COORD] 0
   /varset waypoint[37,Z_COORD] 4

   DEBUG_1 Starting macro
   |Group of locked target data
   /declare TargetName string outer
   /declare TargetID int outer
   /declare fightTimer timer outer

   /call MainSub
   DEBUG_1 Exited normally!
/return


|----------------------------------------------------------------------------
|SUB: MainSub - The main sub
|----------------------------------------------------------------------------
Sub MainSub
   |The main loop. After an attack we go here to acquire a new target
   /cleanup
:NewTarget
   /varset TargetID
   /if (${Corpse.Open}) {
       /notify LootWnd DoneButton leftmouseup
       /cleanup
   }
   /call Gmcheck
   /call AlwaysCheck
   
   /if (${Macro.Return}) /return
   /call DowntimeWork
   /if (${Macro.Return}==0) /goto :NewTarget

   /call AcquireTarget
   /if (${Macro.Return}) /goto :NewTarget
   /call BackOffFromTarget 40
   |/mqpause
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /goto :NewTarget
  | /if (${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON) /call SummonPet TRUE
   /pet attack
   /delay 2s
   /call MyCast "SNARE_SPELL" SNARE_GEM
  
   /call DoTheFear
   /if (${Int[SPLURT_GEM]}>0) /call MyCast "SPLURT_SPELL" SPLURT_GEM
   /call MyCast "LIFE_DOT" LIFE_DOT_GEM
   /call MainAttack
   /if (${Me.Pet.ID}) {
       /if (${Me.Pet.Distance}>20) /warploc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
   } else {
       /succor
   }
   /goto :NewTarget
/return

| AlwaysCheck - health, aggro, zone, etc. ALSO CALLED FROM EVENTS.
| "/call AlwaysCheck nocast" to never perform casting (eg event calls)
| 0=no problem; 1=panic
Sub AlwaysCheck(string casting)
   /doevents Zoned
   /if (${Cursor.ID}) /autoinventory
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       /call NoLich
       /if (${Me.PctHPs}<=20) {
           /instacamp
           /endmacro
       }
       /if (${Spawn[${TargetID}].Type.Equal[NPC]} && ${Zone.Name.Find[forgotten]}!=0) {
           /call BailOut
           /return 1
       }
   }
   /if (${Me.PctMana}>90 || ${Me.PctHPs}<50) {
       /call NoLich
   }
   /if (${casting.Equal[nocast]}==FALSE) {
       /if (${Me.Pet.ID}!=0 && ${Me.PetBuff[PET_HASTE]}==0) /call MyCast "PET_HASTE" PET_HASTE_GEM
       /if (${Me.PctMana}<90 && ${Me.Buff[LICH_SPELL].ID}==NULL && ${Me.PctHPs}>50) /call MyCast "LICH_SPELL" LICH_GEM
       /if (${FindItem[ROD_NAME].ID}!=0) /cast item "ROD_NAME"
   }
   /if (${weZoned}) {
       /declare zoneDelay timer 3m
       /varset weZoned FALSE
       /varset wayBlocked FALSE
       /doevents flush
       /if (${Zone.Name.Find[forgotten]}==NULL) {
           /if (${Zone.Name.Find[nedaria]}==NULL) {
:quit
               /dismount
               /camp desktop
               /endmacro
           }
           /pet sit
         
           /warploc  1543 -670 96
           /keypress back
           /keypress forward
           /delay 1
           /sit
           /popup Waiting for health>50%...
           /pet sit
           /delay 5m ${Me.PctHPs}>50
           /face fast loc 1543,-670
:zoning
          /doortarget JPCROCK800A
         
          /face fast
           /delay 1s
           /click left 400 300
           /delay 5
           /click left 500 400
           /delay 5
           /click left 600 500
           /doevents Zoned
           /doevents Blocked
           /delay 1s ${weZoned}||${wayBlocked}
           /if (${wayBlocked}) /goto :quit
           /if (${weZoned}==FALSE && ${zoneDelay.Value}>0) /goto :zoning
           /if (${Zone.Name.Find[forgotten]}==NULL) /goto :quit
       }
   }
/return 0

Sub NoLich
   /declare slot int local
   /varcalc slot ${Me.Buff[LICH_SPELL].ID}-1
   /if (${slot}>=0) /notify BuffWindow Buff${slot} leftmouseup
/return

Sub BailOut
   /dismount
   /attack off
   /succor
   /delay 1
   /target npc a_harindi_guide
  | /warploc -30 -827 -11
   /warpt t
   /delay 2
   /face fast nolook
:panic
   /say I am ready to leave!
   /delay 1
   /doevents Zoned
   /delay 5 ${weZoned}
   /if (${Zone.Name.Find[forgotten]}) {
       
       /keypress forward hold
       /delay 4
       /keypress forward
       /if (${Target.ID}) {
           /face fast nolook
       } else {
           /return
       }
       /goto :panic
   }
/return

|----------------------------------------------------------------------------
|SUB: MainAttack - Handles the kiting/killing
|----------------------------------------------------------------------------
Sub MainAttack
:attackAgain
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /doevents
   /target id ${TargetID}
   DELAY 1
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /call AlwaysCheck
   /if (${Macro.Return}) /return
   /if (${Target.ID}==${Me.Pet.ID}) {
       /assist
       DELAY 3 ${Target.ID}!=${Me.Pet.ID}
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${Me.PctHPs}>ALARM_HEALTH_BELOW_PCT && ${Me.Buff[LICH_SPELL].ID}==NULL) {
       DEBUG_3 Me.Buff[LICH_SPELL].ID==${Me.Buff[LICH_SPELL].ID}
       /call MyCast "LICH_SPELL" LICH_GEM
   }
   /call HealPet
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /face
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /call WarpCloser
   /if (${Me.Sitting}==FALSE && ${Me.Mount.ID}==0) /call Mount
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${fightTimer.Value}==0 && ${Target.PctHPs}>20) {
       /call DoTheFear
       /call MyCast "LIFE_DOT" LIFE_DOT_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties
   /if (${Target.PctHPs}>20 && ${Target.Speed}>50) {
       /warpt
       DELAY 1
       /call MyCast "SNARE_SPELL" SNARE_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Target.ID}>0 && ${Target.Type.NotEqual[Corpse]}) /goto :attackAgain
:looties
   /call AlwaysCheck
   /if (${Zone.Name.Find[forgotten]}==NULL || ${Macro.Return}) /return
   /call DoTheLooting
   /varset TargetID
/return

|----------------------------------------------------------------------------
|SUB: DowntimeWork - Between fight rebuffs, etc.
|----------------------------------------------------------------------------
Sub DowntimeWork
| Check if we are low on mana or health. Heal or sit down if low
   /call CheckMana
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 1. Mana Checked

| Make sure pet is up + all its buffs are on it
   /call HealPet
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 2. Pet Health Checked

   /call MaintainPetBuffs
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 3. Pet Buffs Checked

| Make sure all buffs on self are up
   /call MaintainSelfBuffs
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 4. Buffs Checked

   /call AlwaysCheck
   /if (${Macro.Return}) /return 0

   /memset fhalls
   |/memspellset fhalls
   /delay 2s ${Window[SpellBookWnd]}==FALSE
/return 1

Sub instaClicky
   /if (${FindItem[=Journeyman's Boots].ID}) /cast item "Journeyman's Boots"
   /if (${FindItem[=Shrunken Goblin Skull Earring].ID}) /cast item "Shrunken Goblin Skull Earring"
/return

|----------------------------------------------------------------------------
|SUB: AcquireTarget - Finding a target 0=success; 1=n/a
|----------------------------------------------------------------------------
Sub AcquireTarget
   /declare s int local
   /declare lvl int local
   /declare spn int local
   /squelch /target clear
   /varset TargetID
   /varset TargetName
:scan
   /varcalc s ${s}+1
   /varset spn ${LastSpawn[${s}].ID}
   /if (${spn}==0) /goto :acquired
   /if ((${Spawn[${spn}].CleanName.Find[squeaking]} || ${Spawn[${spn}].CleanName.Find[squeaking]} || ${Spawn[${spn}].CleanName.Find[reject]}) && ${Spawn[${spn}].Type.Equal[Corpse]}==FALSE && ${Spawn[${spn}].Level}>=MIN_MOB_LVL && ${Spawn[${spn}].Level}<=MAX_MOB_LVL && ${Spawn[${spn}].Level}>${lvl}) {
       /if (${Spawn[${spn}].Y}<=-265 && ${Spawn[${spn}].Y}>=-429 && ${Spawn[${spn}].X}>=74 && ${Spawn[${spn}].X}<=298 && ${Spawn[${spn}].Level}>=47) {
           DEBUG_1 Ignoring mob in add area: ${Spawn[${spn}].CleanName}(L${Spawn[${spn}].Level})
       } else {
           /varset lvl ${Spawn[${spn}].Level}
           /varset TargetID ${Spawn[${spn}].ID}
       }
   }
   /goto :scan
:acquired
   /if (${TargetID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}!=0
       /if (${Target.CleanName.Find[${Me.CleanName}]}) {
           DEBUG_1 WTF? I got targeted!
           /return 1
       }
       /varset TargetID ${Target.ID}
       /varset TargetName ${Target.CleanName}
       /popup ${TargetName} (L${Target.Level})
       DEBUG_1 ${TargetName} (L${Target.Level})
       /return 0
   }
   DEBUG_3 AcquireTarget FAILED!
   /popup Waiting for mobs in range MIN_MOB_LVL-MAX_MOB_LVL...
   /call Mount
   /delay 5s
/return 1

| Find the closest WP in line-of-sight to our target
Sub FindWP
   /declare wp int local
   /declare Y int local
   /declare X int local
   /declare Z int local
   /declare dist float local 10000
   /varset wpY
   /varset wpX
   /varset wpZ
   /for wp 1 to WP_SIZE
       /varset Y ${waypoint[${wp},Y_COORD]}
       /varset X ${waypoint[${wp},X_COORD]}
       /varset Z ${waypoint[${wp},Z_COORD]}
       /if (${LineOfSight[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}]} && ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}]}<${dist}) {
           /varset wpY ${Y}
           /varset wpX ${X}
           /varset wpZ ${Z}
           /varset dist ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}]}
       }
   /next wp
/return

|Echo warp closer to target, via WP if mob, or direct otherwise.
Sub WarpCloser
 /echo warp closer to target, via WP if mob, or direct otherwise.
   /call AlwaysCheck nocast
   /if (${Macro.Return}) /return
   /if (${Target.ID}==0 || ${Target.ID}==${Me.ID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}>0
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /return
   /if (${Target.Type.Equal[Pet]}) {
       /warpt
   } else {
       /call FindWP
       /if (${wpY}!=0||${wpX}!=0||${wpZ}!=0) {
           /warploc ${wpY} ${wpX} ${wpZ}
       } else {
           /if (${Me.Pet.ID}) /warploc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
       }
   }
   DELAY 1
   /if (${Target.ID}) /face fast
/return

| DO NOT CALL DELAY FROM EVENTS!
| Parameters: delay timer setting + early exit condition
Sub Delay(string delayTime, string exitCond)
   /declare tmr timer local ${delayTime}
:moreDelay
   /call AlwaysCheck nocast
   /if (${tmr.Value}==0) /return
   /if (${exitCond}) {
       DEBUG_3 Early exit on condition: ${exitCond.Right[-1]}
       /return
   }
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Delay abort, ${tmr.Value} ticks left, LOW HEALTH!
       /return
   }
   /delay 1 ${exitCond}
   |/if (${Math.Calc[${tmr.Value}%10].Int}==0) DEBUG_3 /delay ${tmr.Value} ${exitCond.Right[-1]}:${exitCond}
   /doevents ImHit
   /doevents Retry
   /doevents Abort
   /doevents OutOfRange
   /doevents NoLOS
   /doevents Standing
   /doevents OOR
   /doevents CashLoot
   /doevents Zoned
   /doevents PetAggro
   /doevents NoMount
   /doevents GMInZone
   /doevents Stunned
   /if (${Target.Type.Equal[NPC]}) /face
   /goto :moreDelay
/return

Sub MyCast(string spname, string gname)
   /if (${Zone.Name.Find[forgotten]}==NULL) /return
   /if (${Corpse.Open}) /notify LootWnd DoneButton leftmouseup
   /if (!${Defined[spellName]}) /declare spellName string outer
   /varset spellName ${spname}
   /call DoCast ${gname}
   /doevents
   /if (${Target.ID}!=${TargetID} && ${TargetID}!=0) {
       /target id ${TargetID}
       DELAY 3 ${Target.ID}==${TargetID}
   }
   /if (${Target.Type.Equal[NPC]}) /face fast
/return



| Cast something with status return and event processing
| assumes outer variable spellName and TargetID
Sub DoCast(string gem)
| Cast routines
| Below.
/call GMcheck
   /declare tartype string local ${Spell[${spellName}].TargetType}
   /if (${gem.Equal[item]}) /varset tartype ${FindItem[=${spellName}].Spell.TargetType}
:recast
   /if (${tartype.Equal[Pet]} && ${Target.ID}!=${Me.Pet.ID}) {
       /if (${Me.Pet.ID}==0) /return
       /target id ${Me.Pet.ID}
       /delay 1
   } else /if (${tartype.Equal[Self]} && ${Target.ID}!=${Me.ID}) {
       /target myself
       /delay 1
   } else /if (${Target.Type.Equal[NPC]} && ${Target.ID}!=${TargetID}) {
       /target id ${TargetID}
       /delay 1
   }
   /if (${Target.Type.Equal[NPC]} && ${Target.PctHPs}<25) {
       DEBUG_3 Confusing/low health target (${Target.PctHPs}%)
       /return
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) {
       DEBUG_3 Target${Target.CleanName}(${Target.ID}) Dead?
       /return
   }
   /if (${Target.ID}!=${Me.ID}) {
       /face fast
       /if (!${LineOfSight[${Me.Y},${Me.X},${Me.Z}:${Target.Y},${Target.X},${Target.Z}]}) /call WarpCloser
   }
   /if (${gem.Equal[item]}) {
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast item "${spellName}"
   } else {
       /if (${Me.Gem[${spellName}]}==NULL) {
          /memfast  "${spellName}"  ${gem}
           
          |/memspell  ${gem}  "${spellName}" 
           DEBUG_3 book:${Window[SpellBookWnd]}; ${spellName}:${Me.SpellReady[${spellName}]}
           /delay 10s ${Window[SpellBookWnd]}==FALSE
           DELAY 15s ${Me.SpellReady[${spellName}]}
       } else {
           DEBUG_3 ${spellName}:${Me.SpellReady[${spellName}]}
           /if (!${Me.SpellReady[${spellName}]}) {
               DELAY 15s ${Me.SpellReady[${spellName}]}
           }
       }
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast "${spellName}"
   }
   /varset result CAST_IN_PROGRESS
   DELAY 2
   /doevents
   /if (${result}==CAST_IN_PROGRESS && ${Me.Casting.ID}==0) /goto :recast
   DELAY 30s ${Me.Casting.ID}==NULL
   /delay 1
   /doevents
   /if (${result}==CAST_IN_PROGRESS) /varset result CAST_SUCCESS
   DEBUG_3 Casting of ${spellName} complete, result=${result}
   /if (${result}==CAST_OUTOFRANGE || ${result}==CAST_CANNOTSEE) {
       /call WarpCloser
       /goto :recast
   } else /if (${result}==CAST_RETRY) {
       /if (!${Me.SpellReady[${spellName}]}) {
           /call instaClicky
           /varcalc result ${Spell[${spellName}].RecoveryTime}*10
           DELAY ${result} ${Me.SpellReady[${spellName}]}
       }
       /goto :recast
   }
/return

|----------------------------------------------------------------------------
|SUB: SummonPet - Summon pet if farther away than the defined range
|----------------------------------------------------------------------------
Sub SummonPet(bool force)
 /*  /if (${force} || (MAX_PET_RANGE_BEFORE_SUMMON>0 && ${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON)) {
       DELAY 5s (${Me.Pet.Distance}<MAX_PET_RANGE_BEFORE_SUMMON||${force})
       /if (${Int[SUMMON_GEM]}<1 || ${Me.Pet.Distance}<MAX_PET_RANGE_BEFORE_SUMMON) /return
       DEBUG_1 Summoning pet. Its range is ${Me.Pet.Distance}
       /call MyCast "SUMMON_SPELL" SUMMON_GEM
   } 
   */
/return


|----------------------------------------------------------------------------
|SUB: HealPet - Heal pet if needed 0=just healed; 1=no problem
|----------------------------------------------------------------------------
Sub HealPet
   |Heal pet?
   /if ( ${Me.Pet.PctHPs}<HEAL_PET_BELOW_PCT && ${Me.PetBuff[HEAL_PET_SPELL]}==0 ) {
       /if ( ${Me.Pet.ID} ) {
           /target id ${Me.Pet.ID}
           DELAY 1
           /call MyCast "HEAL_PET_SPELL" HEAL_PET_GEM
           /return 0
       }
   }
/return 1

Sub Mount
   /if (${mountFlag}) {
       /if (${InvSlot[ammo].Item.Name.Find[Drum]}!=NULL && ${Me.Buff[Summon Drogmor].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else /if (${InvSlot[ammo].Item.Name.Find[Bridle]}!=NULL && ${Me.Buff[Summon Horse].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else {
           /if (!${Me.Sitting}) /sit
       }
   } else {
       /if (!${Me.Sitting}) /sit
   }
/return

|----------------------------------------------------------------------------
|SUB: CheckMana 0= need more med; 1=mana ok
| Now with histeresis - exit condition is above entry condition.
|----------------------------------------------------------------------------
Sub CheckMana
   /declare exitMana int local
   /declare exitHealth int local
   /varcalc exitMana MIN_MANA_BEFORE_MEDITATE+15
   /varcalc exitHealth ALARM_HEALTH_BELOW_PCT+20
   |Meditate?
   /if (${Me.PctMana}<MIN_MANA_BEFORE_MEDITATE || ${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Meditating.
       /popup Meditating...
       /call Mount
       /declare i int local
       /if ( ${Target.ID} ) /squelch /target clear
       /for i 1 to 10
           DELAY 1s
           /if ( ${Target.ID} ) /return 1
       /next i
       /if ( ${Me.PctMana}<${exitMana} || ${Me.PctHPs}<${exitHealth} ) {
           /return 0
       }
       DEBUG_2 Mana/health OK now.
   }
/return 1


|----------------------------------------------------------------------------
|SUB: MaintainPetBuffs - Heal pet and keep its buffs up
|   0= still busy; 1=all done
|----------------------------------------------------------------------------
Sub MaintainPetBuffs
   |If we have pet
   /if ( ${Me.Pet.ID}==0 ) {
       DEBUG_1 Creating new pet
       /call MyCast "PET_SPELL" PET_GEM
       /return 0
   }
  | /call SummonPet
   /declare iCount int local
   /declare t string local
   /for iCount 1 to ${PetBuffs.Size}
       /call SplitString tmp_tmp ${PetBuffs[${iCount}]} "|"
       /varset t ${Me.PetBuff[${tmp_tmp[1]}]}
       /if ( ${t.Equal[NULL]} ) {
            /if ( !${Target.ID}!=${Me.Pet.ID} ) {
               /target id ${Me.Pet.ID}
            }
            |Cast with gemselection or default
            /if ( ${tmp_tmp.Size}>1 ) {
                /if (!${Me.SpellReady[${tmp_tmp[2]}]}) {
                   DELAY 15s ${Me.SpellReady[${tmp_tmp[2]}]}
               }
                DEBUG_3 Trying to cast "${tmp_tmp[1]}" ${tmp_tmp[2]}
                /call MyCast "${tmp_tmp[1]}" ${tmp_tmp[2]}
            } else {
                /if (!${Me.SpellReady[${tmp_tmp[1]}]}) {
                   DELAY 15s ${Me.SpellReady[${tmp_tmp[1]}]} 8 force
               }
                DEBUG_3 Trying to cast "${tmp_tmp[1]}"
                /call MyCast "${tmp_tmp[1]}" 8
            }
            |Return to top - so we dont keep buffing if being attacked
            /return 0
         }
   /next iCount
/return 1


|----------------------------------------------------------------------------
|SUB: MaintainSelfBuffs - Keep buffs up
|       0=still buffing; 1=all done
|----------------------------------------------------------------------------
Sub MaintainSelfBuffs
   /declare iCount int local
   /declare t string local
   /for iCount 1 to ${MyBuffs.Size}
       /call SplitString tmp_tmp ${MyBuffs[${iCount}]} "|"
       /varset t ${Me.Buff[${tmp_tmp[1]}]}
       /if ( ${t.Equal[NULL]} ) {
           /if ( !${Target.ID}!=${Me.ID} ) {
               /target myself
           }
           |Cast with gemselection or default
           /if ( ${tmp_tmp.Size}>1 ) {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}" ${tmp_tmp[2]}
               /call MyCast "${tmp_tmp[1]}" ${tmp_tmp[2]}
           } else {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}"
               /call MyCast "${tmp_tmp[1]}" 8
           }
           |Return to top - so we dont keep buffing if being attacked
           /return 0
       }
   /next iCount
/return 1

| Back off from current target so many units.
| Finds first line of sight on a horizontal, vertical, or
| diagonals that are at least as distant as desired.
Sub BackOffFromTarget(float dist)
   /declare by float local ${Target.Y}
   /declare bx float local ${Target.X}
   /varcalc by ${by}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff
   /varset by ${Target.Y}
   /varcalc bx ${bx}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff
   /varcalc by ${by}+${dist}
   /varset bx ${Target.X}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff
   /varset by ${Target.Y}
   /varcalc bx ${bx}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff
   /varcalc by ${by}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff
   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff
   /face fast
   /keypress forward hold
   /delay 3s ${Target.Distance}>=${dist}
   /keypress forward
   /face fast
   /return
:backoff
   /warploc  ${by} ${bx} ${Target.Z}
   /delay 1
   /if (${Target.ID}) /face fast
/return


|----------------------------------------------------------------------------
|SUB: DoTheLooting
|----------------------------------------------------------------------------
Sub DoTheLooting
   /if (!${Defined[looted]}) /declare looted bool outer
   /target id ${TargetID}
   DELAY 1
   DEBUG_1 Going to loot
   DEBUG_3 DoTheLooting Target: ${Target.CleanName}, ID:${Target.ID}
   /warpt
   DELAY 1
   /loot
   /varset looted FALSE
   DELAY 6s (${Corpse.Open}&&${looted})
   /call LootMob
   /notify LootWnd DoneButton leftmouseup
   DELAY 1
   /doevents
   /declare xp int local
   /declare pp int local
   /declare level float local ${Me.Level}
   /varcalc level ${level}+${Math.Calc[${Me.Exp}/330.0].Milli}
   /varcalc xp ${Me.Exp}-${startingXP}
   /if (${xp}<0) /varcalc xp ${xp}+330
   /varcalc pp ${Me.Platinum}-${startingPP}
   /popup L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DEBUG_1 L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DELAY 5s
/return


|----------------------------------------------------------------------------
|SUB: LootMob
|----------------------------------------------------------------------------
Sub LootMob
   /declare LootSlot int local
   /if (!${Target.ID}) {
       /target npc corpse
       DELAY 1s ${Target.ID}>0
   }
   /loot
   DELAY 1s ${Corpse.Open}
   /if (${Corpse.Items}) {
       /for LootSlot 1 to ${Corpse.Items}
           /itemnotify loot${LootSlot} leftmouseup
           DELAY 1s ${Cursor.ID}>0
           /destroy
       /next LootSlot
   }
   /cleanup
/return


|----------------------------------------------------------------------------
|SUB: SplitString - A generic string splitter.
|----------------------------------------------------------------------------
Sub SplitString(string varname, string inputstring, string splitter)
   |/echo varname: "${varname}", inputstring: "${inputstring}", splitter: "${splitter}"
   /declare i int local
   /declare stringcnt int local

   |The normal splitter. Splitter string is just 1 in length.
   /if (${splitter.Length}==1) {
       /varcalc stringcnt ${inputstring.Count["${splitter}"]} + 1
       /if (!${Defined[${varname}]}) {
           /declare ${varname}[${stringcnt}] string outer
       } else {
           /deletevar ${varname}
           /declare ${varname}[${stringcnt}] string outer
       }
       /for i 1 to ${stringcnt}
           /varset ${varname}[${i}] ${inputstring.Token[${i},"${splitter}"]}
       /next i
   }
/return


|----------------------------------------------------------------------------
|SUB: DestroyCopper - Destroy all the copper
|----------------------------------------------------------------------------
Sub DestroyCopper
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money3 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DestroySilver - Destroy all the silver
|----------------------------------------------------------------------------
Sub DestroySilver
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money2 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DestroyGold - Destroy all the gold
|----------------------------------------------------------------------------
Sub DestroyGold
  /squelch /windowstate InventoryWindow open
  /shift /notify InventoryWindow IW_Money1 leftmouseup
  /delay 1s ${Cursor.ID}>0
  /destroy
  /cleanup
/return


|----------------------------------------------------------------------------
|SUB: DoTheFear - Fear target
|----------------------------------------------------------------------------
Sub DoTheFear
   /if ( ${Me.PctMana}>10 && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}>19) {
       /call MyCast "FEAR_SPELL" FEAR_GEM
       /varset fightTimer 31s
   }
/return

|----------------------------------------------------------------------------
|SUB: Event_CashLoot - Will count the loot so far running the macro
|----------------------------------------------------------------------------
Sub Event_CashLoot(string Line, string cash)
   /if ( DESTROY_GOLD_IF_ABOVE>0 && ${Me.Gold}>DESTROY_GOLD_IF_ABOVE ) /call DestroyGold

   /if ( DESTROY_SILVER_IF_ABOVE>0 && ${Me.Silver}>DESTROY_SILVER_IF_ABOVE )  /call DestroySilver

   /if ( DESTROY_COPPER_IF_ABOVE>0 && ${Me.Copper}>DESTROY_COPPER_IF_ABOVE )  /call DestroyCopper
   /varset looted TRUE
/return

Sub Event_fear
   DEBUG_2 Fear me!
   /call DoTheFear
/return

Sub Event_ImHit
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
   /call BackOffFromTarget 80
/return

Sub Event_Retry
   /delay 2
   /varset result CAST_RETRY
/return

Sub Event_Abort
   /varset result CAST_ABORT
/return

Sub Event_OutOfRange
   /varset result CAST_OUTOFRANGE
/return

Sub Event_NoLOS
   /varset result CAST_CANNOTSEE
/return

Sub Event_Standing
   /stand
   /varset result CAST_RETRY
/return

Sub Event_OOR
   /warpt
   /delay 2
   /loot
   /delay 3
   /delay 3s ${Corpse.Open}
   /doevents OOR
/return

Sub Event_Blocked
   /varset wayBlocked TRUE
/return

Sub Event_Zoned
   /varset weZoned TRUE
/return

Sub Event_PetAggro
   /target id ${Me.Pet.ID}
   /warpt
   /delay 1
   /assist
   /delay 1
/return

Sub Event_NoMount
   /varset mountFlag FALSE
/return

Sub Event_Stunned
:gdStunned
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /delay 1
   /if (${Me.Stunned}) /goto :gdStunned
   /varset result CAST_RETRY
/return

|-------------------------------------------------------------------------------- 
|SUB: GM CHAT Check 
|-------------------------------------------------------------------------------- 
Sub Event_GMInZone
  /q
/return

|-------------------------------------------------------------------------------- 
|-------------------------------------------------------------------------------- 
|SUB: GM Check 
|-------------------------------------------------------------------------------- 
Sub GMCheck 

   /if (${Spawn[gm].ID}) { 
      /beep 
      /beep 
      /beep 
      
      /echo GM has entered the zone! 
      /echo FUCK HIM but ending the macro... 

      /keypress forward 
      /keypress back 

      /keypress instant_camp 
      /endmacro 
   } 
    
/return 
|--------------------------------------------------------------------------------

P.S just added a GM check in there.
 
Last edited:
The macro is presently setup for a level 17/42 (without the summon spell)...enable summon spell , and you are ready for 42/70.
 
This was the ROOT ROT macro i was using for my level 70 necro...It should run without much editing..I haven't got the necro (levelling one back)to really re-test it, but this was what i was using..

it assumes you have a necro skullcap and an epic 1.0 , most of your spells to level 70..and we're not using a pet at all....we're warping when we start the spell and warping back to our location when the spell ends.

If you don't have an epic or a skullcap (you should buy the skullcap , it s cheap and definitely helps in this macro)..

Just remove them and use the normal spells e.g change to /call MyCast "LIFE_DOT" LIFE_DOT_GEM everytime you see a skullcap ..same for the epic 1.0..shouldnt be too hard.

It also assumes you have the Manaskin .

Things to change :

#define ROOT_SPELL "Petrifying Earth"
#define SPLURT_SPELL "Dark Nightmare"
#define HEAT_DOT "Pyre of Mori"
#define DISEASE_DOT "Chaos Plague"
#define POISON_DOT "Blood of Thule"


#define SPLURT_GEM 1
#define HEAT_DOT_GEM 3
#define DISEASE_DOT_GEM 5
#define POISON_DOT_GEM 7
#define ROOT_GEM 8
#define HEAL_PET_GEM 7
#define PET_HASTE "Glyph of Darkness"
#define PET_HASTE_GEM 6
#define LICH_SPELL "Seduction of Saryrn"
#define LICH_GEM 8
#define LIFE_DOT "Demi Lich Skullcap"
#define LIFE_DOT_GEM item
#define ROD_NAME "Summoned: Modulating Rod"
#define SNARE_DOT "Scythe of the shadowed soul"
#define SNARE_DOT_GEM item

Lower look for
#define PET_SPELL "Lost Soul"




Rich (BB code):
| necro666.mac v2.2, Mandrack
|Stand on your horse and be inside the forgotten halls to start this macro.
| Author : Zornecro, borrowed from wolf5 and mandrack
| 
| Useage : /macro necro666
| Description : This macro will root dot mobs of
| The Forgotten Halls. It assumes you have an instance
| and are inside already.
|
| Mandrack edition
|
| 
|------------------------------------------------------------------------------
#turbo 40
#define MY_PARTNER NameHERE
#define MIN_MOB_LVL 61
#define MAX_MOB_LVL 70


#define CAST_SUCCESS 0
#define CAST_OUTOFRANGE 1
#define CAST_CANNOTSEE 2
#define CAST_RETRY 3
#define CAST_IN_PROGRESS 4
#define CAST_ABORT -1

#define DELAY "/noparse /call Delay"

#define ROOT_SPELL "Petrifying Earth"
#define SPLURT_SPELL "Dark Nightmare"
#define HEAT_DOT "Pyre of Mori"
#define DISEASE_DOT "Chaos Plague"
#define POISON_DOT "Blood of Thule"
#event Exp "#*#party experience!!"
#event Exp2 "You gain experience!!"
#event Invited "#1# invites you to join a group."
#event Blocked "The wa!n not summon a mount#*#"
#event NoLich "You can not change into this form while on a mount."
#event OOR "You are too far away to loot that corpse."
#event Retry "Your spell fizzles!"
#event Retry "Your spell is interrupted."
#event Retry "You haven't recovered yet..."
#event Retry "Spell recovery time not yet met."
#event Retry "Your target resisted the #*#"
#event Abort "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event NoLOS "You cannot see your target."
|#event Stunned "You can't cast spells while stunned!"
|#event Stunned "You are stunned!"
#event Standing "You must be standing to cast a spell."
#event Standing "|${Me.CleanName}| has fallen to the ground."
#event Retry "Your gate is too unstable, and collapses."
#event Abort "Your target is immune to changes in its attack speed."
#event Retry "You are too distracted to cast a spell now!"
#event Zoned "You have entered #*#"
#event PetAggro "Your pet is the focus of something's attention."
#event RootGone "Your Petrifying Earth spell has worn off."
#event DOT1Gone "Your Dark Nightmare spell has worn off."
#event DOT2Gone "Your Pyre of Mori spell has worn off."
#event DOT3Gone "Your Chaos Plague spell has worn off."
#event DOT4Gone "Your Blood of Thule spell has worn off."
#event Skullcapgone "Your Morternum spell has worn off."
#event fear "Your fear spell has worn off."
#event Snaregone "The shadows release #*#The shadows release your mind. mind."
#event ImHit "|${Target.CleanName}|#*# YOU for#*#"
#event Skinhit "|${Target.CleanName}|#*# YOU, but YOUR magical skin absorbs the blow!"
#event Miss1 "|${Target.CleanName}|#*# YOU, but misses!"

|-- The normal debug - for normal play.
| Enable: "/echo", Disable: "/squelch /echo"
#define DEBUG_1 /echo
|-- Deeper debugging - enable when trying to find bugs.
#define DEBUG_2 "/echo"
|--  The Deepest debugging - will spam a lot.
#define DEBUG_3 "/echo"

|-- Destroys Silver if you have more than the given amount! 0=disable
#define DESTROY_SILVER_IF_ABOVE 1
|-- Destroys Copper if you have more than the given amount! 0=disable
#define DESTROY_COPPER_IF_ABOVE 1

|-- At what range do we send in pet?
#define INITIALIZE_ATTACK_RANGE 100

|-- What pet do we want?
#define PET_SPELL "Lost Soul"
|-- Favorite gem spot for the pet (1-8)
#define PET_GEM 6
|-- How far off should the pet be before we summon it?
#define MAX_PET_RANGE_BEFORE_SUMMON 800
#define SUMMON_SPELL "Ribbon of Empathy"
#define SUMMON_GEM item

| Change SPLURT_GEM to 0 if you lack it.
#define SPLURT_GEM 1
#define HEAT_DOT_GEM 3
#define DISEASE_DOT_GEM 5
#define POISON_DOT_GEM 7
#define ROOT_GEM 8
|-- Name of fear spell
#define FEAR_SPELL "Trepidation"
|-- Favorite gem spot for the fear (1-8)
#define FEAR_GEM 3

|-- How low on health should the pet be before we heal it (noncombat)
#define HEAL_PET_BELOW_PCT 70
|-- Name of pet healing spell
#define HEAL_PET_SPELL "Shadowbond"
|-- Favorite gem spot for the petheal (1-8)
#define HEAL_PET_GEM 7
#define PET_HASTE "Glyph of Darkness"
#define PET_HASTE_GEM 6
#define LICH_SPELL "Seduction of Saryrn"
#define LICH_GEM 8
#define LIFE_DOT "Demi Lich Skullcap"
#define LIFE_DOT_GEM item
#define ROD_NAME "Summoned: Modulating Rod"
#define SNARE_DOT "Scythe of the shadowed soul"
#define SNARE_DOT_GEM item
|-- If your health gets below this lvl start /beep'ing and FD
#define ALARM_HEALTH_BELOW_PCT 40

|What is our feign death spell of choice? (Requires it be already mem'd, memorizing before feigning = death)
#define FEIGN_SPELL "Death Peace"
#define FEIGN_GEM 4

|-- What is the minimum mana I should have, wait if below
#define MIN_MANA_BEFORE_MEDITATE 90

|--How many waypoints exist on the kiting path.
#define WP_SIZE 37
#define Y_COORD 1
#define X_COORD 2
#define Z_COORD 3

|----------------------------------------------------------------------------
|SUB: Main - Declarations and Initialization
|----------------------------------------------------------------------------
Sub Main
   /declare Exper float outer
   /declare AAExp float outer
   /declare LDRExp float outer

   /varset Exper ${Me.PctExp}
   /varset AAExp ${Me.PctAAExp}
   /varset LDRExp ${Me.PctGroupLeaderExp}

   /declare reroot bool outer TRUE
   /declare redot1 bool outer TRUE
   /declare redot2 bool outer TRUE
   /declare redot3 bool outer TRUE
   /declare reskull bool outer TRUE
   /declare dangerFlag bool outer
   /declare spellName string outer
   /declare Initialized bool outer FALSE
   /declare weZoned bool outer FALSE
   /declare wayBlocked bool outer FALSE
   /declare mountFlag bool outer TRUE
   /declare result int outer
   /declare startingPP int outer ${Me.Platinum}
   /declare startingXP int outer ${Me.Exp}
   /declare wpY float outer
   /declare wpX float outer
   /declare wpZ float outer
   /declare waypoint[WP_SIZE,3] int outer
   /varset waypoint[1,Y_COORD] -598
   /varset waypoint[1,X_COORD] 101
   /varset waypoint[1,Z_COORD] 4
   /varset waypoint[2,Y_COORD] -596
   /varset waypoint[2,X_COORD] 108
   /varset waypoint[2,Z_COORD] 4
   /varset waypoint[3,Y_COORD] -597
   /varset waypoint[3,X_COORD] -40
   /varset waypoint[3,Z_COORD] 4
   /varset waypoint[4,Y_COORD] -556
   /varset waypoint[4,X_COORD] -50
   /varset waypoint[4,Z_COORD] 4
   /varset waypoint[5,Y_COORD] -556
   /varset waypoint[5,X_COORD] -160
   /varset waypoint[5,Z_COORD] 4
   /varset waypoint[6,Y_COORD] -473
   /varset waypoint[6,X_COORD] -41
   /varset waypoint[6,Z_COORD] 4
   /varset waypoint[7,Y_COORD] -398
   /varset waypoint[7,X_COORD] -45
   /varset waypoint[7,Z_COORD] 4
   /varset waypoint[8,Y_COORD] -402
   /varset waypoint[8,X_COORD] 1
   /varset waypoint[8,Z_COORD] 4
   /varset waypoint[9,Y_COORD] -329
   /varset waypoint[9,X_COORD] 0
   /varset waypoint[9,Z_COORD] 13
   /varset waypoint[10,Y_COORD] -596
   /varset waypoint[10,X_COORD] 157
   /varset waypoint[10,Z_COORD] 2
   /varset waypoint[11,Y_COORD] -600
   /varset waypoint[11,X_COORD] 198
   /varset waypoint[11,Z_COORD] 4
   /varset waypoint[12,Y_COORD] -721
   /varset waypoint[12,X_COORD] 45
   /varset waypoint[12,Z_COORD] -10
   /varset waypoint[13,Y_COORD] -664
   /varset waypoint[13,X_COORD] 45
   /varset waypoint[13,Z_COORD] -4
   /varset waypoint[14,Y_COORD] -635
   /varset waypoint[14,X_COORD] 45
   /varset waypoint[14,Z_COORD] 4
   /varset waypoint[15,Y_COORD] -814
   /varset waypoint[15,X_COORD] 45
   /varset waypoint[15,Z_COORD] -10
   /varset waypoint[16,Y_COORD] -814
   /varset waypoint[16,X_COORD] 190
   /varset waypoint[16,Z_COORD] -11
   /varset waypoint[17,Y_COORD] -814
   /varset waypoint[17,X_COORD] 335
   /varset waypoint[17,Z_COORD] -10
   /varset waypoint[18,Y_COORD] -814
   /varset waypoint[18,X_COORD] 488
   /varset waypoint[18,Z_COORD] -35
   /varset waypoint[19,Y_COORD] -473
   /varset waypoint[19,X_COORD] -6
   /varset waypoint[19,Z_COORD] 4
   /varset waypoint[20,Y_COORD] -473
   /varset waypoint[20,X_COORD] 20
   /varset waypoint[20,Z_COORD] -2
   /varset waypoint[21,Y_COORD] -473
   /varset waypoint[21,X_COORD] 56
   /varset waypoint[21,Z_COORD] -10
   /varset waypoint[22,Y_COORD] -473
   /varset waypoint[22,X_COORD] 135
   /varset waypoint[22,Z_COORD] -11
   /varset waypoint[23,Y_COORD] -405
   /varset waypoint[23,X_COORD] 135
   /varset waypoint[23,Z_COORD] -11
   /varset waypoint[24,Y_COORD] -405
   /varset waypoint[24,X_COORD] 93
   /varset waypoint[24,Z_COORD] -11
   /varset waypoint[25,Y_COORD] -290
   /varset waypoint[25,X_COORD] 93
   /varset waypoint[25,Z_COORD] -11
   /varset waypoint[26,Y_COORD] -290
   /varset waypoint[26,X_COORD] 183
   /varset waypoint[26,Z_COORD] -11
   /varset waypoint[27,Y_COORD] -290
   /varset waypoint[27,X_COORD] 275
   /varset waypoint[27,Z_COORD] -11
   /varset waypoint[28,Y_COORD] -409
   /varset waypoint[28,X_COORD] 275
   /varset waypoint[28,Z_COORD] -11
   /varset waypoint[29,Y_COORD] -397
   /varset waypoint[29,X_COORD] -40
   /varset waypoint[29,Z_COORD] 4
   /varset waypoint[30,Y_COORD] -397
   /varset waypoint[30,X_COORD] 0
   /varset waypoint[30,Z_COORD] 4
   /varset waypoint[31,Y_COORD] -337
   /varset waypoint[31,X_COORD] 1
   /varset waypoint[31,Z_COORD] 12
   /varset waypoint[32,Y_COORD] -235
   /varset waypoint[32,X_COORD] 0
   /varset waypoint[32,Z_COORD] 20
   /varset waypoint[33,Y_COORD] -167
   /varset waypoint[33,X_COORD] 0
   /varset waypoint[33,Z_COORD] 20
   /varset waypoint[34,Y_COORD] -127
   /varset waypoint[34,X_COORD] 0
   /varset waypoint[34,Z_COORD] 14
   /varset waypoint[35,Y_COORD] -86
   /varset waypoint[35,X_COORD] 0
   /varset waypoint[35,Z_COORD] 4
   /varset waypoint[36,Y_COORD] 4
   /varset waypoint[36,X_COORD] 0
   /varset waypoint[36,Z_COORD] -6
   /varset waypoint[37,Y_COORD] 53
   /varset waypoint[37,X_COORD] 0
   /varset waypoint[37,Z_COORD] 4

   |Buffs to be kept up on self (max 15) - "Buff" or "Buff|GemSlot"
   /declare MyBuffs[2] string outer
/varset MyBuffs[1] "Shadow Guard|7"
/varset MyBuffs[2] "Force Shield|4"


   DEBUG_1 Starting macro
   |Group of locked target data
   /declare TargetName string outer
   /declare TargetID int outer
   /declare fightTimer timer outer

   /call MainSub
   DEBUG_1 Exited normally!
/return


|----------------------------------------------------------------------------
|SUB: MainSub - The main sub
|----------------------------------------------------------------------------
Sub MainSub
   |The main loop. After an attack we go here to acquire a new target
   /cleanup
   /if (${Zone.Name.Left[9].NotEqual[Forgotten]}) /varset weZoned TRUE
   /varset Initialized TRUE
:NewTarget
   /varset TargetID
   /if (${Corpse.Open}) {
       /notify LootWnd DoneButton leftmouseup
       /cleanup
   }
   /call AlwaysCheck
   /if (${Macro.Return}) /return

   /call DowntimeWork
   /if (${Macro.Return}==0) /goto :NewTarget

   /call AcquireTarget
   /if (${Macro.Return}) /goto :NewTarget

   ||| This is new code for Root Rot with Warp |||
   /call BackOffFromTarget 60
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /goto :NewTarget

   /if (${Spell[HEAT_DOT_GEM].Name.NotEqual[HEAT_DOT]}) {
       /memspellset dots
       /delay 1m ${Window[SpellBookWnd]}==FALSE
   }
   /doevents flush
   /varset reroot TRUE
   /varset redot1 TRUE
   /varset redot2 TRUE
   /varset redot3 TRUE
   /varset reskull TRUE
   /call BackOffFromTarget 60
:fartAround

DELAY 1 ${Target.ID}!=0&&${Target.Type.Equal[NPC]}
   /doevents
   /call AlwaysCheck
   /if (${Macro.Return}) /goto :NewTarget

   /if (${reroot} && ${Target.PctHPs}>1) {
    /call BackOffFromTarget 60    
/call MyCast "ROOT_SPELL" ROOT_GEM
       /call BackOffFromTarget 60
/varset reroot
       /varset dangerFlag
       /goto :fartAround
   } 

/if (${redot1} && ${reroot}!=0 && ${Target.PctHPs}>1) {
/call BackOffFromTarget 60
/call MyCast "SNARE_DOT" SNARE_DOT_GEM
/if (${Target.PctHPs}>16) /call MyCast "SPLURT_SPELL" SPLURT_GEM
          /varset redot1
   } else /if (${redot2} && ${Target.PctHPs}>1) {
      	/call BackOffFromTarget 60
	/call MyCast "ROOT_SPELL" ROOT_GEM
	/call BackOffFromTarget 60
	/call MyCast "HEAT_DOT" HEAT_DOT_GEM
        /call BackOffFromTarget 60
	/varset redot2
   } else /if (${redot3} && ${Target.PctHPs}>25) {
/call BackOffFromTarget 60       
/call MyCast "DISEASE_DOT" DISEASE_DOT_GEM
       /varset redot3
   } else /if (${reskull} && ${reroot}!=0 ${Target.PctHPs}>1) {
/call MyCast "ROOT_SPELL" ROOT_GEM
/call SwapItem "Demi Lich Skullcap" Head       
/call BackOffFromTarget 60
/call MyCast "LIFE_DOT" LIFE_DOT_GEM
/call SwapItem "Deathcaller's Skullcap" head
       
/varset reskull
   } else /if (${Target.ID} && ${reroot}) {
       /call BackOffFromTarget 60
       /pet attack
   }
   /call AlwaysCheck
   /if (${Macro.Return}) /goto :NewTarget

   /if (${Target.ID} && ${Target.Type.Equal[NPC]}) {
       /call Mount
       /goto :fartAround
   }
   /call AlwaysCheck
   /if (${Zone.Name.Find[forgotten]}!=NULL && ${Macro.Return}==0) /call DoTheLooting
   /varset TargetID
   /goto :NewTarget
/return

| AlwaysCheck - health, aggro, zone, etc. ALSO CALLED FROM EVENTS.
| "/call AlwaysCheck nocast" to never perform casting (eg event calls)
| 0=no problem; 1=panic
Sub AlwaysCheck(string casting)
   /doevents Zoned
   /if (${Cursor.ID}) /autoinventory
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       /call NoLich
       /if (${Me.PctHPs}<=20) {
           /keypress instant_camp
           /endmacro
       }
       /if (${Spawn[${TargetID}].Type.Equal[NPC]} && ${Zone.Name.Find[forgotten]}!=0) {
           /call BailOut
           /return 1
       }
   }
   /if (${Me.PctMana}>90 || ${Me.PctHPs}<50) /call NoLich
   /if (${casting.Equal[nocast]}==FALSE) {
       /if (!${dangerFlag} && ${Me.Pet.ID}!=0 && ${Me.PetBuff[PET_HASTE]}==0) /call MyCast "PET_HASTE" PET_HASTE_GEM
       /if (${Me.PctMana}<90 && ${Me.Buff[LICH_SPELL].ID}==NULL && ${Me.PctHPs}>50) /call MyCast "LICH_SPELL" LICH_GEM
       /if (${FindItem[ROD_NAME].ID}!=0) /cast item "ROD_NAME"
   }
   /if (${Initialized} && ${weZoned}) {
       /declare zoneDelay timer 3m
       /varset weZoned FALSE
       /varset wayBlocked FALSE
       /doevents flush
       /if (${Zone.Name.Find[forgotten]}==NULL) {
           /if (${Zone.Name.Find[nedaria]}==NULL) {
:quit
               /dismount
               /camp desktop
               /endmacro
           }
:zoneIn
           /megawarp -670 1543 96
           /keypress back
           /keypress forward
           /delay 1
           /sit
           /if (${Me.PctHPs}<=50) {
               /popup Waiting for health>99%...
               /delay 5m ${Me.PctHPs}>99
           }
           /face fast loc 1543,-670
:zoning
           /delay 1s
           /click left 400 300
           /delay 5
           /click left 500 400
           /delay 5
           /click left 600 500
           /doevents Zoned
           /doevents Blocked
           /delay 1s ${weZoned}||${wayBlocked}
           /if (${wayBlocked}) /goto :quit

           /if (${weZoned}==FALSE && ${zoneDelay.Value}>0) /goto :zoning

           /if (${Zone.Name.Find[forgotten]}==NULL) /goto :quit

           /if (${Zone.Name.Find[knowledge]}!=0) /goto :quit

           /varset Initialized TRUE
           /return 1
       }
   }
/return 0

Sub NoLich
   /declare slot int local
   /varcalc slot ${Me.Buff[LICH_SPELL].ID}-1
   /if (${slot}>=0) /notify BuffWindow Buff${slot} leftmouseup
/return

Sub BailOut
   /dismount
   /attack off
   /megawarp s
   /delay 1
   /target npc a_harindi_guide
   |/megawarp -30 -827 -11
   /megawarp t
   /delay 2
   /face fast nolook
   /varset fightTimer 15s
:panic
   /say I am ready to leave!
   /delay 1
   /doevents Zoned
   /delay 5 ${weZoned}
   /if (${Me.PctHPs}<=20) {
       /keypress instant_camp
       /return
   }
   /if (${Zone.Name.Find[forgotten]}) {
       /keypress left
       /delay 1
       /keypress right
       /if (${Target.ID}) {
           /face fast nolook
       } else {
           /return
       }
       /if (${fightTimer.Value}>0) /goto :panic
       /keypress instant_camp
   }
/return

|----------------------------------------------------------------------------
|SUB: MainAttack - Handles the kiting/killing
|----------------------------------------------------------------------------
Sub MainAttack
:attackAgain
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /doevents
   /target id ${TargetID}
   DELAY 1
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /call AlwaysCheck
   /if (${Macro.Return}) /return

   /if (${Target.ID}==${Me.Pet.ID}) {
       /assist
       DELAY 3 ${Target.ID}!=${Me.Pet.ID}
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /if (${Me.PctHPs}>ALARM_HEALTH_BELOW_PCT && ${Me.Buff[LICH_SPELL].ID}==NULL) {
       DEBUG_3 Me.Buff[LICH_SPELL].ID==${Me.Buff[LICH_SPELL].ID}
       /call MyCast "LICH_SPELL" LICH_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /face
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /call WarpCloser
   /if (${Me.Sitting}==FALSE && ${Me.Mount.ID}==0) /call Mount
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /if (${fightTimer.Value}==0 && ${Target.PctHPs}>20) {
       /call DoTheFear
       /call MyCast "LIFE_DOT" LIFE_DOT_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}>0 && ${Target.Type.NotEqual[Corpse]}) /goto :attackAgain

:looties
   /call AlwaysCheck
   /if (${Zone.Name.Find[forgotten]}==NULL || ${Macro.Return}) /return

   /call DoTheLooting
   /varset TargetID
/return

|----------------------------------------------------------------------------
|SUB: DowntimeWork - Between fight rebuffs, etc.
|----------------------------------------------------------------------------
Sub DowntimeWork
   | Check if we are low on mana or health. Heal or sit down if low
   /call CheckMana
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 1. Mana Checked

   | Make sure all buffs on self are up
   /call MaintainSelfBuffs
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 4. Buffs Checked

   /call AlwaysCheck
   /if (${Macro.Return}) /return 0

   /memspellset dots
   /delay 1m ${Window[SpellBookWnd]}==FALSE
/return 1

|----------------------------------------------------------------------------
|SUB: AcquireTarget - Finding a target 0=success; 1=n/a
|----------------------------------------------------------------------------
Sub AcquireTarget
   /declare s int local
   /declare lvl int local
   /declare spn int local
   /squelch /target clear
   /varset TargetID
   /varset TargetName
:scan
   /varcalc s ${s}+1
   /varset spn ${LastSpawn[${s}].ID}
   /if (${spn}==0) /goto :acquired

   /if ((${Spawn[${spn}].CleanName.Find[squeaking]} || ${Spawn[${spn}].CleanName.Find[squeaking]} || ${Spawn[${spn}].CleanName.Find[reject]}) && ${Spawn[${spn}].Type.Equal[Corpse]}==FALSE && ${Spawn[${spn}].Level}>=MIN_MOB_LVL && ${Spawn[${spn}].Level}<=MAX_MOB_LVL && ${Spawn[${spn}].Level}>${lvl}) {
       /if (${Spawn[${spn}].Y}<=-265 && ${Spawn[${spn}].Y}>=-429 && ${Spawn[${spn}].X}>=74 && ${Spawn[${spn}].X}<=298 && ${Spawn[${spn}].Level}>=47) {
           DEBUG_1 Ignoring mob in add area: ${Spawn[${spn}].CleanName}(L${Spawn[${spn}].Level})
       } else {
           /varset lvl ${Spawn[${spn}].Level}
           /varset TargetID ${Spawn[${spn}].ID}
       }
   }
/goto :scan

:acquired
   /if (${TargetID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}!=0
       /if (${Target.CleanName.Find[${Me.CleanName}]}) {
           DEBUG_1 WTF? I got targeted!
           /return 1
       }
       /varset TargetID ${Target.ID}
       /varset TargetName ${Target.CleanName}
       /popup ${TargetName} (L${Target.Level})
       DEBUG_1 ${TargetName} (L${Target.Level})
       /return 0
   }
   DEBUG_3 AcquireTarget FAILED!
   /popup Waiting for mobs in range MIN_MOB_LVL-MAX_MOB_LVL...
   /call Mount
   /delay 5s
/return 1

| Find the closest WP in line-of-sight to our target
Sub FindWP
   /declare wp int local
   /declare Y int local
   /declare X int local
   /declare Z int local
   /declare dist float local 10000
   /varset wpY
   /varset wpX
   /varset wpZ
   /for wp 1 to WP_SIZE
       /varset Y ${waypoint[${wp},Y_COORD]}
       /varset X ${waypoint[${wp},X_COORD]}
       /varset Z ${waypoint[${wp},Z_COORD]}
       /if (${LineOfSight[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}]} && ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}]}<${dist}) {
           /varset wpY ${Y}
           /varset wpX ${X}
           /varset wpZ ${Z}
           /varset dist ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}]}
       }
   /next wp
/return


|warp closer to target, via WP if mob, or direct otherwise.
Sub WarpCloser
   /call AlwaysCheck nocast
   /if (${Macro.Return}) /return

   /if (${Target.ID}==0 || ${Target.ID}==${Me.ID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}>0
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /return

   /if (${Target.Type.Equal[Pet]}) {
       /megawarp t
   } else {
       /if (${Me.Pet.ID}) /megawarp ${Me.Pet.X} ${Me.Pet.Y} ${Me.Pet.Z}
   }
   DELAY 1
   /if (${Target.ID}) /face fast nolook
/return

|warp away from target, via most distant WP
Sub WarpDistant
   /call AlwaysCheck nocast
   /if (${Macro.Return}) /return

   /if (${Target.ID}==0 || ${Target.ID}==${Me.ID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}>0
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /return

   /declare wp int
   /declare Y float
   /declare X float
   /declare Z float
   /declare dist float
   /for wp 1 to WP_SIZE
       /varset Y ${waypoint[${wp},Y_COORD]}
       /varset X ${waypoint[${wp},X_COORD]}
       /varset Z ${waypoint[${wp},Z_COORD]}
       /if (${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}]}>${dist}) {
           /varset wpY ${Y}
           /varset wpX ${X}
           /varset wpZ ${Z}
           /varset dist ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}]}
       }
   /next wp
   /if (${wpY}!=0||${wpX}!=0||${wpZ}!=0) /megawarp ${wpX} ${wpY} ${wpZ}
   DELAY 1
   /if (${Target.ID}) /face fast nolook
/return

| DO NOT CALL DELAY FROM EVENTS!
| Parameters: delay timer setting + early exit condition
Sub Delay(string delayTime, string exitCond)
   /declare tmr timer local ${delayTime}
:moreDelay
   /call AlwaysCheck nocast
   /if (${tmr.Value}==0) /return

   /if (${exitCond}) {
       |DEBUG_3 Early exit on condition: ${exitCond.Right[-1]}
       /return
   }
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Delay abort, ${tmr.Value} ticks left, LOW HEALTH!
       /return
   }
   /delay 1 ${exitCond}
   |/if (${Math.Calc[${tmr.Value}%10].Int}==0) DEBUG_3 /delay ${tmr.Value} ${exitCond.Right[-1]}:${exitCond}
   /doevents Skinhit
   /doevents Miss1
   /doevents ImHit
   /doevents Retry
   /doevents Abort
   /doevents OutOfRange
   /doevents NoLOS
   /doevents Standing
   /doevents OOR
   /doevents Zoned
   /doevents PetAggro
   /doevents NoMount
   /doevents NoLich
  | /doevents Stunned
   /doevents RootGone
   /doevents DOT1Gone
   /doevents DOT2Gone
   /doevents DOT3Gone
   /doevents Snaregone
   /doevents Skullcapgone
   /if (${Target.Type.Equal[NPC]}) /face
   /goto :moreDelay
/return

Sub MyCast(string spname, string gname)
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Corpse.Open}) /notify LootWnd DoneButton leftmouseup
   /varset spellName ${spname}
   /call DoCast ${gname}
   /doevents
   /if (${Target.ID}!=${TargetID} && ${TargetID}!=0) {
       /target id ${TargetID}
       DELAY 3 ${Target.ID}==${TargetID}
   }
   /if (${Target.Type.Equal[NPC]}) /face fast
/return

| Cast something with status return and event processing
| assumes outer variable spellName and TargetID
Sub DoCast(string gem)
   /declare castX float local ${Me.X}
   /declare castY float local ${Me.Y}
   /declare castZ float local ${Me.Z}
   /declare castTime int
   /declare tartype string local ${Spell[${spellName}].TargetType}
   /if (${gem.Equal[item]}) /varset tartype ${FindItem[=${spellName}].Spell.TargetType}
:recast
   /if (${tartype.Equal[Pet]} && ${Target.ID}!=${Me.Pet.ID}) {
       /if (${Me.Pet.ID}==0) /return
       /target id ${Me.Pet.ID}
       /delay 1
   } else /if (${tartype.Equal[Self]} && ${Target.ID}!=${Me.ID}) {
       /target myself
       /delay 1
   } else /if (${Target.Type.Equal[NPC]} && ${Target.ID}!=${TargetID}) {
       /target id ${TargetID}
       /delay 1
   }
   /if (${Target.Type.Equal[NPC]} && ${Target.PctHPs}<8) {
       DEBUG_3 Confusing/low health target (${Target.PctHPs}%)
       /return
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) {
       DEBUG_3 Target${Target.CleanName}(${Target.ID}) Dead?
       /return
   }
   /if (${Target.ID}!=${Me.ID}) {
       /face fast
       /if (!${LineOfSight[${Me.Y},${Me.X},${Me.Z}:${Target.Y},${Target.X},${Target.Z}]}) {
           /if (${dangerFlag} && ${reroot}) {
               /call BackOffFromTarget 60
               /delay 1
           } else {
               /call WarpCloser
               /delay 1
           }
       }
   }
   /if (${gem.Equal[item]}) {
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast item "${spellName}"
   } else {
       /if (${Me.Gem[${spellName}]}==NULL) {
           /memspell ${gem} "${spellName}"
           DEBUG_3 book:${Window[SpellBookWnd]}; ${spellName}:${Me.SpellReady[${spellName}]}
           /delay 10s ${Window[SpellBookWnd]}==FALSE
           DELAY 15s ${Me.SpellReady[${spellName}]}
       } else {
           DEBUG_3 ${spellName}:${Me.SpellReady[${spellName}]}
           /if (!${Me.SpellReady[${spellName}]}) {
               DELAY 15s ${Me.SpellReady[${spellName}]}
           }
       }
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast "${spellName}"
   }
   /varset result CAST_IN_PROGRESS
   DELAY 2
   /doevents
   /if (${result}==CAST_IN_PROGRESS && ${Me.Casting.ID}==0) /goto :recast

   /if (!${dangerFlag}) {
       DELAY 30s ${Me.Casting.ID}==NULL
       /delay 1
       /doevents
   } else {
       /delay 1
       /varset castX ${Me.X}
       /varset castY ${Me.Y}
       /varset castZ ${Me.Z}
       /if (${reroot} && ${Target.Type.Equal[NPC]}) {
           /delay 4
           /call WarpDistant
       }
       /varcalc castTime ${Math.Calc[${Me.Casting.MyCastTime}*10].Int}-19
       | Hard code 9s delay for item, assume it is skullcap.
       /if (${gem.Equal[item]}) /varset castTime 98
       /delay ${castTime} ${Me.Casting.ID}==0
       /megawarp ${castX} ${castY} ${castZ}
       /face fast nolook
       /delay 3s ${Me.Casting.ID}==0
       /delay 1
       /doevents
       /if (${reroot} && ${Target.Type.Equal[NPC]}) {
           /call WarpDistant
       } else {
           /call BackOffFromTarget 60
       }
   }
   /if (${result}==CAST_IN_PROGRESS) /varset result CAST_SUCCESS
   DEBUG_3 Casting of ${spellName} complete, result=${result}
   /if (${result}==CAST_OUTOFRANGE || ${result}==CAST_CANNOTSEE) {
       /if (!${dangerFlag} || !${reroot}) /call WarpCloser
       /goto :recast
   } else /if (${result}==CAST_RETRY) {
       /if (!${Me.SpellReady[${spellName}]}) {
        /varcalc result ${Spell[${spellName}].RecoveryTime}*10
           DELAY ${result} ${Me.SpellReady[${spellName}]}
       }
       /goto :recast
   }
/return

Sub Mount
   /if (${mountFlag}) {
       /if (${InvSlot[ammo].Item.Name.Find[Drum]}!=NULL && ${Me.Buff[Summon Drogmor].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else /if (${InvSlot[ammo].Item.Name.Find[Bridle]}!=NULL && ${Me.Buff[Summon Horse].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else {
           /if (!${Me.Sitting}) /sit
       }
   } else {
       /if (!${Me.Sitting}) /sit
   }
/return

|----------------------------------------------------------------------------
|SUB: CheckMana 0= need more med; 1=mana ok
| Now with histeresis - exit condition is above entry condition.
|----------------------------------------------------------------------------
Sub CheckMana
   /declare exitMana int local
   /declare exitHealth int local
   /varcalc exitMana MIN_MANA_BEFORE_MEDITATE+80
   /varcalc exitHealth ALARM_HEALTH_BELOW_PCT+70
   |Meditate?
   /if (${Me.PctMana}<MIN_MANA_BEFORE_MEDITATE || ${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Meditating.
       /popup Meditating...
       /call Mount
       /declare i int local
       /if ( ${Target.ID} ) /squelch /target clear
       /for i 1 to 10
           DELAY 1s
           /if ( ${Target.ID} ) /return 1
       /next i
       /if ( ${Me.PctMana}<${exitMana} || ${Me.PctHPs}<${exitHealth} ) /return 0
       DEBUG_2 Mana/health OK now.
   }
/return 1

|----------------------------------------------------------------------------
|SUB: MaintainSelfBuffs - Keep buffs up
| 0=still buffing; 1=all done
|----------------------------------------------------------------------------
Sub MaintainSelfBuffs
   /declare iCount int local
   /declare t string local
   /for iCount 1 to ${MyBuffs.Size}
       /call SplitString tmp_tmp ${MyBuffs[${iCount}]} "|"
       /varset t ${Me.Buff[${tmp_tmp[1]}]}
       /if ( ${t.Equal[NULL]} ) {
           /if ( !${Target.ID}!=${Me.ID} ) {
               /echo buffing
               /target myself
               DELAY 1
           }
           |Cast with gemselection or default
           /if ( ${tmp_tmp.Size}>1 ) {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}" ${tmp_tmp[2]}
               /call MyCast "${tmp_tmp[1]}" ${tmp_tmp[2]}
           } else {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}"
               /call MyCast "${tmp_tmp[1]}" 8
           }
           |Return to top - so we dont keep buffing if being attacked
           /return 0
       }
   /next iCount
/return 1

| Back off from current target so many units.
| Finds first line of sight on a horizontal, vertical, or
| diagonals that are at least as distant as desired.
Sub BackOffFromTarget(float dist)
   /declare by float local ${Target.Y}
   /declare bx float local ${Target.X}
   /varcalc by ${by}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff

   /varset by ${Target.Y}
   /varcalc bx ${bx}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff

   /varcalc by ${by}+${dist}
   /varset bx ${Target.X}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff

   /varset by ${Target.Y}
   /varcalc bx ${bx}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff

   /varcalc by ${by}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff

   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff

   /varcalc by ${Target.Y}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff

   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${Target.Z}]}) /goto :backoff

   /face fast
   /keypress forward
   /delay 3s ${Target.Distance}>=${dist}
   /keypress forward
   /face fast
   /return
:backoff
   /megawarp ${bx} ${by} ${Target.Z}
   /delay 1
   /if (${Target.ID}) /face fast nolook
/return

|----------------------------------------------------------------------------
|SUB: DoTheLooting
|----------------------------------------------------------------------------
Sub DoTheLooting
   /if (!${Defined[looted]}) /declare looted bool outer
   /target id ${TargetID}
   DELAY 1
   DEBUG_1 Going to loot
   DEBUG_3 DoTheLooting Target: ${Target.CleanName}, ID:${Target.ID}
   /megawarp t
   DELAY 1
   /loot
   /varset looted FALSE
   DELAY 6s (${Corpse.Open}&&${looted})
   /call LootMob
   /notify LootWnd DoneButton leftmouseup
   DELAY 1
   /doevents
   /declare xp int local
   /declare pp int local
   /declare level float local ${Me.Level}
   /varcalc level ${level}+${Math.Calc[${Me.Exp}/330.0].Milli}
   /varcalc xp ${Me.Exp}-${startingXP}
   /if (${xp}<0) /varcalc xp ${xp}+330
   /varcalc pp ${Me.Platinum}-${startingPP}
   /popup L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DEBUG_1 L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DELAY 5s
/return

|----------------------------------------------------------------------------
|SUB: LootMob
|----------------------------------------------------------------------------
Sub LootMob
   /if (!${Target.ID}) {
       /target npc corpse
       DELAY 1s ${Target.ID}>0
   }
   /loot
   DELAY 1s ${Corpse.Open}
   /cleanup
/return

|----------------------------------------------------------------------------
|SUB: SplitString - A generic string splitter.
|----------------------------------------------------------------------------
Sub SplitString(string varname, string inputstring, string splitter)
   /declare i int local
   /declare stringcnt int local

   |The normal splitter. Splitter string is just 1 in length.
   /if (${splitter.Length}==1) {
       /varcalc stringcnt ${inputstring.Count["${splitter}"]} + 1
       /if (!${Defined[${varname}]}) {
           /declare ${varname}[${stringcnt}] string outer
       } else {
           /deletevar ${varname}
           /declare ${varname}[${stringcnt}] string outer
       }
       /for i 1 to ${stringcnt}
           /varset ${varname}[${i}] ${inputstring.Token[${i},"${splitter}"]}
       /next i
   }
/return

|----------------------------------------------------------------------------
|SUB: DestroyCopper - Destroy all the copper
|----------------------------------------------------------------------------
Sub DestroyCopper
   /squelch /windowstate InventoryWindow open
   /shift /notify InventoryWindow IW_Money3 leftmouseup
   /delay 1s ${Cursor.ID}>0
   /destroy
   /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DestroySilver - Destroy all the silver
|----------------------------------------------------------------------------
Sub DestroySilver
   /squelch /windowstate InventoryWindow open
   /shift /notify InventoryWindow IW_Money2 leftmouseup
   /delay 1s ${Cursor.ID}>0
   /destroy
   /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DoTheFear - Fear target
|----------------------------------------------------------------------------
Sub DoTheFear
   /if ( ${Me.PctMana}>10 && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}>24) {
       /call MyCast "FEAR_SPELL" FEAR_GEM
       /varset fightTimer 31s
   }
/return

Sub Event_fear
   DEBUG_2 Fear me!
   /call DoTheFear
/return

Sub Event_Miss1
   /echo misses
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
   /delay 1
/call BackOffFromTarget 90
/return

Sub Event_Skinhit
   /echo skinhit
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
/delay 1   
/call BackOffFromTarget 90
/return

Sub Event_ImHit
   /Echo i m hit
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
   /delay 1
/call BackOffFromTarget 80
/return

Sub Event_Retry
   /delay 2
   /varset result CAST_RETRY
/return

Sub Event_Abort
   /varset result CAST_ABORT
/return

Sub Event_OutOfRange
   /varset result CAST_OUTOFRANGE
/return

Sub Event_NoLOS
   /varset result CAST_CANNOTSEE
/return

Sub Event_Standing
   /stand
   /varset result CAST_RETRY
/return

Sub Event_OOR
   /megawarp t
   /delay 2
   /loot
   /delay 3
   /delay 3s ${Corpse.Open}
   /doevents OOR
/return

Sub Event_Blocked
   /varset wayBlocked TRUE
/return

Sub Event_Zoned
   /varset weZoned TRUE
/call BackOffFromTarget 60
/return

Sub Event_PetAggro
   /target id ${Me.Pet.ID}
   /megawarp t
   /delay 1
   /assist
   /delay 1
/return

Sub Event_NoMount
   /varset mountFlag FALSE
/return

Sub Event_NoLich
   /varset mountFlag FALSE
   /dismount
/return

Sub Event_Stunned
:gdStunned
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /delay 1
   /if (${Me.Stunned}) /goto :gdStunned

   /varset result CAST_RETRY
/return

Sub Event_Invited(heard,string who)
   /if (${who.Equal[MY_PARTNER]}) {
       /invite
   } else {
       /disband
   }
/return

|----------------------------------------------------------------------------
|SUB: Root Gone
|----------------------------------------------------------------------------
Sub Event_RootGone
   DEBUG_2 Root gone.
   /varset reroot TRUE
   /varset dangerFlag TRUE
/return

|----------------------------------------------------------------------------
|SUB: DOT1Gone
|----------------------------------------------------------------------------
Sub Event_DOT1Gone
   DEBUG_2 SPLURT_DOT gone.
   /varset redot1 TRUE
/return

|----------------------------------------------------------------------------
|SUB: DOT2Gone
|----------------------------------------------------------------------------
Sub Event_DOT2Gone
   DEBUG_2 HEAT_DOT gone.
   /varset redot2 TRUE
/return

|----------------------------------------------------------------------------
|SUB: DOT3Gone
|----------------------------------------------------------------------------
Sub Event_DOT3Gone
   DEBUG_2 DISEASE_DOT gone.
   /varset redot3 TRUE
/return

|----------------------------------------------------------------------------
|SUB: SKULLCAPGONE
|----------------------------------------------------------------------------
Sub Event_Skullcapgone
   DEBUG_2 LIFE_DOT gone.
   /varset reskull TRUE
/return

Sub Event_Snaregone
DEBUG_2 Root gone.
   /varset reroot TRUE
   /varset dangerFlag TRUE
/return

Sub Event_Exp
   /varset AAExp ${Math.Calc[${Me.PctAAExp}-${AAExp}]}
   /varset Exper ${Math.Calc[${Me.PctExp}-${Exper}]}
   /varset LDRExp ${Math.Calc[${Me.PctGroupLeaderExp}-${LDRExp}]}
   /echo EXP: ${Exper} (${Me.PctExp}%) - AAXP: ${AAExp} (${Me.PctAAExp}%) - LDRXP: ${LDRExp} (${Me.PctGroupLeaderExp})
   /popup ${Exper} (${Me.PctExp}%) - AAXP: ${AAExp} (${Me.PctAAExp}%) - LDRXP: ${LDRExp} (${Me.PctGroupLeaderExp})
   /varset Exper ${Me.PctExp}
   /varset AAExp ${Me.PctAAExp}
   /varset LDRExp ${Me.PctGroupLeaderExp}
/return

Sub Event_Exp2
   /varset AAExp ${Math.Calc[${Me.PctAAExp}-${AAExp}]}
   /varset Exper ${Math.Calc[${Me.PctExp}-${Exper}]}
   /varset LDRExp ${Math.Calc[${Me.PctGroupLeaderExp}-${LDRExp}]}
   /echo EXP: ${Exper} (${Me.PctExp}%) - AAXP: ${AAExp} (${Me.PctAAExp}%)
   /popup ${Exper} (${Me.PctExp}%) - AAXP: ${AAExp} (${Me.PctAAExp}%)
   /varset Exper ${Me.PctExp}
   /varset AAExp ${Me.PctAAExp}
   /varset LDRExp ${Me.PctGroupLeaderExp}
/return

Sub SwapItem(string itemName,string slotName) 
   /if ( ${InvSlot[${slotName}].Item.Name.Equal[${itemName}]} ) /return 
   /declare slotID int local 
   /declare oldSlotID int local 
   /declare oldItem string local 
   /declare i int local 
   /varset slotID ${InvSlot[${slotName}].ID}           | slotID = slot you're swapping item to 
   /varset oldSlotID ${FindItem[${itemName}].InvSlot.ID} | oldSlotID = slot the item was originally in 
   /varset oldItem ${InvSlot[${slotName}].Item.Name}     | oldItem = name of item in the slot you're swapping WITH 
   /if ( !${slotID} ) { 
      /echo Invalid slot name: ${slotName} 
      /return 
   } 
   /if ( !${oldSlotID} ) { 
      /echo Could not find item ${itemName} 
      /return 
   } 
:auto_inv 
   /if ( ${Cursor.ID} && !${Cursor.Name.Equal[${itemName}]} ) { 
      /if ( ${Cursor.Container} ) { 
         /for i 1 to 8 
            /if ( !${InvSlot[pack${i}].Item.Container} ) { 
               /nomodkey /itemnotify pack${i} leftmouseup 
            } 
         /next i 
      } else { 
         /autoinventory 
      } 
      /goto :auto_inv 
   } 
    

:pick_up_item 
 | if the item is in a bag and it's not open, then open it! 
   /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 

 | if the slot you're putting it in is inside a bag and it's not open, then open it! 
   /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 

 | ok.. pick up the item now! 
   /squelch /nomodkey /shiftkey /itemnotify ${InvSlot[${oldSlotID}]} leftmouseup 

 | if item isn't on your cursor, try again! 
   /if ( !${Cursor.Name.Equal[${itemName}]} ) { 
      /if ( ${Cursor.ID} && !${Cursor.Container} ) /autoinventory 
      /goto :pick_up_item 
   } 
:exchange_items 
   /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
   /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 

 | put the item in the new slot, and pick up whatever item was there 
   /squelch /nomodkey /shiftkey /itemnotify ${slotID} leftmouseup 

 | if it didnt get exchanged, try again! 
   /if ( ${Cursor.ID} && !${Cursor.Name.Equal[${oldItem}]} && !${Cursor.Name.Equal[${itemName}]} && !${Cursor.Container} ) /autoinventory 
   /if ( !${InvSlot[${slotID}].Item.Name.Equal[${itemName}]} ) /goto :exchange_items 
:drop_item 
   /if ( !${Cursor.Container} || ( ${InvSlot[${oldSlotID}]}<30 && ${InvSlot[${oldSlotID}]}>=22 ) ) { 
      /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
      /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 
      /squelch /nomodkey /itemnotify ${oldSlotID} leftmouseup 
      /if ( ${Cursor.ID} ) { 
         /if ( !${Cursor.Name.Equal[${oldItem}]} ) /autoinventory 
         /goto :drop_item 
      } 
   } 
:close_pack 
   /if ( ${InvSlot[${oldSlotID}].Pack} && ${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} && ( ${Cursor.Name.Equal[${itemName}]} || ${FindItem[${itemName}].ID} ) ) { 
      /squelch /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
      /goto :close_pack 
   } 
   /if ( ${InvSlot[${slotID}].Pack} && ${Window[${InvSlot[${slotID}].Pack.Name}].Open} && ( ${Cursor.Name.Equal[${itemName}]} || ${FindItem[${itemName}].ID} ) ) { 
      /squelch /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 
      /goto :close_pack 
   } 
/return
 
P.S all of this macros assume you start on the horse with Noaccel docrack on, and nostun on.
 
Sooo...since Mandrack makes this seem so easy, I feel like a retard not being able to get it going. I'm trying to use the Root/Rot version. I have gone through and edited all of my spells, etc. When I start the macro, I get the following:

1. Mana Checked
4. Buffs Checked
ignoring mob in add area: a squeaking rat(L65)
more spams of ignoring mob 7 times
a squeaking rat(L65)

and then I stay in the same spot and the above just spams over and ovet untill I end the macro.

any thoughts? below is a copy of my edited version.
Rich (BB code):
| necro666.mac v2.2, Mandrack
|Stand on your horse and be inside the forgotten halls to start this macro.
| Author : Zornecro, borrowed from wolf5 and mandrack
| 
| Useage : /macro necro666
| Description : This macro will root dot mobs of
| The Forgotten Halls. It assumes you have an instance
| and are inside already.
|
| Mandrack edition
|
| 
|------------------------------------------------------------------------------
#turbo 40
|#define MY_PARTNER NameHERE
#define MIN_MOB_LVL 61
#define MAX_MOB_LVL 70


#define CAST_SUCCESS 0
#define CAST_OUTOFRANGE 1
#define CAST_CANNOTSEE 2
#define CAST_RETRY 3
#define CAST_IN_PROGRESS 4
#define CAST_ABORT -1

#define DELAY "/noparse /call Delay"

#define ROOT_SPELL "Petrifying Earth"
#define SPLURT_SPELL "Horror"
#define HEAT_DOT "Funeral Pyre of Kelador"
#define DISEASE_DOT "Dark Plague"
#define POISON_DOT "Blood of Thule"
#event Exp "#*#party experience!!"
#event Exp2 "You gain experience!!"
#event Invited "#1# invites you to join a group."
#event Blocked "The wa!n not summon a mount#*#"
#event NoLich "You can not change into this form while on a mount."
#event OOR "You are too far away to loot that corpse."
#event Retry "Your spell fizzles!"
#event Retry "Your spell is interrupted."
#event Retry "You haven't recovered yet..."
#event Retry "Spell recovery time not yet met."
#event Retry "Your target resisted the #*#"
#event Abort "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event NoLOS "You cannot see your target."
|#event Stunned "You can't cast spells while stunned!"
|#event Stunned "You are stunned!"
#event Standing "You must be standing to cast a spell."
#event Standing "|${Me.CleanName}| has fallen to the ground."
#event Retry "Your gate is too unstable, and collapses."
#event Abort "Your target is immune to changes in its attack speed."
#event Retry "You are too distracted to cast a spell now!"
#event Zoned "You have entered #*#"
#event PetAggro "Your pet is the focus of something's attention."
#event RootGone "Your Petrifying Earth spell has worn off."
#event DOT1Gone "Your Dark Nightmare spell has worn off."
#event DOT2Gone "Your Pyre of Mori spell has worn off."
#event DOT3Gone "Your Chaos Plague spell has worn off."
#event DOT4Gone "Your Blood of Thule spell has worn off."
#event Skullcapgone "Your Morternum spell has worn off."
#event fear "Your fear spell has worn off."
#event Snaregone "The shadows release #*#The shadows release your mind. mind."
#event ImHit "|${Target.CleanName}|#*# YOU for#*#"
#event Skinhit "|${Target.CleanName}|#*# YOU, but YOUR magical skin absorbs the blow!"
#event Miss1 "|${Target.CleanName}|#*# YOU, but misses!"

|-- The normal debug - for normal play.
| Enable: "/echo", Disable: "/squelch /echo"
#define DEBUG_1 /echo
|-- Deeper debugging - enable when trying to find bugs.
#define DEBUG_2 "/echo"
|--  The Deepest debugging - will spam a lot.
#define DEBUG_3 "/echo"

|-- Destroys Silver if you have more than the given amount! 0=disable
#define DESTROY_SILVER_IF_ABOVE 1
|-- Destroys Copper if you have more than the given amount! 0=disable
#define DESTROY_COPPER_IF_ABOVE 1

|-- At what range do we send in pet?
#define INITIALIZE_ATTACK_RANGE 100

|-- What pet do we want?
#define PET_SPELL "Lost Soul"
|-- Favorite gem spot for the pet (1-8)
#define PET_GEM 6
|-- How far off should the pet be before we summon it?
#define MAX_PET_RANGE_BEFORE_SUMMON 800
#define SUMMON_SPELL "Ribbon of Empathy"
#define SUMMON_GEM item

| Change SPLURT_GEM to 0 if you lack it.
#define SPLURT_GEM 2
#define HEAT_DOT_GEM 3
#define DISEASE_DOT_GEM 4
#define POISON_DOT_GEM 5
#define ROOT_GEM 1
|-- Name of fear spell
|#define FEAR_SPELL "Trepidation"
|-- Favorite gem spot for the fear (1-8)
|#define FEAR_GEM 3

|-- How low on health should the pet be before we heal it (noncombat)
|#define HEAL_PET_BELOW_PCT 70
|-- Name of pet healing spell
|#define HEAL_PET_SPELL "Shadowbond"
|-- Favorite gem spot for the petheal (1-8)
|#define HEAL_PET_GEM 7
|#define PET_HASTE "Glyph of Darkness"
|#define PET_HASTE_GEM 6
#define LICH_SPELL "Seduction of Saryrn"
#define LICH_GEM 8
#define LIFE_DOT "Saryrn's Kiss"
#define LIFE_DOT_GEM 9
|#define ROD_NAME "Summoned: Modulating Rod"
#define SNARE_DOT "Embracing Darkness"
#define SNARE_DOT_GEM 6
|-- If your health gets below this lvl start /beep'ing and FD
#define ALARM_HEALTH_BELOW_PCT 40

|What is our feign death spell of choice? (Requires it be already mem'd, memorizing before 

feigning = death)
#define FEIGN_SPELL "Death Peace"
#define FEIGN_GEM 7

|-- What is the minimum mana I should have, wait if below
#define MIN_MANA_BEFORE_MEDITATE 90

|--How many waypoints exist on the kiting path.
#define WP_SIZE 37
#define Y_COORD 1
#define X_COORD 2
#define Z_COORD 3

|----------------------------------------------------------------------------
|SUB: Main - Declarations and Initialization
|----------------------------------------------------------------------------
Sub Main
   /declare Exper float outer
   /declare AAExp float outer
   /declare LDRExp float outer

   /varset Exper ${Me.PctExp}
   /varset AAExp ${Me.PctAAExp}
   /varset LDRExp ${Me.PctGroupLeaderExp}

   /declare reroot bool outer TRUE
   /declare redot1 bool outer TRUE
   /declare redot2 bool outer TRUE
   /declare redot3 bool outer TRUE
   /declare reskull bool outer TRUE
   /declare dangerFlag bool outer
   /declare spellName string outer
   /declare Initialized bool outer FALSE
   /declare weZoned bool outer FALSE
   /declare wayBlocked bool outer FALSE
   /declare mountFlag bool outer TRUE
   /declare result int outer
   /declare startingPP int outer ${Me.Platinum}
   /declare startingXP int outer ${Me.Exp}
   /declare wpY float outer
   /declare wpX float outer
   /declare wpZ float outer
   /declare waypoint[WP_SIZE,3] int outer
   /varset waypoint[1,Y_COORD] -598
   /varset waypoint[1,X_COORD] 101
   /varset waypoint[1,Z_COORD] 4
   /varset waypoint[2,Y_COORD] -596
   /varset waypoint[2,X_COORD] 108
   /varset waypoint[2,Z_COORD] 4
   /varset waypoint[3,Y_COORD] -597
   /varset waypoint[3,X_COORD] -40
   /varset waypoint[3,Z_COORD] 4
   /varset waypoint[4,Y_COORD] -556
   /varset waypoint[4,X_COORD] -50
   /varset waypoint[4,Z_COORD] 4
   /varset waypoint[5,Y_COORD] -556
   /varset waypoint[5,X_COORD] -160
   /varset waypoint[5,Z_COORD] 4
   /varset waypoint[6,Y_COORD] -473
   /varset waypoint[6,X_COORD] -41
   /varset waypoint[6,Z_COORD] 4
   /varset waypoint[7,Y_COORD] -398
   /varset waypoint[7,X_COORD] -45
   /varset waypoint[7,Z_COORD] 4
   /varset waypoint[8,Y_COORD] -402
   /varset waypoint[8,X_COORD] 1
   /varset waypoint[8,Z_COORD] 4
   /varset waypoint[9,Y_COORD] -329
   /varset waypoint[9,X_COORD] 0
   /varset waypoint[9,Z_COORD] 13
   /varset waypoint[10,Y_COORD] -596
   /varset waypoint[10,X_COORD] 157
   /varset waypoint[10,Z_COORD] 2
   /varset waypoint[11,Y_COORD] -600
   /varset waypoint[11,X_COORD] 198
   /varset waypoint[11,Z_COORD] 4
   /varset waypoint[12,Y_COORD] -721
   /varset waypoint[12,X_COORD] 45
   /varset waypoint[12,Z_COORD] -10
   /varset waypoint[13,Y_COORD] -664
   /varset waypoint[13,X_COORD] 45
   /varset waypoint[13,Z_COORD] -4
   /varset waypoint[14,Y_COORD] -635
   /varset waypoint[14,X_COORD] 45
   /varset waypoint[14,Z_COORD] 4
   /varset waypoint[15,Y_COORD] -814
   /varset waypoint[15,X_COORD] 45
   /varset waypoint[15,Z_COORD] -10
   /varset waypoint[16,Y_COORD] -814
   /varset waypoint[16,X_COORD] 190
   /varset waypoint[16,Z_COORD] -11
   /varset waypoint[17,Y_COORD] -814
   /varset waypoint[17,X_COORD] 335
   /varset waypoint[17,Z_COORD] -10
   /varset waypoint[18,Y_COORD] -814
   /varset waypoint[18,X_COORD] 488
   /varset waypoint[18,Z_COORD] -35
   /varset waypoint[19,Y_COORD] -473
   /varset waypoint[19,X_COORD] -6
   /varset waypoint[19,Z_COORD] 4
   /varset waypoint[20,Y_COORD] -473
   /varset waypoint[20,X_COORD] 20
   /varset waypoint[20,Z_COORD] -2
   /varset waypoint[21,Y_COORD] -473
   /varset waypoint[21,X_COORD] 56
   /varset waypoint[21,Z_COORD] -10
   /varset waypoint[22,Y_COORD] -473
   /varset waypoint[22,X_COORD] 135
   /varset waypoint[22,Z_COORD] -11
   /varset waypoint[23,Y_COORD] -405
   /varset waypoint[23,X_COORD] 135
   /varset waypoint[23,Z_COORD] -11
   /varset waypoint[24,Y_COORD] -405
   /varset waypoint[24,X_COORD] 93
   /varset waypoint[24,Z_COORD] -11
   /varset waypoint[25,Y_COORD] -290
   /varset waypoint[25,X_COORD] 93
   /varset waypoint[25,Z_COORD] -11
   /varset waypoint[26,Y_COORD] -290
   /varset waypoint[26,X_COORD] 183
   /varset waypoint[26,Z_COORD] -11
   /varset waypoint[27,Y_COORD] -290
   /varset waypoint[27,X_COORD] 275
   /varset waypoint[27,Z_COORD] -11
   /varset waypoint[28,Y_COORD] -409
   /varset waypoint[28,X_COORD] 275
   /varset waypoint[28,Z_COORD] -11
   /varset waypoint[29,Y_COORD] -397
   /varset waypoint[29,X_COORD] -40
   /varset waypoint[29,Z_COORD] 4
   /varset waypoint[30,Y_COORD] -397
   /varset waypoint[30,X_COORD] 0
   /varset waypoint[30,Z_COORD] 4
   /varset waypoint[31,Y_COORD] -337
   /varset waypoint[31,X_COORD] 1
   /varset waypoint[31,Z_COORD] 12
   /varset waypoint[32,Y_COORD] -235
   /varset waypoint[32,X_COORD] 0
   /varset waypoint[32,Z_COORD] 20
   /varset waypoint[33,Y_COORD] -167
   /varset waypoint[33,X_COORD] 0
   /varset waypoint[33,Z_COORD] 20
   /varset waypoint[34,Y_COORD] -127
   /varset waypoint[34,X_COORD] 0
   /varset waypoint[34,Z_COORD] 14
   /varset waypoint[35,Y_COORD] -86
   /varset waypoint[35,X_COORD] 0
   /varset waypoint[35,Z_COORD] 4
   /varset waypoint[36,Y_COORD] 4
   /varset waypoint[36,X_COORD] 0
   /varset waypoint[36,Z_COORD] -6
   /varset waypoint[37,Y_COORD] 53
   /varset waypoint[37,X_COORD] 0
   /varset waypoint[37,Z_COORD] 4

   |Buffs to be kept up on self (max 15) - "Buff" or "Buff|GemSlot"
   /declare MyBuffs[2] string outer
/varset MyBuffs[1] "Shield of Maelin|7"
/varset MyBuffs[2] "Force Shield|4"


   DEBUG_1 Starting macro
   |Group of locked target data
   /declare TargetName string outer
   /declare TargetID int outer
   /declare fightTimer timer outer

   /call MainSub
   DEBUG_1 Exited normally!
/return


|----------------------------------------------------------------------------
|SUB: MainSub - The main sub
|----------------------------------------------------------------------------
Sub MainSub
   |The main loop. After an attack we go here to acquire a new target
   /cleanup
   /if (${Zone.Name.Left[9].NotEqual[Forgotten]}) /varset weZoned TRUE
   /varset Initialized TRUE
:NewTarget
   /varset TargetID
   /if (${Corpse.Open}) {
       /notify LootWnd DoneButton leftmouseup
       /cleanup
   }
   /call AlwaysCheck
   /if (${Macro.Return}) /return

   /call DowntimeWork
   /if (${Macro.Return}==0) /goto :NewTarget

   /call AcquireTarget
   /if (${Macro.Return}) /goto :NewTarget

   ||| This is new code for Root Rot with Warp |||
   /call BackOffFromTarget 60
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /goto :NewTarget

   /if (${Spell[HEAT_DOT_GEM].Name.NotEqual[HEAT_DOT]}) {
       /memspellset dots
       /delay 1m ${Window[SpellBookWnd]}==FALSE
   }
   /doevents flush
   /varset reroot TRUE
   /varset redot1 TRUE
   /varset redot2 TRUE
   /varset redot3 TRUE
   /varset reskull TRUE
   /call BackOffFromTarget 60
:fartAround

DELAY 1 ${Target.ID}!=0&&${Target.Type.Equal[NPC]}
   /doevents
   /call AlwaysCheck
   /if (${Macro.Return}) /goto :NewTarget

   /if (${reroot} && ${Target.PctHPs}>1) {
    /call BackOffFromTarget 60    
/call MyCast "ROOT_SPELL" ROOT_GEM
       /call BackOffFromTarget 60
/varset reroot
       /varset dangerFlag
       /goto :fartAround
   } 

/if (${redot1} && ${reroot}!=0 && ${Target.PctHPs}>1) {
/call BackOffFromTarget 60
/call MyCast "SNARE_DOT" SNARE_DOT_GEM
/if (${Target.PctHPs}>16) /call MyCast "SPLURT_SPELL" SPLURT_GEM
          /varset redot1
   } else /if (${redot2} && ${Target.PctHPs}>1) {
      	/call BackOffFromTarget 60
	/call MyCast "ROOT_SPELL" ROOT_GEM
	/call BackOffFromTarget 60
	/call MyCast "HEAT_DOT" HEAT_DOT_GEM
        /call BackOffFromTarget 60
	/varset redot2
   } else /if (${redot3} && ${Target.PctHPs}>25) {
/call BackOffFromTarget 60       
/call MyCast "DISEASE_DOT" DISEASE_DOT_GEM
       /varset redot3
   } else /if (${reskull} && ${reroot}!=0 ${Target.PctHPs}>1) {
/call MyCast "ROOT_SPELL" ROOT_GEM
/call MyCast "LIFE_DOT" LIFE_DOT_GEM      
/call BackOffFromTarget 60
/call MyCast "LIFE_DOT" LIFE_DOT_GEM
/call SwapItem "Deathcaller's Skullcap" head
       
/varset reskull
   } else /if (${Target.ID} && ${reroot}) {
       /call BackOffFromTarget 60
       /pet attack
   }
   /call AlwaysCheck
   /if (${Macro.Return}) /goto :NewTarget

   /if (${Target.ID} && ${Target.Type.Equal[NPC]}) {
       /call Mount
       /goto :fartAround
   }
   /call AlwaysCheck
   /if (${Zone.Name.Find[forgotten]}!=NULL && ${Macro.Return}==0) /call DoTheLooting
   /varset TargetID
   /goto :NewTarget
/return

| AlwaysCheck - health, aggro, zone, etc. ALSO CALLED FROM EVENTS.
| "/call AlwaysCheck nocast" to never perform casting (eg event calls)
| 0=no problem; 1=panic
Sub AlwaysCheck(string casting)
   /doevents Zoned
   /if (${Cursor.ID}) /autoinventory
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       /call NoLich
       /if (${Me.PctHPs}<=20) {
           /keypress instant_camp
           /endmacro
       }
       /if (${Spawn[${TargetID}].Type.Equal[NPC]} && ${Zone.Name.Find[forgotten]}!=0) {
           /call BailOut
           /return 1
       }
   }
   /if (${Me.PctMana}>90 || ${Me.PctHPs}<50) /call NoLich
   /if (${casting.Equal[nocast]}==FALSE) {
       /if (!${dangerFlag} && ${Me.Pet.ID}!=0 && ${Me.PetBuff[PET_HASTE]}==0) /call MyCast 

"PET_HASTE" PET_HASTE_GEM
       /if (${Me.PctMana}<90 && ${Me.Buff[LICH_SPELL].ID}==NULL && ${Me.PctHPs}>50) /call 

MyCast "LICH_SPELL" LICH_GEM
       /if (${FindItem[ROD_NAME].ID}!=0) /cast item "ROD_NAME"
   }
   /if (${Initialized} && ${weZoned}) {
       /declare zoneDelay timer 3m
       /varset weZoned FALSE
       /varset wayBlocked FALSE
       /doevents flush
       /if (${Zone.Name.Find[forgotten]}==NULL) {
           /if (${Zone.Name.Find[nedaria]}==NULL) {
:quit
               /dismount
               /camp desktop
               /endmacro
           }
:zoneIn
           /megawarp -670 1543 96
           /keypress back
           /keypress forward
           /delay 1
           /sit
           /if (${Me.PctHPs}<=50) {
               /popup Waiting for health>99%...
               /delay 5m ${Me.PctHPs}>99
           }
           /face fast loc 1543,-670
:zoning
           /delay 1s
           /click left 400 300
           /delay 5
           /click left 500 400
           /delay 5
           /click left 600 500
           /doevents Zoned
           /doevents Blocked
           /delay 1s ${weZoned}||${wayBlocked}
           /if (${wayBlocked}) /goto :quit

           /if (${weZoned}==FALSE && ${zoneDelay.Value}>0) /goto :zoning

           /if (${Zone.Name.Find[forgotten]}==NULL) /goto :quit

           /if (${Zone.Name.Find[knowledge]}!=0) /goto :quit

           /varset Initialized TRUE
           /return 1
       }
   }
/return 0

Sub NoLich
   /declare slot int local
   /varcalc slot ${Me.Buff[LICH_SPELL].ID}-1
   /if (${slot}>=0) /notify BuffWindow Buff${slot} leftmouseup
/return

Sub BailOut
   /dismount
   /attack off
   /megawarp s
   /delay 1
   /target npc a_harindi_guide
   |/megawarp -30 -827 -11
   /megawarp t
   /delay 2
   /face fast nolook
   /varset fightTimer 15s
:panic
   /say I am ready to leave!
   /delay 1
   /doevents Zoned
   /delay 5 ${weZoned}
   /if (${Me.PctHPs}<=20) {
       /keypress instant_camp
       /return
   }
   /if (${Zone.Name.Find[forgotten]}) {
       /keypress left
       /delay 1
       /keypress right
       /if (${Target.ID}) {
           /face fast nolook
       } else {
           /return
       }
       /if (${fightTimer.Value}>0) /goto :panic
       /keypress instant_camp
   }
/return

|----------------------------------------------------------------------------
|SUB: MainAttack - Handles the kiting/killing
|----------------------------------------------------------------------------
Sub MainAttack
:attackAgain
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /doevents
   /target id ${TargetID}
   DELAY 1
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /call AlwaysCheck
   /if (${Macro.Return}) /return

   /if (${Target.ID}==${Me.Pet.ID}) {
       /assist
       DELAY 3 ${Target.ID}!=${Me.Pet.ID}
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /if (${Me.PctHPs}>ALARM_HEALTH_BELOW_PCT && ${Me.Buff[LICH_SPELL].ID}==NULL) {
       DEBUG_3 Me.Buff[LICH_SPELL].ID==${Me.Buff[LICH_SPELL].ID}
       /call MyCast "LICH_SPELL" LICH_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /face
   /if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /call WarpCloser
   /if (${Me.Sitting}==FALSE && ${Me.Mount.ID}==0) /call Mount
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /if (${fightTimer.Value}==0 && ${Target.PctHPs}>20) {
       /call DoTheFear
       /call MyCast "LIFE_DOT" LIFE_DOT_GEM
   }
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /goto :looties

   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Target.ID}>0 && ${Target.Type.NotEqual[Corpse]}) /goto :attackAgain

:looties
   /call AlwaysCheck
   /if (${Zone.Name.Find[forgotten]}==NULL || ${Macro.Return}) /return

   /call DoTheLooting
   /varset TargetID
/return

|----------------------------------------------------------------------------
|SUB: DowntimeWork - Between fight rebuffs, etc.
|----------------------------------------------------------------------------
Sub DowntimeWork
   | Check if we are low on mana or health. Heal or sit down if low
   /call CheckMana
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 1. Mana Checked

   | Make sure all buffs on self are up
   /call MaintainSelfBuffs
   /if ( ${Macro.Return}==0 ) /return 0
   DEBUG_2 4. Buffs Checked

   /call AlwaysCheck
   /if (${Macro.Return}) /return 0

   /memspellset dots
   /delay 1m ${Window[SpellBookWnd]}==FALSE
/return 1

|----------------------------------------------------------------------------
|SUB: AcquireTarget - Finding a target 0=success; 1=n/a
|----------------------------------------------------------------------------
Sub AcquireTarget
   /declare s int local
   /declare lvl int local
   /declare spn int local
   /squelch /target clear
   /varset TargetID
   /varset TargetName
:scan
   /varcalc s ${s}+1
   /varset spn ${LastSpawn[${s}].ID}
   /if (${spn}==0) /goto :acquired

   /if ((${Spawn[${spn}].CleanName.Find[squeaking]} || 

${Spawn[${spn}].CleanName.Find[squeaking]} || ${Spawn[${spn}].CleanName.Find[reject]}) && 

${Spawn[${spn}].Type.Equal[Corpse]}==FALSE && ${Spawn[${spn}].Level}>=MIN_MOB_LVL && 

${Spawn[${spn}].Level}<=MAX_MOB_LVL && ${Spawn[${spn}].Level}>${lvl}) {
       /if (${Spawn[${spn}].Y}<=-265 && ${Spawn[${spn}].Y}>=-429 && ${Spawn[${spn}].X}>=74 && 

${Spawn[${spn}].X}<=298 && ${Spawn[${spn}].Level}>=47) {
           DEBUG_1 Ignoring mob in add area: 

${Spawn[${spn}].CleanName}(L${Spawn[${spn}].Level})
       } else {
           /varset lvl ${Spawn[${spn}].Level}
           /varset TargetID ${Spawn[${spn}].ID}
       }
   }
/goto :scan

:acquired
   /if (${TargetID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}!=0
       /if (${Target.CleanName.Find[${Me.CleanName}]}) {
           DEBUG_1 WTF? I got targeted!
           /return 1
       }
       /varset TargetID ${Target.ID}
       /varset TargetName ${Target.CleanName}
       /popup ${TargetName} (L${Target.Level})
       DEBUG_1 ${TargetName} (L${Target.Level})
       /return 0
   }
   DEBUG_3 AcquireTarget FAILED!
   /popup Waiting for mobs in range MIN_MOB_LVL-MAX_MOB_LVL...
   /call Mount
   /delay 5s
/return 1

| Find the closest WP in line-of-sight to our target
Sub FindWP
   /declare wp int local
   /declare Y int local
   /declare X int local
   /declare Z int local
   /declare dist float local 10000
   /varset wpY
   /varset wpX
   /varset wpZ
   /for wp 1 to WP_SIZE
       /varset Y ${waypoint[${wp},Y_COORD]}
       /varset X ${waypoint[${wp},X_COORD]}
       /varset Z ${waypoint[${wp},Z_COORD]}
       /if (${LineOfSight[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}  ]} && 

${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}  ]}<${dist}) {
           /varset wpY ${Y}
           /varset wpX ${X}
           /varset wpZ ${Z}
           /varset dist ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}  

]}
       }
   /next wp
/return


|warp closer to target, via WP if mob, or direct otherwise.
Sub WarpCloser
   /call AlwaysCheck nocast
   /if (${Macro.Return}) /return

   /if (${Target.ID}==0 || ${Target.ID}==${Me.ID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}>0
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /return

   /if (${Target.Type.Equal[Pet]}) {
       /hop target
   } else {
       /if (${Me.Pet.ID}) /hop ${Me.Pet.X} ${Me.Pet.Y} ${Me.Pet.Z}
   }
   DELAY 1
   /if (${Target.ID}) /face fast nolook
/return

|warp away from target, via most distant WP
Sub WarpDistant
   /call AlwaysCheck nocast
   /if (${Macro.Return}) /return

   /if (${Target.ID}==0 || ${Target.ID}==${Me.ID}) {
       /target id ${TargetID}
       DELAY 2 ${Target.ID}>0
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) /return

   /declare wp int
   /declare Y float
   /declare X float
   /declare Z float
   /declare dist float
   /for wp 1 to WP_SIZE
       /varset Y ${waypoint[${wp},Y_COORD]}
       /varset X ${waypoint[${wp},X_COORD]}
       /varset Z ${waypoint[${wp},Z_COORD]}
       /if (${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}  ]}>${dist}) {
           /varset wpY ${Y}
           /varset wpX ${X}
           /varset wpZ ${Z}
           /varset dist ${Math.Distance[${Y},${X},${Z}:${Target.Y},${Target.X},${Target.Z}  

]}
       }
   /next wp
   /if (${wpY}!=0||${wpX}!=0||${wpZ}!=0) /hop ${wpX} ${wpY} ${wpZ}
   DELAY 1
   /if (${Target.ID}) /face fast nolook
/return

| DO NOT CALL DELAY FROM EVENTS!
| Parameters: delay timer setting + early exit condition
Sub Delay(string delayTime, string exitCond)
   /declare tmr timer local ${delayTime}
:moreDelay
   /call AlwaysCheck nocast
   /if (${tmr.Value}==0) /return

   /if (${exitCond}) {
       |DEBUG_3 Early exit on condition: ${exitCond.Right[-1]}
       /return
   }
   /if (${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Delay abort, ${tmr.Value} ticks left, LOW HEALTH!
       /return
   }
   /delay 1 ${exitCond}
   |/if (${Math.Calc[${tmr.Value}%10].Int}==0) DEBUG_3 /delay ${tmr.Value} 

${exitCond.Right[-1]}:${exitCond}
   /doevents Skinhit
   /doevents Miss1
   /doevents ImHit
   /doevents Retry
   /doevents Abort
   /doevents OutOfRange
   /doevents NoLOS
   /doevents Standing
   /doevents OOR
   /doevents Zoned
   /doevents PetAggro
   /doevents NoMount
   /doevents NoLich
  | /doevents Stunned
   /doevents RootGone
   /doevents DOT1Gone
   /doevents DOT2Gone
   /doevents DOT3Gone
   /doevents Snaregone
   /doevents Skullcapgone
   /if (${Target.Type.Equal[NPC]}) /face
   /goto :moreDelay
/return

Sub MyCast(string spname, string gname)
   /if (${Zone.Name.Find[forgotten]}==NULL) /return

   /if (${Corpse.Open}) /notify LootWnd DoneButton leftmouseup
   /varset spellName ${spname}
   /call DoCast ${gname}
   /doevents
   /if (${Target.ID}!=${TargetID} && ${TargetID}!=0) {
       /target id ${TargetID}
       DELAY 3 ${Target.ID}==${TargetID}
   }
   /if (${Target.Type.Equal[NPC]}) /face fast
/return

| Cast something with status return and event processing
| assumes outer variable spellName and TargetID
Sub DoCast(string gem)
   /declare castX float local ${Me.X}
   /declare castY float local ${Me.Y}
   /declare castZ float local ${Me.Z}
   /declare castTime int
   /declare tartype string local ${Spell[${spellName}].TargetType}
   /if (${gem.Equal[item]}) /varset tartype ${FindItem[=${spellName}].Spell.TargetType}
:recast
   /if (${tartype.Equal[Pet]} && ${Target.ID}!=${Me.Pet.ID}) {
       /if (${Me.Pet.ID}==0) /return
       /target id ${Me.Pet.ID}
       /delay 1
   } else /if (${tartype.Equal[Self]} && ${Target.ID}!=${Me.ID}) {
       /target myself
       /delay 1
   } else /if (${Target.Type.Equal[NPC]} && ${Target.ID}!=${TargetID}) {
       /target id ${TargetID}
       /delay 1
   }
   /if (${Target.Type.Equal[NPC]} && ${Target.PctHPs}<8) {
       DEBUG_3 Confusing/low health target (${Target.PctHPs}%)
       /return
   }
   /if (${Target.ID}==0 || ${Target.Type.Equal[Corpse]}) {
       DEBUG_3 Target${Target.CleanName}(${Target.ID}) Dead?
       /return
   }
   /if (${Target.ID}!=${Me.ID}) {
       /face fast
       /if (!${LineOfSight[${Me.Y},${Me.X},${Me.Z}:${Target.Y},${Target.X},${  Target.Z}]}) {
           /if (${dangerFlag} && ${reroot}) {
               /call BackOffFromTarget 60
               /delay 1
           } else {
               /call WarpCloser
               /delay 1
           }
       }
   }
   /if (${gem.Equal[item]}) {
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast item "${spellName}"
   } else {
       /if (${Me.Gem[${spellName}]}==NULL) {
           /memspell ${gem} "${spellName}"
           DEBUG_3 book:${Window[SpellBookWnd]}; ${spellName}:${Me.SpellReady[${spellName}]}
           /delay 10s ${Window[SpellBookWnd]}==FALSE
           DELAY 15s ${Me.SpellReady[${spellName}]}
       } else {
           DEBUG_3 ${spellName}:${Me.SpellReady[${spellName}]}
           /if (!${Me.SpellReady[${spellName}]}) {
               DELAY 15s ${Me.SpellReady[${spellName}]}
           }
       }
       DEBUG_2 Casting ${spellName}:${gem}>${Target.CleanName}
       /cast "${spellName}"
   }
   /varset result CAST_IN_PROGRESS
   DELAY 2
   /doevents
   /if (${result}==CAST_IN_PROGRESS && ${Me.Casting.ID}==0) /goto :recast

   /if (!${dangerFlag}) {
       DELAY 30s ${Me.Casting.ID}==NULL
       /delay 1
       /doevents
   } else {
       /delay 1
       /varset castX ${Me.X}
       /varset castY ${Me.Y}
       /varset castZ ${Me.Z}
       /if (${reroot} && ${Target.Type.Equal[NPC]}) {
           /delay 4
           /call WarpDistant
       }
       /varcalc castTime ${Math.Calc[${Me.Casting.MyCastTime}*10].Int}-19
       | Hard code 9s delay for item, assume it is skullcap.
       /if (${gem.Equal[item]}) /varset castTime 98
       /delay ${castTime} ${Me.Casting.ID}==0
       /hop ${castX} ${castY} ${castZ}
       /face fast nolook
       /delay 3s ${Me.Casting.ID}==0
       /delay 1
       /doevents
       /if (${reroot} && ${Target.Type.Equal[NPC]}) {
           /call WarpDistant
       } else {
           /call BackOffFromTarget 60
       }
   }
   /if (${result}==CAST_IN_PROGRESS) /varset result CAST_SUCCESS
   DEBUG_3 Casting of ${spellName} complete, result=${result}
   /if (${result}==CAST_OUTOFRANGE || ${result}==CAST_CANNOTSEE) {
       /if (!${dangerFlag} || !${reroot}) /call WarpCloser
       /goto :recast
   } else /if (${result}==CAST_RETRY) {
       /if (!${Me.SpellReady[${spellName}]}) {
        /varcalc result ${Spell[${spellName}].RecoveryTime}*10
           DELAY ${result} ${Me.SpellReady[${spellName}]}
       }
       /goto :recast
   }
/return

Sub Mount
   /if (${mountFlag}) {
       /if (${InvSlot[ammo].Item.Name.Find[Drum]}!=NULL && ${Me.Buff[Summon Drogmor].ID}==0) 

{
           /cast item "${InvSlot[ammo].Item.Name}"
       } else /if (${InvSlot[ammo].Item.Name.Find[Bridle]}!=NULL && ${Me.Buff[Summon 

Horse].ID}==0) {
           /cast item "${InvSlot[ammo].Item.Name}"
       } else {
           /if (!${Me.Sitting}) /sit
       }
   } else {
       /if (!${Me.Sitting}) /sit
   }
/return

|----------------------------------------------------------------------------
|SUB: CheckMana 0= need more med; 1=mana ok
| Now with histeresis - exit condition is above entry condition.
|----------------------------------------------------------------------------
Sub CheckMana
   /declare exitMana int local
   /declare exitHealth int local
   /varcalc exitMana MIN_MANA_BEFORE_MEDITATE+80
   /varcalc exitHealth ALARM_HEALTH_BELOW_PCT+70
   |Meditate?
   /if (${Me.PctMana}<MIN_MANA_BEFORE_MEDITATE || ${Me.PctHPs}<ALARM_HEALTH_BELOW_PCT) {
       DEBUG_1 Meditating.
       /popup Meditating...
       /call Mount
       /declare i int local
       /if ( ${Target.ID} ) /squelch /target clear
       /for i 1 to 10
           DELAY 1s
           /if ( ${Target.ID} ) /return 1
       /next i
       /if ( ${Me.PctMana}<${exitMana} || ${Me.PctHPs}<${exitHealth} ) /return 0
       DEBUG_2 Mana/health OK now.
   }
/return 1

|----------------------------------------------------------------------------
|SUB: MaintainSelfBuffs - Keep buffs up
| 0=still buffing; 1=all done
|----------------------------------------------------------------------------
Sub MaintainSelfBuffs
   /declare iCount int local
   /declare t string local
   /for iCount 1 to ${MyBuffs.Size}
       /call SplitString tmp_tmp ${MyBuffs[${iCount}]} "|"
       /varset t ${Me.Buff[${tmp_tmp[1]}]}
       /if ( ${t.Equal[NULL]} ) {
           /if ( !${Target.ID}!=${Me.ID} ) {
               /echo buffing
               /target myself
               DELAY 1
           }
           |Cast with gemselection or default
           /if ( ${tmp_tmp.Size}>1 ) {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}" ${tmp_tmp[2]}
               /call MyCast "${tmp_tmp[1]}" ${tmp_tmp[2]}
           } else {
               DEBUG_3 Attempting to cast "${tmp_tmp[1]}"
               /call MyCast "${tmp_tmp[1]}" 8
           }
           |Return to top - so we dont keep buffing if being attacked
           /return 0
       }
   /next iCount
/return 1

| Back off from current target so many units.
| Finds first line of sight on a horizontal, vertical, or
| diagonals that are at least as distant as desired.
Sub BackOffFromTarget(float dist)
   /declare by float local ${Target.Y}
   /declare bx float local ${Target.X}
   /varcalc by ${by}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${  Target.Z}]}) /goto 

:backoff

   /varset by ${Target.Y}
   /varcalc bx ${bx}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${  Target.Z}]}) /goto 

:backoff

   /varcalc by ${by}+${dist}
   /varset bx ${Target.X}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${  Target.Z}]}) /goto 

:backoff

   /varset by ${Target.Y}
   /varcalc bx ${bx}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${  Target.Z}]}) /goto 

:backoff

   /varcalc by ${by}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${  Target.Z}]}) /goto 

:backoff

   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}-${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${  Target.Z}]}) /goto 

:backoff

   /varcalc by ${Target.Y}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${  Target.Z}]}) /goto 

:backoff

   /varcalc by ${Target.Y}-${dist}
   /varcalc bx ${Target.X}+${dist}
   /if (${LineOfSight[${by},${bx},${Target.Z}:${Target.Y},${Target.X},${  Target.Z}]}) /goto 

:backoff

   /face fast
   /keypress forward
   /delay 3s ${Target.Distance}>=${dist}
   /keypress forward
   /face fast
   /return
:backoff
   /hop ${bx} ${by} ${Target.Z}
   /delay 1
   /if (${Target.ID}) /face fast nolook
/return

|----------------------------------------------------------------------------
|SUB: DoTheLooting
|----------------------------------------------------------------------------
Sub DoTheLooting
   /if (!${Defined[looted]}) /declare looted bool outer
   /target id ${TargetID}
   DELAY 1
   DEBUG_1 Going to loot
   DEBUG_3 DoTheLooting Target: ${Target.CleanName}, ID:${Target.ID}
   /hop target
   DELAY 1
   /loot
   /varset looted FALSE
   DELAY 6s (${Corpse.Open}&&${looted})
   /call LootMob
   /notify LootWnd DoneButton leftmouseup
   DELAY 1
   /doevents
   /declare xp int local
   /declare pp int local
   /declare level float local ${Me.Level}
   /varcalc level ${level}+${Math.Calc[${Me.Exp}/330.0].Milli}
   /varcalc xp ${Me.Exp}-${startingXP}
   /if (${xp}<0) /varcalc xp ${xp}+330
   /varcalc pp ${Me.Platinum}-${startingPP}
   /popup L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DEBUG_1 L${level.Milli}, XP up ${Math.Calc[${xp}/3.3]}% - PP up ${pp}
   DELAY 5s
/return

|----------------------------------------------------------------------------
|SUB: LootMob
|----------------------------------------------------------------------------
Sub LootMob
   /if (!${Target.ID}) {
       /target npc corpse
       DELAY 1s ${Target.ID}>0
   }
   /loot
   DELAY 1s ${Corpse.Open}
   /cleanup
/return

|----------------------------------------------------------------------------
|SUB: SplitString - A generic string splitter.
|----------------------------------------------------------------------------
Sub SplitString(string varname, string inputstring, string splitter)
   /declare i int local
   /declare stringcnt int local

   |The normal splitter. Splitter string is just 1 in length.
   /if (${splitter.Length}==1) {
       /varcalc stringcnt ${inputstring.Count["${splitter}"]} + 1
       /if (!${Defined[${varname}]}) {
           /declare ${varname}[${stringcnt}] string outer
       } else {
           /deletevar ${varname}
           /declare ${varname}[${stringcnt}] string outer
       }
       /for i 1 to ${stringcnt}
           /varset ${varname}[${i}] ${inputstring.Token[${i},"${splitter}"]}
       /next i
   }
/return

|----------------------------------------------------------------------------
|SUB: DestroyCopper - Destroy all the copper
|----------------------------------------------------------------------------
Sub DestroyCopper
   /squelch /windowstate InventoryWindow open
   /shift /notify InventoryWindow IW_Money3 leftmouseup
   /delay 1s ${Cursor.ID}>0
   /destroy
   /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DestroySilver - Destroy all the silver
|----------------------------------------------------------------------------
Sub DestroySilver
   /squelch /windowstate InventoryWindow open
   /shift /notify InventoryWindow IW_Money2 leftmouseup
   /delay 1s ${Cursor.ID}>0
   /destroy
   /cleanup
/return

|----------------------------------------------------------------------------
|SUB: DoTheFear - Fear target
|----------------------------------------------------------------------------
Sub DoTheFear
   /if ( ${Me.PctMana}>10 && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}>24) {
       /call MyCast "FEAR_SPELL" FEAR_GEM
       /varset fightTimer 31s
   }
/return

Sub Event_fear
   DEBUG_2 Fear me!
   /call DoTheFear
/return

Sub Event_Miss1
   /echo misses
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
   /delay 1
/call BackOffFromTarget 90
/return

Sub Event_Skinhit
   /echo skinhit
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
/delay 1   
/call BackOffFromTarget 90
/return

Sub Event_ImHit
   /Echo i m hit
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /if (${Me.Casting.ID}!=0) /return
   /delay 1
/call BackOffFromTarget 80
/return

Sub Event_Retry
   /delay 2
   /varset result CAST_RETRY
/return

Sub Event_Abort
   /varset result CAST_ABORT
/return

Sub Event_OutOfRange
   /varset result CAST_OUTOFRANGE
/return

Sub Event_NoLOS
   /varset result CAST_CANNOTSEE
/return

Sub Event_Standing
   /stand
   /varset result CAST_RETRY
/return

Sub Event_OOR
   /hop target
   /delay 2
   /loot
   /delay 3
   /delay 3s ${Corpse.Open}
   /doevents OOR
/return

Sub Event_Blocked
   /varset wayBlocked TRUE
/return

Sub Event_Zoned
   /varset weZoned TRUE
/call BackOffFromTarget 60
/return

Sub Event_PetAggro
   /target id ${Me.Pet.ID}
   /hop target
   /delay 1
   /assist
   /delay 1
/return

Sub Event_NoMount
   /varset mountFlag FALSE
/return

Sub Event_NoLich
   /varset mountFlag FALSE
   /dismount
/return

Sub Event_Stunned
:gdStunned
   /call AlwaysCheck nocast
   /if (${Macro.Return}) {
       /varset result CAST_ABORT
       /return
   }
   /delay 1
   /if (${Me.Stunned}) /goto :gdStunned

   /varset result CAST_RETRY
/return

Sub Event_Invited(heard,string who)
   /if (${who.Equal[MY_PARTNER]}) {
       /invite
   } else {
       /disband
   }
/return

|----------------------------------------------------------------------------
|SUB: Root Gone
|----------------------------------------------------------------------------
Sub Event_RootGone
   DEBUG_2 Root gone.
   /varset reroot TRUE
   /varset dangerFlag TRUE
/return

|----------------------------------------------------------------------------
|SUB: DOT1Gone
|----------------------------------------------------------------------------
Sub Event_DOT1Gone
   DEBUG_2 SPLURT_DOT gone.
   /varset redot1 TRUE
/return

|----------------------------------------------------------------------------
|SUB: DOT2Gone
|----------------------------------------------------------------------------
Sub Event_DOT2Gone
   DEBUG_2 HEAT_DOT gone.
   /varset redot2 TRUE
/return

|----------------------------------------------------------------------------
|SUB: DOT3Gone
|----------------------------------------------------------------------------
Sub Event_DOT3Gone
   DEBUG_2 DISEASE_DOT gone.
   /varset redot3 TRUE
/return

|----------------------------------------------------------------------------
|SUB: SKULLCAPGONE
|----------------------------------------------------------------------------
Sub Event_Skullcapgone
   DEBUG_2 LIFE_DOT gone.
   /varset reskull TRUE
/return

Sub Event_Snaregone
DEBUG_2 Root gone.
   /varset reroot TRUE
   /varset dangerFlag TRUE
/return

Sub Event_Exp
   /varset AAExp ${Math.Calc[${Me.PctAAExp}-${AAExp}]}
   /varset Exper ${Math.Calc[${Me.PctExp}-${Exper}]}
   /varset LDRExp ${Math.Calc[${Me.PctGroupLeaderExp}-${LDRExp}]}
   /echo EXP: ${Exper} (${Me.PctExp}%) - AAXP: ${AAExp} (${Me.PctAAExp}%) - LDRXP: ${LDRExp} 

(${Me.PctGroupLeaderExp})
   /popup ${Exper} (${Me.PctExp}%) - AAXP: ${AAExp} (${Me.PctAAExp}%) - LDRXP: ${LDRExp} 

(${Me.PctGroupLeaderExp})
   /varset Exper ${Me.PctExp}
   /varset AAExp ${Me.PctAAExp}
   /varset LDRExp ${Me.PctGroupLeaderExp}
/return

Sub Event_Exp2
   /varset AAExp ${Math.Calc[${Me.PctAAExp}-${AAExp}]}
   /varset Exper ${Math.Calc[${Me.PctExp}-${Exper}]}
   /varset LDRExp ${Math.Calc[${Me.PctGroupLeaderExp}-${LDRExp}]}
   /echo EXP: ${Exper} (${Me.PctExp}%) - AAXP: ${AAExp} (${Me.PctAAExp}%)
   /popup ${Exper} (${Me.PctExp}%) - AAXP: ${AAExp} (${Me.PctAAExp}%)
   /varset Exper ${Me.PctExp}
   /varset AAExp ${Me.PctAAExp}
   /varset LDRExp ${Me.PctGroupLeaderExp}
/return

Sub SwapItem(string itemName,string slotName) 
   /if ( ${InvSlot[${slotName}].Item.Name.Equal[${itemName}]} ) /return 
   /declare slotID int local 
   /declare oldSlotID int local 
   /declare oldItem string local 
   /declare i int local 
   /varset slotID ${InvSlot[${slotName}].ID}           | slotID = slot you're swapping item 

to 
   /varset oldSlotID ${FindItem[${itemName}].InvSlot.ID} | oldSlotID = slot the item was 

originally in 
   /varset oldItem ${InvSlot[${slotName}].Item.Name}     | oldItem = name of item in the slot 

you're swapping WITH 
   /if ( !${slotID} ) { 
      /echo Invalid slot name: ${slotName} 
      /return 
   } 
   /if ( !${oldSlotID} ) { 
      /echo Could not find item ${itemName} 
      /return 
   } 
:auto_inv 
   /if ( ${Cursor.ID} && !${Cursor.Name.Equal[${itemName}]} ) { 
      /if ( ${Cursor.Container} ) { 
         /for i 1 to 8 
            /if ( !${InvSlot[pack${i}].Item.Container} ) { 
               /nomodkey /itemnotify pack${i} leftmouseup 
            } 
         /next i 
      } else { 
         /autoinventory 
      } 
      /goto :auto_inv 
   } 
    

:pick_up_item 
 | if the item is in a bag and it's not open, then open it! 
   /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} 

) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 

 | if the slot you're putting it in is inside a bag and it's not open, then open it! 
   /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) 

/nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 

 | ok.. pick up the item now! 
   /squelch /nomodkey /shiftkey /itemnotify ${InvSlot[${oldSlotID}]} leftmouseup 

 | if item isn't on your cursor, try again! 
   /if ( !${Cursor.Name.Equal[${itemName}]} ) { 
      /if ( ${Cursor.ID} && !${Cursor.Container} ) /autoinventory 
      /goto :pick_up_item 
   } 
:exchange_items 
   /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} 

) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
   /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) 

/nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 

 | put the item in the new slot, and pick up whatever item was there 
   /squelch /nomodkey /shiftkey /itemnotify ${slotID} leftmouseup 

 | if it didnt get exchanged, try again! 
   /if ( ${Cursor.ID} && !${Cursor.Name.Equal[${oldItem}]} && 

!${Cursor.Name.Equal[${itemName}]} && !${Cursor.Container} ) /autoinventory 
   /if ( !${InvSlot[${slotID}].Item.Name.Equal[${itemName}]} ) /goto :exchange_items 
:drop_item 
   /if ( !${Cursor.Container} || ( ${InvSlot[${oldSlotID}]}<30 && 

${InvSlot[${oldSlotID}]}>=22 ) ) { 
      /if ( ${InvSlot[${oldSlotID}].Pack} && 

!${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify 

${InvSlot[${oldSlotID}].Pack} rightmouseup 
      /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) 

/nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 
      /squelch /nomodkey /itemnotify ${oldSlotID} leftmouseup 
      /if ( ${Cursor.ID} ) { 
         /if ( !${Cursor.Name.Equal[${oldItem}]} ) /autoinventory 
         /goto :drop_item 
      } 
   } 
:close_pack 
   /if ( ${InvSlot[${oldSlotID}].Pack} && ${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} 

&& ( ${Cursor.Name.Equal[${itemName}]} || ${FindItem[${itemName}].ID} ) ) { 
      /squelch /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
      /goto :close_pack 
   } 
   /if ( ${InvSlot[${slotID}].Pack} && ${Window[${InvSlot[${slotID}].Pack.Name}].Open} && ( 

${Cursor.Name.Equal[${itemName}]} || ${FindItem[${itemName}].ID} ) ) { 
      /squelch /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 
      /goto :close_pack 
   } 
/return
 
i have a 68 necro without epic 1.0 , if anyone would be able to throw up a macro on levelling for that kind of char id love it :)
 
For anyone reading this:

I tried this macro when I first started using MQ2. I wanted to lvl my necro. It didn't work all that great IMHO. So I found the AFK Bard target mac.

Do yourselves a favor and roll up a bard. Get him to lvl, then just group him w/ necro.

Easiest thing you'll ever do...well...almost. :D
 
Army and I have been working on a necro mac for FH for a week or so, stuck on buff part. We should have it going by the end of the week. if not, then i will have to wait until i get more money for my SOE subscription unless someone wants to help me out 8( lol
 
Mandrack's Necro macro Total AFK macro 55-70 Necro then aa's.

Users who are viewing this thread

Back
Top
Cart