• 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. (1 Viewer)

mandrack

New member
Joined
Feb 11, 2005
RedCents
I m aware this macro was posted in the past on this forum, but without my authorization...Well here it is now..Let me know if you have problems running this jewel.

Code starts under here.
 
Last edited:
Looks pretty awesome. So in a nut shell just get an instance of The Forgotten Halls, zone the Necro in, run the macro and watch the fun? It will mem the spells needed and summon a pet and everything for you?

Thanks
 
Okay I figured out where to go and all of that but i can not seem to get this macro to run its set to high for me by any chance can it be edited for say a level 57 who has no clickys including those caps cause i dont have those and my level is 57 necro i tried editing it myself and i broke it.
 
ok, I edited this by changing the names of the spells in the #defines. When I try to run it it just spams "no such spell set exists; Usage: /memspellset<index | Partial name>" Do I need to save a spellset with those spell lineups, or how does that work? And also, you are using megawarp in this?
 
Last edited:
love this macro but i need help how do i get to the forgotten hills i know how to edit macro but its the zone thing that kills me lol
 
Ok whats the trick to get forgotten halls.ive done the rest just wanna try macro.
 
any chance someone has a macro for others classes like this for bst or dru or clr?? or maybe a lower level verison of Necro like 35-50 range??
 
Anyone have luck using this with "MQ2warp" plugin as posted in this forum?

WriteChatColor(DoCommand - Couldn't parse '/megawarp ${bx} ${by} ${Target.Z}')

It seems like macro is looking for the "mq2megawarp" plugin. So, i edited the macro and changed all the references from "/megawarp" to "/warp loc" and loaded up the MQ2warp plugin. However, I still get...

WriteChatColor(DoCommand - Couldn't parse '/warp loc ${bx} ${by} ${Target.Z}')

Can someone post the megawarp source or lend a hand with debugging this? Thanks.
 
You could change to another warp, exemple warp loc if that's the warp kind you use.
 
fatgnome said:
So, i edited the macro and changed all the references from "/megawarp" to "/warp loc" and loaded up the MQ2warp plugin. However, I still get...

WriteChatColor(DoCommand - Couldn't parse '/warp loc ${bx} ${by} ${Target.Z}')

Can someone post the megawarp source or lend a hand with debugging this? Thanks.

heh, already did that.
 
it warps me underground. And targets diffent mobs over and over and over agen And i also get the cant find spell. Here is the Code that i changed.
This is ment for a 56 nec

Rich (BB code):
| necro666.mac v2.1, Zornecro 05-Dec-2004
| (Load mq2extras before starting the macro)
| Author : Zornecro, borrowed from wolf5 
| (Wolf5 v1.1.9 - 2004-07-11)
| Useage : /macro necrocap
| Description : This macro will root dot mobs of
| The Forgotten Halls. It assumes you have an instance
| and are inside already.
| 10-Dec-04: Attempt to make it 69+ compatible with root rot. (Should work starting 53 changing the spells)..now set on 69 necro with no clickys)
| Mandrack edition 


|------------------------------------------------------------------------------
#turbo 40
#define MY_PARTNER Mandrack
#define MIN_MOB_LVL 53
#define MAX_MOB_LVL 65


#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 "Paralyzing Earth"
#define SPLURT_SPELL "Splurt"
#define HEAT_DOT "Ignite Blood"
#define DISEASE_DOT "Cessation of Cor"
#define POISON_DOT "Envenomed Bolt"
#define SNARE_SPELL "Dooming Darkness"

#event Exp "#*#party experience!!"
#event Exp2 "You gain experience!!"
#event Invited "#1# invites you to join a group."
#event Blocked "The way is blocked to you. Perhaps you would be able to enter if there was a reason to come here."
#event NoMount "You can 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 Paralyzing Earth spell has worn off."
#event DOT1Gone "Your Splurt spell has worn off."
#event DOT2Gone "Your Ignite Blood spell has worn off."
#event DOT3Gone "Your Cessation of Cor spell has worn off."
#event DOT4Gone "Your Envenomed Bolt spell has worn off."
#event Skullcapgone "Your Fang of Death has worn off."
#event fear "Your fear spell has worn off."
#event ImHit "|${Target.CleanName}|#*#YOU for#*#"
#event Skinhit "A squeaking rat tries to bite YOU, but YOUR magical skin absorbs the blow!"
#event Skinhit1 "A squeaking rat tries to kick YOU, but YOUR magical skin absorbs the blow!"
#event Miss1 "A squeaking rat tries to bite YOU, but misses!"
#event Miss2 "A squeaking rat tries to kick YOU, but misses!"
#event InDanger "Your target is too high of a level for your fear spell."

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

|-- 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 snare/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 "Summon companion"
#define SUMMON_GEM 7

| Change SPLURT_GEM to 0 if you lack it.
#define SPLURT_GEM 1
|-- What snare spell
|-- Favorite gem spot for the snare (1-8)
#define SNARE_GEM 2
#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 "Augmentation of Death"
#define PET_HASTE_GEM 9
#define LICH_SPELL "demi lich"
#define LICH_GEM 8
#define LIFE_DOT "Demi Lich Skullcap"
#define LIFE_DOT_GEM item
#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 "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] "Shield of the magi|7"
/varset MyBuffs[2] "manaskin|4"

|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[2] "PET_HASTE|PET_HASTE_GEM"

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.Find[knowledge]}!=0) {
/zone everfrost
DELAY 3m ${weZoned}
/target npc magus
/warp target
DELAY 10
/varset weZoned FALSE
/say nedaria
DELAY 3m ${weZoned}
}
/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
/if (!${dangerFlag}) {
/call BackOffFromTarget 60
/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
} else {
||| This is new code for Root Rot with Warp |||
/call BackOffFromTarget 60
/if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /goto :NewTarget
/if (${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON) /call SummonPet TRUE
/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 1s ${Target.ID}!=0&&${Target.Type.Equal[NPC]}
/doevents
/if (${reroot} && ${Target.PctHPs}>1) {
|/call MyCast "LICH_SPELL" LICH_GEM
/call MyCast "ROOT_SPELL" ROOT_GEM
|/if (${Me.PctHPs}<90 && ${Target.PctHPs}>1) /call MyCast "LIFE_DOT" LIFE_DOT_GEM
/varset reroot
/goto :fartAround
} else /if (${redot1} && ${Target.PctHPs}>1) {
|!mqpaus/call MyCast "LIFE_DOT" LIFE_DOT_GEM
/if (${Target.PctHPs}>16) /call MyCast "SPLURT_SPELL" SPLURT_GEM
/if (${Me.PctMana}>60) /call MyCast "SNARE_SPELL" SNARE_GEM
/call SwapItem "Demi Lich Skullcap" Head 
/if (${Me.PctHPs}<99 && ${Target.PctHPs}>1) /call MyCast "LIFE_DOT" LIFE_DOT_GEM
/call SwapItem "Deathcaller's Skullcap" head
/varset redot1
} else /if (${redot2} && ${Target.PctHPs}>4) {
/call MyCast "HEAT_DOT" HEAT_DOT_GEM
/varset redot2
} else /if (${redot3} && ${Target.PctHPs}>25) {
/call MyCast "DISEASE_DOT" DISEASE_DOT_GEM
/varset redot3
} else /if (${reskull} && ${Target.PctHPs}>1) {
/call MyCast "ROOT_SPELL" ROOT_GEM
|/if (${Me.PctMana}<90 && ${Me.Buff[LICH_SPELL].ID}==NULL && ${Me.PctHPs}>50) /call MyCast "LICH_SPELL" LICH_GEM
/varset reskull
} else /if (${Target.ID} && ${reroot}) {
/call BackOffFromTarget 60
/call SummonPet
/pet attack
}
/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) {
/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 (!${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) {
/if (${Zone.Name.Find[knowledge]}!=0) /goto :quit
:quit

/dismount
/camp desktop
/endmacro
}
:zoneIn
/warp loc -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 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 -30 -827 -11
/warp target
/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) {
/instacamp
/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
/instacamp
}
/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}>1 && ${Target.Speed}>0) {
/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 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

/if (!${dangerFlag}) {
/memspellset dots
} else {
/memspellset dots
}
/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[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})
/if (${Target.Level}>=47) /varset dangerFlag TRUE
/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 {
/if (${Me.Pet.ID}) /warp loc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
}
}
DELAY 1
/if (${Target.ID}) /face fast
/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) {
/warp loc ${wpY} ${wpX} ${wpZ}
}
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 InDanger
/doevents Skinhit
/doevents Skinhit1
/doevents Miss1
/doevents Miss2
/doevents ImHit
/doevents Retry
/doevents Abort
/doevents OutOfRange
/doevents NoLOS
/doevents Standing
/doevents OOR
/doevents CashLoot
/doevents Zoned
/doevents PetAggro
/doevents NoMount
/doevents NoLich
/doevents Stunned
/doevents RootGone
/doevents DOT1Gone
/doevents DOT2Gone
/doevents DOT3Gone
/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]}) /varcalc castTime 35
/delay ${castTime} ${Me.Casting.ID}==0
/warp loc ${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}]}) {
/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)

/return


|----------------------------------------------------------------------------
|SUB: HealPet - Heal pet if needed 0=just healed; 1=no problem
|----------------------------------------------------------------------------
Sub HealPet

/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+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: MaintainPetBuffs - Heal pet and keep its buffs up
| 0= still busy; 1=all done
|----------------------------------------------------------------------------
Sub MaintainPetBuffs

/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
}
|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
/warp loc ${bx} ${by} ${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: 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_CashLoot - Will count the loot so far running the macro
|----------------------------------------------------------------------------
Sub Event_CashLoot(string Line, string cash)

/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
/call BackOffFromTarget 90
/return

Sub Event_Miss2
/echo Miss2
/call AlwaysCheck nocast
/if (${Macro.Return}) {
/varset result CAST_ABORT
/return
}
/if (${Me.Casting.ID}!=0) /return
/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
/call BackOffFromTarget 90
/return
Sub Event_Skinhit1
/echo skinhit
/call AlwaysCheck nocast
/if (${Macro.Return}) {
/varset result CAST_ABORT
/return
}
/if (${Me.Casting.ID}!=0) /return
/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
/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_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
/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_InDanger
/varset dangerFlag TRUE
/varset result CAST_ABORT
/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
 
Just curious if anybody has actually gotten this to work? There are a bunch of posts here about how it didn't work for people, and not one saying that they got it to work. If you got it to work, what did you do?
 
agentno4 said:
Just curious if anybody has actually gotten this to work? There are a bunch of posts here about how it didn't work for people, and not one saying that they got it to work. If you got it to work, what did you do?

I've never been able to get it to run well either. I went through switched out all spells, removed item clickies, changed megawarp to rwarp, switched the warp coords which had x and y backwards(guess old warp plugin did them that way), and fixed the worn off message which apparently had changed since the original creation.
Anyhow after all that it will self buff me, warp me to a rat, root the rat, dot the rat, then randomly recast dots/root, but generally it'd take too long to recast root and I'd end up getting beat on and being succored to zone line. Eventually I'll get it working, but also problems were with the warp coords it used, would put me behind walls sometimes or down steps, and had lots of LOS issues, which probably is a new problem that didn't exist when originally made. It'd be awesome if someone went through and fixed everything, just a noob here and to lazy to fix this to plevel an alt.

here is the still broken but almost does something :P I've patched together. Edit - found some errors I made, it almost works now
Rich (BB code):
| necro666.mac v2.1, Zornecro 05-Dec-2004
| (Load mq2extras before starting the macro)
| Author : Zornecro, borrowed from wolf5 
| (Wolf5 v1.1.9 - 2004-07-11)
| Useage : /macro necro666
| Description : This macro will root dot mobs of
| The Forgotten Halls. It assumes you have an instance
| and are inside already.
| 10-Dec-04: Attempt to make it 69+ compatible with root rot. (Should work starting 53 changing the spells)..now set on 69 necro with no clickys)
| Mandrack edition 


|------------------------------------------------------------------------------
#turbo 40
#define MY_PARTNER mandrack
#define MIN_MOB_LVL 61
#define MAX_MOB_LVL 65


#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"
#define SNARE_SPELL "Embracing Darkness"

#event Exp "#*#party experience!!"
#event Exp2 "You gain experience!!"
#event Invited "#1# invites you to join a group."
#event Blocked "The way is blocked to you. Perhaps you would be able to enter if there was a reason to come here."
#event NoMount "You can 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 of a Squeaking rat."
#event DOT1Gone "Your Horror spell has worn off of a Squeaking rat."
#event DOT2Gone "Your Funeral Pyre of Kelador spell has worn off of a Squeaking rat."
#event DOT3Gone "Your Dark Plague spell has worn off of a Squeaking rat."
#event Dot4Gone "Your Saryrn's Kiss has worn off of a Squeaking rat."
#event DOT5Gone "Your Blood of Thule spell has worn off of a Squeaking rat."
#event fear "Your fear spell has worn off."
#event ImHit "|${Target.CleanName}|#*#YOU for#*#"
#event Skinhit "A squeaking rat tries to bite YOU, but YOUR magical skin absorbs the blow!"
#event Skinhit1 "A squeaking rat tries to kick YOU, but YOUR magical skin absorbs the blow!"
#event Miss1 "A squeaking rat tries to bite YOU, but misses!"
#event Miss2 "A squeaking rat tries to kick YOU, but misses!"
#event InDanger "Your target is too high of a level for your fear spell."

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

|-- 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 snare/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 9
|-- How far off should the pet be before we summon it?
#define MAX_PET_RANGE_BEFORE_SUMMON 800
#define SUMMON_SPELL "Summon companion"
#define SUMMON_GEM 7

| Change SPLURT_GEM to 0 if you lack it.
#define SPLURT_GEM 1
|-- What snare spell
|-- Favorite gem spot for the snare (1-8)
#define SNARE_GEM 2
#define HEAT_DOT_GEM 9
#define DISEASE_DOT_GEM 6
#define POISON_DOT_GEM 5
#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 "Touch of Death"
|-- Favorite gem spot for the petheal (1-8)
#define HEAL_PET_GEM 7
#define PET_HASTE "Rune of Death"
#define PET_HASTE_GEM 1
#define LICH_SPELL "Seduction of Saryrn"
#define LICH_GEM 8
#define LIFE_DOT "Saryrn's Kiss"
#define LIFE_GEM 3
#define ROD_NAME "Summoned: Modulating Rod"

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

|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 redot4 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|5"

|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[2] "PET_HASTE|PET_HASTE_GEM"

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.Find[knowledge]}!=0) {
/zone everfrost
DELAY 3m ${weZoned}
/target npc magus
/rwarp target
DELAY 10
/varset weZoned FALSE
/say nedaria
DELAY 3m ${weZoned}
}
/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
/if (!${dangerFlag}) {
/call BackOffFromTarget 60
/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) /rwarp loc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
} else {
/rwarp succor
}
/goto :NewTarget
} else {
||| This is new code for Root Rot with rwarp |||
/call BackOffFromTarget 60
/if (${Target.Distance}>INITIALIZE_ATTACK_RANGE) /goto :NewTarget
/if (${Me.Pet.Distance}>MAX_PET_RANGE_BEFORE_SUMMON) /call SummonPet TRUE
/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 redot4 TRUE
/call BackOffFromTarget 60
:fartAround
DELAY 1s ${Target.ID}!=0&&${Target.Type.Equal[NPC]}
/doevents
/if (${reroot} && ${Target.PctHPs}>1) {
|/call MyCast "LICH_SPELL" LICH_GEM
/call MyCast "ROOT_SPELL" ROOT_GEM
|/if (${Me.PctHPs}<90 && ${Target.PctHPs}>1) /call MyCast "LIFE_DOT" LIFE_DOT_GEM
/varset reroot
/goto :fartAround
} else /if (${redot1} && ${Target.PctHPs}>1) {
|!mqpaus/call MyCast "LIFE_DOT" LIFE_DOT_GEM
/if (${Target.PctHPs}>16) /call MyCast "SPLURT_SPELL" SPLURT_GEM
/if (${Me.PctMana}>60) /call MyCast "SNARE_SPELL" SNARE_GEM
/if (${Me.PctHPs}<99 && ${Target.PctHPs}>1) /call MyCast "LIFE_DOT" LIFE_DOT_GEM
/varset redot1
} else /if (${redot2} && ${Target.PctHPs}>4) {
/call MyCast "HEAT_DOT" HEAT_DOT_GEM
/varset redot2
} else /if (${redot3} && ${Target.PctHPs}>25) {
/call MyCast "DISEASE_DOT" DISEASE_DOT_GEM
/varset redot3
} else /if (${redot4} && ${Target.PctHPs}>1) {
/call MyCast "ROOT_SPELL" ROOT_GEM
|/if (${Me.PctMana}<90 && ${Me.Buff[LICH_SPELL].ID}==NULL && ${Me.PctHPs}>50) /call MyCast "LICH_SPELL" LICH_GEM
/varset redot4
} else /if (${Target.ID} && ${reroot}) {
/call BackOffFromTarget 60
/call SummonPet
/pet attack
}
/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) {
/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 (!${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) {
/if (${Zone.Name.Find[knowledge]}!=0) /goto :quit
:quit

/dismount
/camp desktop
/endmacro
}
:zoneIn
/rwarp loc 1543 -670 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 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
/rwarp succor
/delay 1
/target npc a_harindi_guide
|/rwarp loc -827 -30 -11
/rwarp target
/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) {
/instacamp
/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
/instacamp
}
/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 rwarpCloser
/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}>1 && ${Target.Speed}>0) {
/rwarp 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 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

/if (!${dangerFlag}) {
/memspellset dots
} else {
/memspellset dots
}
/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[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})
/if (${Target.Level}>=47) /varset dangerFlag TRUE
/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


|rwarp closer to target, via WP if mob, or direct otherwise.
Sub rwarpCloser
/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]}) {
/rwarp target
} else {
/if (${Me.Pet.ID}) /rwarp loc ${Me.Pet.Y} ${Me.Pet.X} ${Me.Pet.Z}
}
}
DELAY 1
/if (${Target.ID}) /face fast
/return

|rwarp away from target, via most distant WP
Sub rwarpDistant
/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) {
/rwarp loc ${wpY} ${wpX} ${wpZ}
}
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 InDanger
/doevents Skinhit
/doevents Skinhit1
/doevents Miss1
/doevents Miss2
/doevents ImHit
/doevents Retry
/doevents Abort
/doevents OutOfRange
/doevents NoLOS
/doevents Standing
/doevents OOR
/doevents CashLoot
/doevents Zoned
/doevents PetAggro
/doevents NoMount
/doevents NoLich
/doevents Stunned
/doevents RootGone
/doevents DOT1Gone
/doevents DOT2Gone
/doevents DOT3Gone
/doevents Dot4gone
/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 rwarpCloser
/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 rwarpDistant
}
/varcalc castTime ${Math.Calc[${Me.Casting.MyCastTime}*10].Int}-19
| Hard code 9s delay for item, assume it is Dot4.
/if (${gem.Equal[item]}) /varcalc castTime 35
/delay ${castTime} ${Me.Casting.ID}==0
/rwarp loc ${castY} ${castX} ${castZ}
/face fast nolook
/delay 3s ${Me.Casting.ID}==0
/delay 1
/doevents
/if (${reroot} && ${Target.Type.Equal[NPC]}) {
/call rwarpDistant
} 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 rwarpCloser
/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)

/return


|----------------------------------------------------------------------------
|SUB: HealPet - Heal pet if needed 0=just healed; 1=no problem
|----------------------------------------------------------------------------
Sub HealPet

/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+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: MaintainPetBuffs - Heal pet and keep its buffs up
| 0= still busy; 1=all done
|----------------------------------------------------------------------------
Sub MaintainPetBuffs

/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
}
|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
/rwarp 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}
/rwarp 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: 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_CashLoot - Will count the loot so far running the macro
|----------------------------------------------------------------------------
Sub Event_CashLoot(string Line, string cash)

/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
/call BackOffFromTarget 90
/return

Sub Event_Miss2
/echo Miss2
/call AlwaysCheck nocast
/if (${Macro.Return}) {
/varset result CAST_ABORT
/return
}
/if (${Me.Casting.ID}!=0) /return
/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
/call BackOffFromTarget 90
/return
Sub Event_Skinhit1
/echo skinhit
/call AlwaysCheck nocast
/if (${Macro.Return}) {
/varset result CAST_ABORT
/return
}
/if (${Me.Casting.ID}!=0) /return
/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
/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
/rwarp 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}
/rwarp 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
/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: Dot4GONE
|----------------------------------------------------------------------------
Sub Event_Dot4gone
DEBUG_2 LIFE_DOT gone.
/varset redot4 TRUE
/return

Sub Event_InDanger
/varset dangerFlag TRUE
/varset result CAST_ABORT
/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
 
Last edited:
You need to use MQ2megawarp for this plugin, or like crazyhorse did , switch x and y..

apart from this the macro works great..not sure why people are having problems.
 
mandrack said:
You need to use MQ2megawarp for this plugin, or like crazyhorse did , switch x and y..

apart from this the macro works great..not sure why people are having problems.

Actually has been working alright for me, I haven't tried leaving it on all night. But after I found alot of little errors I made in names of spells and not having worn off message exactly correct, it seems to work pretty well.

I used it other day and it had killed 3-4 rats before I switched back to my main.

I tried switching the root spell though from the 3 minute root to the 1 minute fast cast root, and the macro really didn't like that for some reason. With petryifying I think it was it would cast fine, but if I switched in the 1 minute fast cast root it would keep warping me like crazy and I never could get root off. Theres still a few things just seem act weird but overall it seems to work pretty well after did a few readjustments.
 
With the possibility to fear mobs over Level 55 , the old macro with the fear kiting in fhalls for necros is rocking..unlimited xp :eek:

can leave the toon from level 17 to 70 with max aa's in there
 
really... could you pleas help me out.. i have a48 necro pretty twinked just never got around to getting him 60 like i wanted... could youpleasehelp me out with some kinda macro..... that way i can park my 48mage with him once i get higher and rock them both on up
 
Here is the macro for necro's level 10 to 70..and full aa's ...as they placed the possibility to fear mobs now (i haven't checked but i saw the patched notes)...the macro runs great, all you need to do is launch it , edit the spell list, and the level of the monsters you are hunting...you launch it while you are in the forgotten halls..you need warp for this to work.
offcourse could also add that it actually changes the spell of mobs alone, but takes 2 minutes to change manually.

If you have problems , let me know.

P.S remember this macro is very different from the one before, this one FEARS and kites...not dot and root..the changes were done by zornenecro, and some of the routines by wolf.

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 10
#define MAX_MOB_LVL 23
|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-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
|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 "Haunting Corpse"
|-- 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
#define SUMMON_SPELL
#define SUMMON_GEM 0

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

|-- Name of fear spell
#define FEAR_SPELL "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 "Shadow Compact"
|-- Favorite gem spot for the petheal (1-8)
#define HEAL_PET_GEM 4
#define PET_HASTE "Intensify Death"
#define PET_HASTE_GEM 6
#define LICH_SPELL "Allure of Death"
#define LICH_GEM 8
#define LIFE_DOT "Leach"
#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 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 MQ2Extras
   |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] "Major 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 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
   /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) /megawarp ${Me.Pet.X} ${Me.Pet.Y} ${Me.Pet.Z}
   } else {
       /megawarp s
   }
   /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
           }
           /megawarp -670 1543 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
   /megawarp s
   /delay 1
   /target npc a_harindi_guide
   |/megawarp -30 -827 -11
   /megawarp 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) {
       /megawarp t
       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}>=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 {
       /call FindWP
       /if (${wpY}!=0||${wpX}!=0||${wpZ}!=0) {
           /megawarp ${wpX} ${wpY} ${wpZ}
       } else {
           /if (${Me.Pet.ID}) /megawarp ${Me.Pet.X} ${Me.Pet.Y} ${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
   /megawarp ${bx} ${by} ${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}
   /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
   /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
   /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
/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_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
 
I managed to get a workin warp and I am tryin to run this.
It starts up fine, then picks a target. Then I get the 'usage:/warp <succor|last|target|loc y x z>' message over and over
I tried changing all the megawarps to warps, and the warp s, warp t, to succor and target. Any ideas?
 
If I am using the mq2warp, instead of the mq2megawarp, do I need to go back in and reverse the x's and y's then? I think for megawarp they listed loc's as y x z, just switch them back then?
 
Ok this works with MQ2warp, MQ2jumpy, MQ2Twarp, MQ2Rwarp. Make sure you edit spells/warp. I set this up with my lvl 46 necro so the spells are geared for him. Also on the npc range do /w npc when you first zone in and then edit the macro with the lowest mob to the highest mob, and you should be gtg.

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 37
#define MAX_MOB_LVL 41
|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-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
|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 "Cackling Bones"
|-- 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
#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 "Pact of Shadow"
|-- 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 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 MQ2Twarp
   |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] "Dead Man Floating|8"
  
   |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
   /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>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 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}>=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 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
   /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
 
Dang, I keep gettin beat down in here. 68 nec. Unholy howl spell wears off and they beat on me. Killed one bat in an hour lol. I only have 4700hp, maybe that has something to do with it. Program seems to be working alright, although sometimes it wont send the pet in and I have to do it manually. Also sometimes casts the fear spell first, sometimes the snare first, cant figure that one out.
 
Using your post. Also noting that I am flying through his 5200mp. Seems to be casting the lich dot like every tick or close to it. Is is supposed to cast the snare before the fear spell?
 
Mine pulls with darkness, sends pet, fears.. Recheck all your spell and gem declares. If you want PM me your code and I'll look through it line by line.
 
kk thx Tone, I will sent it to ya. Hehe now its going in and just casting the lich dot and the snare over and over - esp the snare - recasts every tick - even though mob is snared
 
well now i feel stupid i have a lvl 61 necro and i have never done any don missions and my fear spell wont work lol any help on that subject would be helpfull
 
Been using this for a few days. But I noticed two problems with it.

I found that you are a short race, such as a Gnome they could sometimes get stuck under the tables in the rat room. Also on one occasion I noticed I warped into the water and drowned. I added 2 checks to prevent that from happening.

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 18
#define MAX_MOB_LVL 25
|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 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 "Haunting Corpse"
|-- 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 0

#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 "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 "Intensify Death"
#define PET_HASTE_GEM 7
#define LICH_SPELL "Allure of Death"
#define LICH_GEM 6
#define LIFE_DOT "Leach"
#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 8

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

|--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 MQ2Twarp
   |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] "Major 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 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
   /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>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 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}>=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
   /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 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_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
 
aha nice, I never played a gnome , had no idea poor gnomes would be stuck under tables Rofl. :)
 
Thanks for your tweaking Skorli. Also I want to add you sould not put the max level of the mobs as the max to fight. I put 2 levels below max and i seem to be ok so far. At max i had to get out too many times due to low health and resisting of spells. changed the mana to 50% because would run out sometime
 
Mandrack's Necro macro Total AFK macro 55-70 Necro then aa's.

Users who are viewing this thread

Back
Top
Cart