• 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

KissAssist Release KissAssist 6 Updated 05/27/2013 v6.5

Re: KissAssist 6 Updated 03/01/2013 v6.3

What mode is the toon in. Puller and Pullertank always return to camp.

make sure ReturnToCamp=0
/camphere is the in game command to turn it off

out of curiosity, can you pull without being labelled the puller?
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

only with role=hunter that will run you around killing mobs
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

not currently but not a bad idea. I will look into incorporating it into ninjadvloot

Well, if you rip a few lines from the skilling.mac:

Rich (BB code):
| - SUB: Out of Room

#Event OutofRoom "#*#no open slots for the held item#*#"

Sub Event_OutofRoom
    /echo You have run out of room in inventory. 
    /echo Detroying ${Cursor.Name}.
    /popup You have run out of room in inventory!
    /destroy
/return
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

My shaman is having issues buffing my bard puller. After I die and and when I run back to the camp, the shammy will buff Spirit of the Relentless and Spirit of Bih'Li and then just stop. I can sometimes cancel SoR and have him rebuff. Same with SoB. My other toons are fully shammy buffed and if I cancel any of the buffs, he immediately rebuffs but not the bard/puller. Here is my buffs section:

[Buffs]
BuffsOn=1
Buffs1=Preincarnation|Me
Buffs2=NULL
Buffs3=Pact of the Wolf
Buffs4=Talisman of Celerity
Buffs5=Unity of the Soul|Dual|Exigent Focusing
Buffs6=Spirit of Bih`li
Buffs7=NULL
Buffs8=Ancestral Obligation|Mana|90|20
Buffs9=Cannibalization|Mana|80|50
Buffs10=Talisman of the Tribunal
Buffs11=Spirit of the Relentless

Also, Pact of the Wolf will sometimes cast but usually not.

The death routines are little wonky. i rewrote part of them for some future upgrades. kiss 6.4 will address this in the next few weeks.
.



There's more to it than that. Even without a death, the shaman will buff everyone else except my bard/puller. I've parked him in front of the shaman for 20 minutes and no Unity. He buffs others with Unity during that time.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Is you puller running kiss?
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Is you puller running kiss?

No. I play the bard and I have a mage and shaman running KISS 6.3. Thing is I've watched the Shaman when he's rebuffing. He'll hit all toons that are missing Unity but not the bard. It's very strange. Also, it's not totally an issue with just Unity. I've seen him not buff anything when the bard needs all buffs. Usually, I get the buffs I mentioned above but nothing more.

Both the mage and bard have auras running. What about the bard being gone from camp a lot pulling? Could either be causing issues?
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Kiss uses a system thats writes to an ini file. If a toon is not running kiss or a macro with the kissbuff.inc file, Kiss can't see that toon so as far as your shammy knows the bard doesn't exist. I will write a small macro that you can run on the bard that will just allow the other toons to see him and not interfere with anything else.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Kiss uses a system thats writes to an ini file. If a toon is not running kiss or a macro with the kissbuff.inc file, Kiss can't see that toon so as far as your shammy knows the bard doesn't exist. I will write a small macro that you can run on the bard that will just allow the other toons to see him and not interfere with anything else.

I have run KISS on my bard before but it was a month or so since I last did. I wonder if there is something in the ini file that's messing things up. I'll take a look tonight.

Today over lunch, I played a little and KISS was buffing ALL toons properly. The only thing that changed was a system shutdown/restart from last night. I can now cancel Unity on the bard and the shaman will immediately see that it's missing and rebuff. Here comes the strange part. The shaman will rebuff Unity on all the toons immediately after cancelling it on the bard. I'd expect just a bard rebuff. Thanks for helping me with this.

EDIT: I just thought of something that happened last night. I accidentally started KISS on the bard then cancelled it. Could the ini file have gotten updated with the current buffs that included Unity?
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Yes the bard's info would have been there for about 15 min until it got erased.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Yes the bard's info would have been there for about 15 min until it got erased.

So should I expect the shaman to only buff other KISS using toons in the group and I'll to do the bard manually? Just trying to get the take-away info here so I know what to expect. I'm guessing that's how it works and that's why you metioned the small bard macro.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

The shammy will buff themselves normally. If your bard is in the group and in range he will get buffs. I will actually add a feature to twist in Kiss so you can turn off twisting as well without it interfering with playing a bard manually. that way you can play with kiss just using buffs on and everything else off
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Rich (BB code):
#include kissassistbuffs.inc

Sub Main
:Main
/call WriteBuffs
/delay 10s
/goto :Main
/endmacro

Put that into a text file, save as bardbuff.mac then /mac bardbuff
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Thats it in a nutshell. Sub Main needs a /return

Rich (BB code):
#include kissassistbuffs.inc

Sub Main
:Main
/call WriteBuffs
/delay 10s
/goto :Main
/return
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

How do I get my kissassist to quit stopping when my rogue merc gets low on endurance. Im on low level toons so dont worry about it yet. Its just annoying cause it keeps stopping and making me wait. Thanks.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Why would this not work when pick pocketing. The area I added is

Rich (BB code):
#Event  Picked          "You have stolen#*#"

| -------------------------------------------------------------------------------------
| SUB: Pick pocket
| -------------------------------------------------------------------------------------    
    Sub Event_Picked
    /if (${Cursor.ID}) /autoinventory
    /return


Rich (BB code):
| - kissassist.mac v6.3 by Maskoi 03/01/2013
| - KISS Assist - A simple multi class macro
| Requires MQ2Cast, MQ2Exchange. MQ2Melee, MQ2Posse, MQ2MoveUtils, MQ2Rez, MQ2Debuffs, 

ninjadvloot inc file and Extended target window
| Usage - /mac kissassist assist TankName 95 
| or target Main Tank and /mac kissassist assist
| This macro was written exclusively for subscribers of Redguides/NotAddicted.com
| -------------------------------------------------------------------------------------   
#turbo 40

#include ninjadvloot.inc

#Event  AddToIgnore     "#*#AddMobIgnore #1#"
#Event  Burn            "[MQ2] |${BurnText}|" 
#Event  Campfire        "[MQ2] Summon Campfire"
#Event  CantSee         "You cannot see your target."
#Event  CantHit         "You can't hit them from here."
#Event  Camping         "#*#seconds to prepare your camp."
#Event  ChangeVarInt    "[MQ2] Reset #1# #2# #3#"
#Event  FSEQBC          "#1# tells the fellowship, #2#"
#Event  GainSomething   "#*#You have gained|#1#|"
#Event  GoMOn           "#*#been granted a gift of#*#"
#Event  GoMOff          "Your gift of#*#mana fades."
#Event  GotHit          "#*# YOU for#*#points of damage."
#Event  GUEQBC          "#1# tells the guild, #2#"
#Event  ImDead          "You have been slain by#*#"
#Event  ImDead          "You died."
#Event  ImDead          "#*#Returning to Bind Location#*#"
#Event  Joined          "#1# has joined the group."
#Event  KissE           "#*#kissedit#*#"
#Event  MezBroke        "#1# has been awakened by #2#."
#Event  Switch          "#*#Switch Target#*#"
#Event  TaskUpdate      "#*#Your task |#1#| has been updated#*#" 
#Event  ToggleVariable  "[MQ2] toggle #1#"
#Event  ToggleVariable  "[MQ2] toggle #1# #2#"
#Event  TooClose        "Your target is too close to use a ranged weapon!!"
#Event  TooFar          "Your target is too far away, get closer!"
#Event  WornOff         "Your #1# spell has worn off of #2#."
#Event  Zoned           "You have entered#*#"
#Event  Zoned           "LOADING, PLEASE WAIT#*#"
#Event  Picked          "You have stolen#*#"

| -------------------------------------------------------------------------------------
| Sub Main 
| ------------------------------------------------------------------------------------- 
Sub Main 
    | ini file fix for zones with commas in them
    /declare ZoneName string outer ${Zone}
    /if (${ZoneName.Find[,]}) {
        /echo ${ZoneName} has a comma in the name, setting Zone Short Name ...
        /varset ZoneName ${Zone.ShortName}
    }
    /declare MacroName              string      outer       KissAssist
    /declare MacroVer               string      outer       6.3
    /declare IniFileName            string      outer       ${MacroName}_

${Me.CleanName}.ini 
    /declare InfoFileName           string      outer       ${MacroName}_Info.ini
    /declare BuffFileName           string      outer       ${MacroName}_Buffs.ini
    /declare KissAssistVer          string      outer       ${Ini

[${IniFileName},General,KissAssistVer]}
    /if (!${Ini[${IniFileName},General,KissAssistVer].Length}) /ini "${IniFileName}" 

"General" "KissAssistVer" "0.0"
| ************************* Aliases **************************************| 
    /if (${Debug}) /echo ...debug Ini/Alias info ${KissAssistVer.NotEqual[${MacroVer}]} 

"${KissAssistVer}" "${MacroVer}"
    /if (${KissAssistVer.NotEqual[${MacroVer}]}) {
        /echo Version Mismatch Detected, Writing Aliases this can take up to 1 min
        /squelch /alias /looton         /echo toggle LootOn 
        /squelch /alias /buffson        /echo toggle BuffsOn
        /squelch /alias /dpson          /echo toggle DPSOn
        /squelch /alias /meleeon        /echo toggle MeleeOn
        /squelch /alias /healson        /echo toggle HealsOn
        /squelch /alias /peton          /echo toggle PetOn
        /squelch /alias /mezon          /echo toggle MezOn
        /squelch /alias /chase          /echo toggle ChaseAssist
        /squelch /alias /camphere       /echo toggle ReturnToCamp
        /squelch /alias /autofireon     /echo toggle AutoFireOn
        /squelch /alias /autorezon      /echo toggle AutoRezOn
        /squelch /alias /rebuffon       /echo toggle RebuffOn
        /squelch /alias /debug          /echo toggle Debug
        /squelch /alias /debugmez       /echo toggle DebugMez
        /squelch /alias /debugbuffs     /echo toggle DebugBuffs
        /squelch /alias /debugcombat    /echo toggle DebugCombat
        /squelch /alias /debugheal      /echo toggle DebugHeal
        /squelch /alias /debugpull      /echo toggle DebugPull
        /squelch /alias /pettoyson      /echo toggle PetToysOn
        /squelch /alias /afktoolson     /echo toggle AFKToolsOn
        /squelch /alias /addignore      /echo AddMobIgnore 
        /squelch /alias /campfire       /echo Summon Campfire
        /squelch /alias /switch         /echo Switch Target
        /squelch /alias /chasedistance  /echo Reset General ChaseDistance
        /squelch /alias /medstart       /echo Reset General MedStart        
        /squelch /alias /campradius     /echo Reset General CampRadius
        /squelch /alias /assistat       /echo Reset Melee AssistAt
        /squelch /alias /meleedistance  /echo Reset Melee MeleeDistance
        /squelch /alias /dpsskip        /echo Reset DPS DPSSkip
        /squelch /alias /dpsinterval    /echo Reset DPS DPSInterval
        /squelch /alias /maxradius      /echo Reset Pull MaxRadius
        /squelch /alias /maxzrange      /echo Reset Pull MaxZRange
        /squelch /alias /mercassistat   /echo Reset Merc MercAssistAt
        /squelch /alias /kissedit       /echo kissedit
        /ini "${IniFileName}" "General" "KissAssistVer" "${MacroVer}"
    }   
| ************************* General **************************************|      
    | Edit settings in your KissAssist_ToonName.ini file
    /call LoadIni General Role                  string      Assist
    /call LoadIni General CampRadius            int         30
    /call LoadIni General CampRadiusExceed      int         400
    /call LoadIni General ReturnToCamp          int         0
    /call LoadIni General ChaseAssist           int         0
    /call LoadIni General ChaseDistance         int         25
    /call LoadIni General MedOn                 int         1
    /call LoadIni General MedStart              int         25
    /call LoadIni General MedCombat             int         0
    /call LoadIni General LootOn                int         0    
    /call LoadIni General RezAcceptOn           int         0
    /call LoadIni General AcceptInvitesOn       int         1
    /call LoadIni General GroupWatchOn          int         1
    /call LoadIni General EQBCOn                string      0 
	/declare EQBCSay							string 		

outer bc
	/if (${EQBCOn.Arg[2,|].Length} && ${EQBCOn.Arg[1,|].Equal[2]}) {
		/if (${Debug}) /echo ${EQBCOn} ${EQBCOn.Arg[1,|]} ${EQBCOn.Arg[2,|]}
		/varset EQBCSay bct ${EQBCOn.Arg[2,|]}
		/varset EQBCOn 2
	}
    /call LoadIni General MiscGem               int         8 
    /call LoadIni General HoTTOn                int         0
| ************************* Buffs ****************************************|            
    /call LoadIni Buffs BuffsOn                 int         0
    /declare Buffs[20]                          string      outer
    /call LoadIni Buffs Buffs                   string      NULL        Buffs    
    /call LoadIni Buffs RebuffOn                int         1   
| ************************* Melee ****************************************|       
    /call LoadIni Melee AssistAt                int         95
    /if (${Select[${Me.Class.ShortName},BST,BER,MNK,PAL,RNG,ROG,SHD,WAR]}) {
        /call LoadIni Melee MeleeOn             int         1
    } else {
        /call LoadIni Melee MeleeOn             int         0
    }
    /call LoadIni Melee FaceMobOn               int         1
    /call LoadIni Melee MeleeDistance           int         75
    /call LoadIni Melee StickHow                string      snaproll rear
    /call LoadIni Melee AutoFireOn              int         0
| ************************* GoM ****************************************|       
    /if (!${Select[${Me.Class.ShortName},BRD,BER,MNK,ROG,WAR]}) {
        /call LoadIni GoM GoMSHelp              string       "Format - Spell|Target, MA Me 

or Mob, i.e. Rampaging Servant Rk. II|Mob"
        /call LoadIni GoM GoMSpell              string       "Gift of Mana Spell"
    }
| ************************* DPS ******************************************|      
    /call LoadIni AE AEOn                     int         0
    /call LoadIni AE AERadius                 int         50    
    /declare AE[5]                            string      outer
    /call LoadIni AE AE                       string      NULL        AE
| ************************* DPS ******************************************|      
    /call LoadIni DPS DPSOn                     int         0
    /call LoadIni DPS DPSSkip                   int         20
    /call LoadIni DPS DPSInterval               int         2
    /declare DPS[10]                            string      outer
    /call LoadIni DPS DPS                       string      NULL        DPS 
| ************************* Bard *****************************************|  
    /declare IAmABard                   		bool        outer      	

${Me.Class.Name.Equal[Bard]}    
    /if (${IAmABard}) {
        /call LoadIni General TwistOn           int         0 
        /call LoadIni General TwistMed          int         "Mana song gem"          
        /call LoadIni General TwistWhat         string      "Twist order here"  
        /call LoadIni Melee MeleeTwistOn        int         0
        /call LoadIni Melee MeleeTwistWhat      string      "DPS twist order here"
    }
| ************************* Heals ***************************************|            
    /call LoadIni Heals Help                    string      "Format Spell|% to heal at i.e. 

Devout Light Rk. II|50"
    /call LoadIni Heals HealsOn                 int         0
    /if (${Select[${Me.Class.ShortName},CLR,SHM,DRU,PAL]})  {
        /declare Heals[10]                      string      outer
    } else {
        /declare Heals[5]                       string      outer
    }
    /call LoadIni Heals Heals                   string      NULL        Heals   
    /if (${Select[${Me.Class.ShortName},CLR,NEC,SHM,DRU,PAL]}) {
        /call LoadIni Heals AutoRezOn           int         0
        /call LoadIni Heals AutoRezWith         string      "Your Rez Item/AA/Spell"
    }
| ************************* Cures ***************************************|            
    /call LoadIni Cures CuresOn                 int         0
    /if (${Select[${Me.Class.ShortName},CLR,SHM,DRU,PAL]})  {
        /declare Cures[3]                      string      outer
    }
    /call LoadIni Cures Cures                   string      NULL        Cures 
| ************************* Pet *****************************************|             
    /if (${Select[${Me.Class.ShortName},DRU,SHM,BST,ENC,MAG,NEC,SHD]}) {
        /call LoadIni Pet PetOn                 int         0
        /call LoadIni Pet PetSpell              string      "YourPetSpell"
        /if (${Select[${Me.Class.ShortName},BST,MAG,NEC]})  /call LoadIni Pet PetFocus   

string  "NULL"
        /call LoadIni Pet PetShrinkOn           int         0
        /call LoadIni Pet PetShrinkSpell        string      "Tiny Companion"
        /call LoadIni Pet PetBuffsOn            int         0
        /declare PetBuffs[8]                    string      outer
        /call LoadIni Pet PetBuffs              string      NULL        PetBuffs
        /declare PetToysDone                    int         outer       0
        /declare PetToys[10]                    string      outer
        /if (${Select[${Me.Class.ShortName},MAG]}) {
            /call LoadIni Pet PetToysOn            int         0
            /call LoadIni Pet PetToys              string      NULL        PetToys
        }
    }
| ************************* Mez *****************************************|            
    /if (${Select[${Me.Class.ShortName},BRD,ENC,NEC]}) {
        /call LoadIni Mez MezOn                 int         0
        /call LoadIni Mez MezRadius             int         50
        /call LoadIni Mez MezMinLevel           int         "Min Mez Spell Level"
        /call LoadIni Mez MezMaxLevel           int         "Max Mez Spell Level"
        /call LoadIni Mez MezStopHPs            int         80
        /call LoadIni Mez MezSpell              string      "Your Mez Spell"
        | necros can't AE mez
        /if (${Select[${Me.Class.ShortName},BRD,ENC]}) {
            /call LoadIni Mez MezAESpell            string      "Your AE Mez Spell|0"
            /declare MezAECount                     int         outer ${MezAESpell.Arg

[2,|]}
            /varset MezAESpell                      ${MezAESpell.Arg[1,|]}
        }
        /declare MezCount[12]                   int         outer 0
        | /call LoadIni "${Zone}" MaxRadius       int         350   0 ${InfoFileName}
        | This loads and declares the MezImmune var
        /call LoadIni "${ZoneName}" MezImmune string "List up to 10 mobs. Use full names 

i.e. a green snake,a blue tiger,a wide eye ooze or NULL" 0 ${InfoFileName}
    }
| ************************* Burn ****************************************|            
    /declare Burn[6]                            string      outer 
    /call LoadIni Burn  BurnText                string      "Decepticons Attack"
    /call LoadIni Burn  Burn                    string      NULL    Burn
| ************************* Pull ****************************************|            
    /call LoadIni Pull PullWith                 string      "Melee"
	/call LoadIni Pull PullMyHPs               	string      25
    /call LoadIni Pull MaxRadius                int         350
    /call LoadIni Pull MaxZRange                int         50
    /call LoadIni Pull PullWait                 int         0
    /call LoadIni "${ZoneName}" MobsToPull string "List up to 25 mobs. Can be partial names 

Example: rat,snake,bear or ALL for all mobs" 0 ${InfoFileName}
    /call LoadIni "${ZoneName}" MobsToIgnore string "List up to 10 mobs. Use full names 

i.e. a green snake,a blue tiger,a wide eye ooze or NULL" 0 ${InfoFileName}
    /call LoadIni "${ZoneName}" MobsToBurn string "List up to 10 mobs. Use full names i.e. 

Beget Cube,Helias,Raze or NULL" 0 ${InfoFileName}
| ************************* AFKTools ************************************|             
    /call LoadIni AFKTools AFKHelp              string      "AFKGMAction=0 Off, 1 Pause 

Macro, 2 End Macro, 3 Unload MQ2, 4 Quit Game"
    /call LoadIni AFKTools AFKToolsOn           int         0
    /call LoadIni AFKTools AFKGMAction          int         1
    /call LoadIni AFKTools AFKPCRadius          int         150  
| Do Not Edit These *****************************************************|      
    /declare MainAssist             string      outer  
    /declare MainAssistType         string      outer  
    /declare CampZone               int         outer       ${Zone.ID}
    /declare CampXLoc               int         outer       ${Me.X} 
    /declare CampYLoc               int         outer       ${Me.Y}
    /declare CampZLoc               int         outer       ${Me.Z}
    /declare LookForward            int         outer       ${Me.Heading.DegreesCCW} 
    /declare RememberCamp           int         outer       0   
    /declare Attacking              int         outer       0
    /declare PetAttack              timer       outer       0
    /declare Medding                int         outer       0
    /declare MedStat                string      outer   
    /declare MedStat2               string      outer       Endurance 
    /declare Twisting               int         outer       0
    /declare DPSTwisting            int         outer       0
    /declare AddsInCamp             int         outer       0 
    /declare MyTargetID             int         outer       0 
    /declare MyTargetName           string      outer       0 
    /declare ValidTarget            int         outer       0 
    /declare MountOn                int         outer       1
    /declare CastResult             string      outer       
    /declare TanksMob               int         outer       0  
    /declare AggroTargetID          string      outer 
    /declare FailMax                int         outer       3
    /declare Pulled                 int         outer       0
    /declare PullRange              int         outer       0
    /declare PullRangeActual        int         outer
    /declare OrigRanged             string      outer       ${InvSlot[ranged].Item.Name}
    /declare CombatStart            int         outer       0
    /declare Pulling                int         outer       0
    /declare PullTooFar             int         outer       0
    /declare DurationMod            float       outer       1
    /declare MezAETimer             timer       outer       0 
    /declare MezMod                 int         outer       0     
    /declare MobCount               int         outer       0
    /declare AddsArray[50,3]        string      outer       NULL  
    /declare PCsDetected            int         outer       0  
    /declare FailCounter            int         outer       0
    /declare MercInGroup            int         outer       0
    /declare DMZ                    int         outer       ${Select

[${Zone.ID},345,344,202,203,279,151]}
    /declare LastZone               int         outer       0
    /declare JustZoned              timer       outer       0
    /declare JoinedParty            timer       outer       0
    /declare MercAssisting          int         outer       0
    /declare WriteBuffsTimer        timer       outer       0
    /declare ReadBuffsTimer         timer       outer       0
    /declare CheckBuffsTimer        timer       outer       0
    /declare XTSlot                 int         outer       0    
    /declare CantHit                int         outer       0
    /declare PullItem               string      outer       NULL     
    /declare PullAmmo               string      outer       NULL
    /declare BBWindowOpen           int         outer       0
    /declare Debug                  int         outer       0
    /declare DebugMez               int         outer       0
    /declare DebugBuffs             int         outer       0
    /declare DebugCombat            int         outer       0
    /declare DebugHeal              int         outer       0
    /declare DebugPull              int         outer       0
    /declare Redguides              int         outer       1
    /declare GoMActive              int         outer       0
    /declare GoMCast                string      outer       ${GoMSpell.Arg[1,|]}
    /declare GoMTarget              string      outer       ${GoMSpell.Arg[2,|]}
    /declare IniNextTimer           timer       outer       0
    /declare AddSpam                timer       outer       0
    /declare  MyExp                 float       outer       ${Me.PctExp} 
    /declare  MyAAExp               float       outer       ${Me.PctAAExp}
    /declare BagNum                 int         outer       0
    /declare IAmDead                int         outer       0
    /declare NeedCuring             int         outer       0
	/declare PullAlertTimer			timer		outer		0
    | Set AA DurationMod for various timer from Spell Casting Reinforcement AA
    /if (${Me.AltAbility[Spell Casting Reinforcement]}==6)     /varset DurationMod 1.15
    /if (${Me.AltAbility[Spell Casting Reinforcement]}==12)    /varset DurationMod 1.3
    /if (${Me.AltAbility[Spell Casting Reinforcement]}==20)    /varset DurationMod 1.5
    /if (${Me.AltAbility[Spell Casting Reinforcement]}==28)    /varset DurationMod 1.7
    | Set AA DurationMod for mez timer from Spell Casting Reinforcement AA
    /if (${Me.AltAbility[Mesmerization Mastery]}==12)    /varset MezMod 6
    /if (${Me.AltAbility[Mesmerization Mastery]}==20)    /varset MezMod 12
    /if (${Me.AltAbility[Mesmerization Mastery]}==28)    /varset MezMod 18
    | Compensate for Eyes Wide open AA and Extended Target Window
    /declare n int local
    /declare XSlotTotal int outer 5
    /declare AutoHaterCount int local 0
    /if (${Me.AltAbility[Eyes Wide Open]}==5)      /varset XSlotTotal 6
    /if (${Me.AltAbility[Eyes Wide Open]}==10)     /varset XSlotTotal 7
    /if (${Me.AltAbility[Eyes Wide Open]}==20)     /varset XSlotTotal 8
    /if (${Me.AltAbility[Eyes Wide Open]}==30)     /varset XSlotTotal 9    
    /if (${Me.AltAbility[Eyes Wide Open]}==40)     /varset XSlotTotal 10        
    /for n 1 to ${XSlotTotal}
        /if (${Me.XTarget[${n}].Type.Equal[Auto Hater]}) {
            /if (${XTSlot}==0) /varset XTSlot ${n}
            /varcalc AutoHaterCount ${AutoHaterCount}+1
        }
    /next n
    /if (${XTSlot}==0) {
        /echo You have no slots in your Extended Target Window set to Auto.
        /echo Please set at least 1 slot to Auto and restart KissAssist.
        /end
    }    
    /noparse /varset AggroTargetID ${Me.XTarget[${XTSlot}].ID} 
| ************************* Merc ****************************************|          
    /call LoadIni Merc Help                     string      "To use: Turn off Auto Assist 

in Manage Mercenary Window" 
    /call LoadIni Merc MercOn                   int         0
    /call LoadIni Merc MercAssistAt             int         92
    /if (${Select[${Me.Class.ShortName},BST,BRD,CLR,DRU,ENC,MAG,NEC,PAL,RNG,SHM,SHD,WIZ]}) 

/varset MedStat Mana
    /if (${Select[${Me.Class.ShortName},BER,MNK,ROG,WAR]}) /varset MedStat Endurance 
    /declare i int local
    | Declare timers for DPS duration spells and Attack buffs
    /for i 1 to ${DPS.Size}
        /declare DPSTimer${i}       timer         outer 5
        /declare ABTimer${i}        timer         outer 0
        /declare FDTimer${i}        timer         outer 0
        
    /next i 
    | Declare timers for Heal duration spells
    /declare j int local
    /declare k int local
    /for j 1 to ${Heals.Size}
        | Group Heal duration timers
        /declare SpellGH${j}    timer   outer   0
        /for k 0 to 7
            | Self and MA duration heal timers for  out of group
            /declare Spell${j}GM${k}     timer   outer   0
            /if (${Debug}) /echo ...debug Group heal Timers Spell${j}GM${k} ${Spell${j}GM

${k}}
        /next k
    /next j

    | Declare timers for mezzing
    /declare l int local
    /for l 1 to 10
        /declare MezTimer${l} timer outer 0
        /declare MMTimer${l} timer outer 0
    /next l
    | Declare timers for Rez duration spells 
    /declare m int local
    /for m 1 to 5
        /declare BattleRezTimer${m} timer outer 0
    /next m 
    | Declare timers for Buff duration spells
    /declare o int local
    /declare p int local
    /for o 1 to ${Buffs.Size}
        /for p 0 to 7
            /declare Buff${o}GM${p}     timer   outer   0
            /if (${Debug}) /echo ...debug Buff Timers:Buff${o}GM${p} ${Buff${o}GM${p}}
        /next p
    /next o
    | Declare timers for Pet heals
    /declare q int local
    /for q 1 to ${Heals.Size}
        /declare PetHealTimer${q} timer outer 0
    /next q
| -------------------------------------------------------------------------------------
| Check if required plugins are loaded and settings
| -------------------------------------------------------------------------------------    
    /call CheckPlugin MQ2Cast
    /call CheckPlugin MQ2Debuffs
    /call CheckPlugin MQ2Exchange     
    /call CheckPlugin MQ2Melee
    /call CheckPlugin MQ2Moveutils
    /call CheckPlugin MQ2Posse
    /call CheckPlugin MQ2Rez
    /if (${IAmABard}) /call CheckPlugin MQ2Twist
    |  Turn aggro mode off and turn on melee mode in MQ2Melee
        /squelch /melee aggro=0
        /squelch /melee melee=1
        /squelch /melee stickbreak=1
        /squelch /melee petassist=0
        /squelch /melee on
        /squelch /melee stickmode=0
    |  Set MQ2moveutils variables
    /stick set moveback 12
    /stick set verbflags 0
    /stick set breakonkb on
    /stick set breakonmouse off
    /stick set breakdist ${CampRadiusExceed}
    /stick set breakonwarp on
    /stick set usefleeing on
    /stick set delaystrafe on
    | Set up MQ2rez if RezAcceptOn=1
    /if (${RezAcceptOn}) {
        /squelch /rez accept on
        /squelch /rez loot off
    } else /squelch /rez accept off
    /posse radius ${AFKPCRadius}
    /posse friendnotify off
    | Initialize variables for ninjadvloot.inc include file
    /call SetupAdvLootVars 
    /if (${HealsOn}) /call SortArray Heals 100|100 <
    /if (${DPSOn}) /call SortArray DPS 0|0 >
    | /if (${AEOn}) /call SortArray2 AE 3 <
    | /if (${BuffsOn}) /call SortArray2 Buffs 20 <   
| -------------------------------------------------------------------------------------
| Assign Main Tank from command line parameter or targeted player, merc or pet
| -------------------------------------------------------------------------------------     

   
    /if (${Defined[Param0]}) {
        /varset Role ${Param0} 
    }
    /if (!${Defined[Param1]}) { 
        /if (!${Spawn[${Target}].ID} && ${Select[${Role},tank,pullertank,puller,hunter]}) {
            /target ${Me}
            /delay 10
        }
        /varset MainAssist ${Target.CleanName}
        /varset MainAssistType ${Target.Type}
    } 
    | Check command line for tank name
    /if (${Defined[Param1]}) {
        /varset MainAssist ${Param1} 
        /delay 10
        /target id ${Spawn[${MainAssist}].ID}
        /delay 10 ${Target.ID}==${Spawn[${MainAssist}].ID}
        /varset MainAssistType ${Target.Type}
    }
    | Error control no tank selected end macro
    /if (!${Spawn[${Target}].ID} || !${Select[${Target.Type},Mercenary,PC,Pet]} || 

${Me.Type.Equal[corpse]}) {
        /echo You do not have a Mercenary, PC or Pet targeted. Please target Main Tank and 

restart macro.
        /end
    }
    | Targeted myself end macro
    /if (${Target.CleanName.Equal[${Me.CleanName}]} && (${Role.Equal[assist]} || 

${Role.Equal[puller]})) {
        /echo You cannot assist yourself! Please target Main Tank and restart macro.
        /end
    }
    /if (${Defined[Param2]} && ${Role.NotEqual[tank]}) {
        /varset AssistAt ${Param2} 
    } 
    /call CheckRoles
    /echo ================================
    /echo Redguides presents   
    /echo ${MacroName} v.${MacroVer} by Maskoi 
    /echo ================================
    /if (${Select[${Role},tank]}) {
        /if (${MainAssist.Equal[${Me}]}) {
            /echo I am Tanking & Main Assist
        } else {
           /echo  I am Tank & KissAssisting >> ${MainAssist} <<
        }
    } else /if (${Select[${Role},puller]}) {
        /echo I am Puller. KissAssisting >> ${MainAssist} << at ${AssistAt}% 
    } else /if (${Select[${Role},pullertank]}) {
        /echo I am Puller & Tank. 
    } else /if (${Select[${Role},hunter]}) {
        /echo I am Hunting. 
    } else {
        /echo KissAssisting >> ${MainAssist} << at ${AssistAt}%
    }
    /squelch /target clear
    /squelch /assist off
    /if (${Navigation.MeshLoaded})  /echo The MQ2Navigation mesh for ${Zone} is loaded.
| -------------------------------------------------------------------------------------
| Main Loop
| -------------------------------------------------------------------------------------   
        :MainLoop
            /doevents
            /call AFKTools
            /call CheckForAdds MainLoop
            /call DoMezStuff
            /call WriteDebuffs
            /call CheckHealth
            /call CheckCures
            /call DoWeMove
            /call RezCheck
            /call DoMiscStuff
            /call CanIDoStuff
            /call MercsDoWhat
            /call DoPetStuff
            /call CheckPetBuffs
            /call WriteBuffs
            /call CheckBuffs
            /call DoBardStuff
            /call DoWeMed            
            /call GroupWatch
            /call FindMobToPull
            /call Assist
            /call Combat
            /call LootStuff
        /goto :MainLoop     
/return
| -------------------------------------------------------------------------------------
| SUB: Assist - Get Main Tank's target
| -------------------------------------------------------------------------------------
    Sub Assist
        /doevents
        /if (${DMZ} || !${MeleeOn} && !${DPSOn} || ${Pulled} && ${MyTargetID} && 

${MainAssist.Equal[${Me}]}) /return
        /declare HighestLevelID int local 0
        /declare i int local
            /doevents
            /if (${DebugCombat}) /echo Assist: Enter
            /if (${ChaseAssist}) /call DoWeMove
            /if (${Spawn[${MainAssist} ${MainAssistType}].ID} && ${MainAssist.NotEqual

[${Me}]} && ${Spawn[${MainAssist}].Distance}<200) {
                /assist ${MainAssist}
            } else /if (!${Spawn[${MainAssist} ${MainAssistType}].ID} && ${AggroTargetID}) 

{
                /squelch /target id ${AggroTargetID}
            }        
            /if ((${MainAssist.Equal[${Me}]} || ${Select[${Role},tank,pullertank]}>0) && !

${Me.Hovering} && ${AggroTargetID}) {
                | If adds and tanking grab highest level mob to kill first.
                /call MobRadar ${MeleeRadius}
                /if (${MobCount}>1) {
                    /varset HighestLevelID ${AddsArray[1,1]}
                    /for i 1 to ${MobCount}
                        /if (${Spawn[${HighestLevelID}].Level}<${AddsArray[${i},2]} && 

${Spawn[${HighestLevelID}].Distance}<${MeleeDistance}) /varset HighestLevelID ${AddsArray

[${i},1]}
                    /next i
                    /squelch /target id ${HighestLevelID} 
                } else {
                    /squelch /target id ${AggroTargetID}
                } 
            } 
            /delay 5
            | 3 sec delay to be able to target toons for buffs
            /if (${Target.Type.Equal[pc]} || ${Target.Type.Equal[mercenary]} && !

${AggroTargetID}) /delay 30
            /call ValidateTarget
            /if (${DebugCombat}) /echo Target:${Target.CleanName} ValidTarget:

${ValidTarget} Marco Return:${Macro.Return}
        /if (${ValidTarget}==0) {
            /squelch /target clear
            /varset MyTargetID 0
            /varset MyTargetName 
            /return
        }
        /varset MyTargetID ${Target.ID}
        /varset MyTargetName ${Target.CleanName}
        /if (${DebugCombat}) /echo MyTargetName:${MyTargetName} ID:${MyTargetID}
        /if (${DebugCombat}) /echo Assist: Leave
    /return
| -------------------------------------------------------------------------------------
| SUB: Validate Target
| ------------------------------------------------------------------------------------- 
    Sub ValidateTarget
        /if (${DebugCombat}) /echo ValidateTarget Enter Name:${Target.CleanName} ID:

${Target.ID}
        /declare i int local
        /declare j int local
        /declare k int local
        /declare n int local
        /declare XTValid int local 0
        /declare PullValid int local 0
        /varset ValidTarget 0
        /if (!${Target.ID}) /return NoTarget
        /if (${DebugCombat}) /echo Validate 1
        /if (${Select

[${Target.Type},AURA,BANNER,CAMPFIRE,CORPSE,CHEST,ITEM,TRIGGER,TRAP,TIMER,TRIGGER,MOUNT,Mer

cenary]}) /return BadTargetType
        /if (${DebugCombat}) /echo Validate 2
        | If mob found on ignore and not on xtarget skip
        /if (${MobsToIgnore.Find[${Target.CleanName}]} && ${Select[${Target.ID},

${Me.XTarget[1].ID},${Me.XTarget[2].ID},${Me.XTarget[3].ID},${Me.XTarget[4].ID},

${Me.XTarget[5].ID},${Me.XTarget[6].ID},${Me.XTarget[7].ID},${Me.XTarget[8].ID},

${Me.XTarget[9].ID},${Me.XTarget[10].ID}]}==0) /return MobOnIgnoreList
        | Check if target is somewhere on my extexnded target.
        /if (${Select[${Role},tank]} && ${MobCount}<=${XSlotTotal}) {
            /for n 1 to ${XSlotTotal}
                /if (${Target.ID}==${Me.XTarget[${n}].ID}) {
                    /varset XTValid 1
                    /goto :XTValidSkip
                }
            /next n
            :XTValidSkip
            /if (!${XTValid}) /return NotOnXTarget
        }        
        /if (${DebugCombat}) /echo Validate 3
        /if (${Pulling} && !${Pulled}) {
            /if (${Math.Distance[${Target.Y},${Target.X}:${CampYLoc},${CampXLoc}]}>

${MaxRadius}) /return OutofRadius
            /if (${Select[${Role},puller,pullertank]} && !${Target.LineOfSight} && !

${Navigation.MeshLoaded}) /return NoLOS
            /if (${SpawnCount[loc ${Target.Y} ${Target.X} radius 15 pc]}>=1 && ${Pulling} 

&& ${Math.Distance[${Target.Y},${Target.X}:${Me.Y},${Me.X}]}>=15) /return PCNear
            /if (${Target.PctHPs}<=99) /return PullNotFullHealth
            /if (${DebugPull} && !${MobsToPull.Find[null]}) /echo ... debug_pull 

ValidateTarget ${MobsToPull}
            /if (${MobsToPull.Find[All]}) /goto :SkipPullValidate
            /for j 1 to 25
                /if (${DebugPull}) /echo ... debug_pull ValidateTarget ${j} 

${MobsToPull.Arg[${j},,]} ${Target.CleanName.Find[${MobsToPull.Arg[${j},,]}]}
                /if (${Target.CleanName.Find[${MobsToPull.Arg[${j},,]}]}) {
                    /varset PullValid 1
                    /goto :SkipPullValidate
                }
            /next j
            /if (!${PullValid}) /return PullMobNotonList
            :SkipPullValidate
        }
        /if (${DebugCombat}) /echo Validate 4
        /if (${Target.Type.Equal[Pet]} && ${Target.Master.Type.Equal[PC]}) /return PET-PC
        /if (!${Select[${MacroQuest.Server},zek]} && ${Select[${Target.Type},PC]}) /return 

PC
        | This prevents characters on the Zek server from attacking PC targets in their 

group
        /if (${Select[${MacroQuest.Server},zek]} && ${Select[${Target.Type},PC]}) {
            /for i 0 to 5
                /if (${Target.ID}==${Group.Member[${i}].ID}) /return GroupMember
            /next i
            /if (${Target.ID}==${Spawn[${MainAssist} ${MainAssistType}].ID}) /return MA     

     
        }
        /varset ValidTarget 1
        /if (${DebugCombat}) /echo ValidateTarget: Leave
    /return ${ValidTarget}
| -------------------------------------------------------------------------------------
| SUB: Combat
| -------------------------------------------------------------------------------------
    Sub Combat
        /doevents
        /if (${HealsOn}) /call CheckHealth
        /if (!${MyTargetID} || !${Target.ID} || ${DMZ} || !${Target.LineOfSight}) /return
        /if (${DebugCombat}) /echo Combat: Enter
        /if (${ChaseAssist}) /call DoWeMove
        /declare CombatRadius int local ${MeleeDistance}
        /declare ZDist float local ${Math.Distance[${Target.Z}:${Me.Z}]}
        /if (${MezOn}) /call DoMezStuff 
        | Check Target Hps and type NPC or NPC Pet
        /if (${DebugCombat}) /echo ${Spawn[${MyTargetID}].PctHPs}<=${AssistAt} && ${Spawn

[${MyTargetID}].Distance}<${CombatRadius}
         /if (${Select[${Role},pettank]} && ${Spawn[${MyTargetID}].Distance}<

${CombatRadius}) /call Combatpet
        /if (${Spawn[${MyTargetID}].PctHPs}<=${AssistAt} && ${Spawn

[${MyTargetID}].Distance}<${CombatRadius}) {
            /if (!${CombatStart}) {
                /if (${DebugCombat}) /echo Combat Start
                /varset MercAssisting 0
                /varset CombatStart 1
                /echo  ATTACKING -> ${Spawn[${MyTargetID}].CleanName} <- 
                /if (${EQBC.Connected} && ${EQBCOn} && ${Select

[${Role},Tank,PullerTank,Hunter]}) /docommand  /${EQBCSay} [+y+]TANKING-> ${Spawn

[${MyTargetID}].CleanName} <- ID:${MyTargetID}[+x+]
                /if (${Group}==1 && ${Select[${Role},puller]} && ${Group.Puller.Name.Equal

[${Me}]} && ${Spawn[${MainAssist}].Type.Equal[Mercenary]} && ${Math.Distance[${CampYLoc},

${CampXLoc}]}<${CampRadius}) /call AssignGroupRole unset "${Me.CleanName}" 3
            }
            /if (${FaceMobOn} && ${Target.ID}) /face fast
            /if (${MeleeOn} && !${Attacking}) {
                /varset Attacking 1
                /if (${Me.Sitting}) /stand
                /if (!${AutoFireOn}) {
                    /if (${DebugCombat}) /echo Attack On
                    | Speed up tanks attacking inc mobs MQ2Melee /killthis can cause a 

delay
                    /if (${Select[${Role},tank,pullertank,hunter]}) {
                        /if (${Me.Ability[taunt]} && ${Me.AbilityReady[taunt]})  /doability 

taunt
                        /attack on
                        /stick ${StickHow} 13 id ${MyTargetID}
                    }
                    /killthis
                    /if (${StickHow.NotEqual[0]}) /stick ${StickHow} 12 id ${MyTargetID}
                    | Move closer if Z distance more than 4 due to levitation 
                    /call ZCheck ${ZDist} 4.1
                }
                /if (${MeleeOn} && ${AutoFireOn} && !${Me.AutoFire}) {
                    /if (${DebugCombat}) /echo Autofire on
                    /echo Autofire On 
                }
            } 
            /varset  MyExp ${Me.PctExp} 
            /varset  MyAAExp ${Me.PctAAExp}
            :Attack
                /doevents
                /if (${MercOn} && !${MercAssisting} && ${MyTargetID}) /call MercsDoWhat
                /if (${MezOn}) /call DoMezStuff 
                /if (${AEOn}) /call AECheck
                /if (${PetOn}) /call CombatPet
                /if (${HealsOn}) /call CheckHealth  
                /if (${CuresOn}) /call CheckCures
                /if (${DPSOn}) /call CombatCast 
                /call CheckBuffs
                /call WriteDebuffs
                /if (${IAmABard}) /call DoBardStuff
                /if (${DPSOn} || ${MeleeOn}) /call CombatTargetCheck
                /if (${Attacking} && ${MeleeOn} && ${Target.PctHPs}<=${Math.Calc

[${AssistAt}-5]} && ${Target.Distance}<${CombatRadius} && !${AutoFireOn}) {
                    /if (!${Me.Combat}) {
                        /if (${Me.Sitting}) /stand
                        /killthis
                    }
                    /if (${StickHow.NotEqual[0]} && !${Stick.Active} && ${Target.Distance}

>15) /stick ${StickHow} id ${MyTargetID}               
                }
                /if (${CombatStart} && ${AutoFireOn}) {
                    /range
                }
                /if (${Spawn[${MyTargetID}].Type.Equal[Corpse]} || !${Spawn

[${MyTargetID}].ID}) {
                    /call CombatReset
                    /call CheckForAdds Combat
                    | Random 1-2 sec delay so eveyone doesn't return to camp at once
                    /if (${ReturnToCamp} && ${MainAssist.NotEqual[${Me}]}) {
                        /delay ${Math.Calc[${Math.Rand[1]}+1]}s
                        /call DoWeMove
                    }
                    /return
                }
            /if (${Spawn[${MyTargetID}].Type.NotEqual[Corpse]} || ${Spawn

[${MyTargetID}].ID} || ${Melee.Status.NotEqual[FEIGNING]}) /goto :Attack
        }
        /if (${DebugCombat}) /echo Combat: Leave 
    /return
| -------------------------------------------------------------------------------------
| SUB: CombatTargetCheck
| -------------------------------------------------------------------------------------
    Sub CombatTargetCheck
        /if (${Target.ID}!=${MyTargetID} && ${Spawn[${MyTargetID}].ID}) {
            /squelch /target id ${MyTargetID}
            /delay 10 ${Target.ID}==${MyTargetID}
        }
    /return
| -------------------------------------------------------------------------------------
| SUB: Combat Cast
| -------------------------------------------------------------------------------------
    Sub CombatCast
        /if (${DebugCombat}) /echo CombatCast: Enter
        /declare i int local 0
        /declare DPSText string local
        /declare DPSAt int local ${AssistAt}
        /declare DPSTargetID int local ${MyTargetID}  
        /declare DPSItem string local  
        /for i 1 to ${DPS.Size}
		  /if (${DebugCombat}) /echo ${DPS[${i}]} ${DPS[${i}].Arg[1,|]} ${DPS

[${i}].Arg[2,|]} ${DPS[${i}].Arg[3,|]}
            /doevents
            /if (${Spawn[${MyTargetID}].Type.Equal[Corpse]} || !${Spawn[${MyTargetID}].ID}) 

 /return
            /if (!${DPS[${i}].Length}) /return
            /if (${MezOn}) /call DoMezStuff
            /if (${MercOn} && !${MercAssisting} && ${MyTargetID}) /call MercsDoWhat
            /if (${PetOn}) /call CombatPet
            /if (${HealsOn}) /call CheckHealth
            /if (${CuresOn}) /call CheckCures
            /call CombatTargetCheck
            /if (${DebugCombat}) /echo ${DPS[${i}]} ${DPS[${i}].Arg[1,|]} ${DPS[${i}].Arg

[2,|]} ${DPS[${i}].Arg[3,|]}
            | - Check for 2nd value in dps for mob health
            /if (${DPS[${i}].Arg[2,|].Length}) {
                /varset DPSText ${DPS[${i}]} 
                /varset DPS[${i}] ${DPSText.Arg[1,|]}           
                /varset DPSAt ${DPSText.Arg[2,|]}
                /if (${DPSOn}==2) /varset DPSAt ${AssistAt}
                /if (${DPSText.Arg[3,|].Find[MA]}) /varset DPSTargetID ${Spawn

[${MainAssist} ${MainAssistType}].ID}
                /if (${DPSText.Arg[3,|].Find[Me]}) /varset DPSTargetID ${Me.ID}
                /if (${DPSText.Arg[3,|].Find[Feign]}) /varset DPSTargetID ${Me.ID}
                /if (${DebugCombat}) /echo ${DPS[${i}].Arg[1,|]} ${DPSAt} ${DPSTargetID}
            }
            /if (${Target.PctHPs}>${DPSAt} || ${Target.PctHPs}<${DPSSkip} || ${DPS

[${i}].Equal[NULL]} || ${ABTimer${i}} || ${DPSTimer${i}} || ${FDTimer${i}} || (!${Select

[${MacroQuest.Server},zek]} && ${Target.Type.NotEqual[NPC]} )) /goto :skipcast
                /if (${DebugCombat}) /echo CombatCast: "${DPS[${i}]}" Target: ${Target.ID} 

Timer: ${DPSTimer${i}}
                /if (${Select[${DPSText.Arg[3,|]},Me,MA]} && ${Me.Combat} && 

${MainAssist.NotEqual[${Me}]}) {
                    /attack off
                    /delay 10 !${Me.Combat}
                }
                /call CastWhat "${DPS[${i}]}" ${DPSTargetID}
                /if (${DebugCombat}) /echo CombatCast: ${Macro.Return}
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                    /echo ** ${DPS[${i}]} on >> ${Spawn[${DPSTargetID}].CleanName} <<
                    | Timers for items
                    /if (${FindItemCount[=${DPS[${i}]}]}) {
                        /varcalc DPSTimer${i} ${FindItem[=${DPS

[${i}]}].Spell.Duration.TotalSeconds}*10
                        /goto :skipcast
                    | FD to lose aggro
                    } else /if (${Select[${Me.Class.ShortName},MNK,NEC,SHD]} && 

${DPSText.Arg[3,|].Find[Feign]}) {
                        /varset FDTimer${i} 60s
                        /delay 10s ${Me.State.NotEqual[FEIGN]}
                        /if (${Me.State.Equal[FEIGN]} && !${Me.Sitting}) /stand
                    | Timers for spells
                    } else /if (${Me.Book[${DPS[${i}]}]}) {
                        | - Attack Buff Timers are seperate. DPS timers are cleared after 

every fight.
                        /if (${Select[${DPSTargetID},${Me.ID},${Spawn[${MainAssist}].ID}]}) 

{
                            /varcalc ABTimer${i} (${Spell[${DPS

[${i}]}].Duration.TotalSeconds}*${DurationMod})*10
                            /if (${DebugCombat}) /echo Spell:${DPS[${i}]} Timer:ABTimer${i} 

Time:${ABTimer${i}}
                            /goto :skipcast
                        | - Custom timer for cleric and wizzie pets
                        } else /if (${Me.Class.Name.Equal[Cleric]} && (${DPS[${i}].Find

[Zeal]} || ${DPS[${i}].Find[Unswerving]}) || ${Me.Class.Name.Equal[Wizard]} && (${DPS

[${i}].Find[sword]} || ${DPS[${i}].Find[blade]})) {
                            /varset DPSTimer${i} 5m
                            /goto :skipcast
                        | - Custom timer for counterbias
                        } else /if (${Me.Class.Name.Equal[Shaman]} && ${DPS[${i}].Find

[counterbias]}) {
                            /varset DPSTimer${i} 1.5m
                            /goto :skipcast
                        | Custom timer for Beastlord Feralgia Timer
                        } else /if (${Me.Class.Name.Equal[Beastlord]} && ${DPS[${i}].Find

[feralgia]}) {
                            /varset DPSTimer${i} 1.5m
                            /goto :skipcast
                        | Regular spells
                        } else /if (${Spell[${DPS[${i}]}].Duration}>0) {
                            /varcalc DPSTimer${i} ${Spell[${DPS

[${i}]}].Duration.TotalSeconds}*10
                            /goto :skipcast
                        | Spells with no timers assign DPS interval
                        } else {
                            /varset DPSTimer${i} ${DPSInterval}s
                            /goto :skipcast
                        }
                    | AA and disc timers
                    } else /if (${Spell[${DPS[${i}]}].Duration}>0) {
                        /varcalc DPSTimer${i} ${Spell[${DPS[${i}]}].Duration.TotalSeconds}

*10
                        /goto :skipcast
                    | AA and disc with no timers assign DPS interval
                    } else {
                        /varset DPSTimer${i} ${DPSInterval}s
                        /goto :skipcast
                    }
                }
            :skipcast
            /if (${DebugCombat}) /echo ${DPS[${i}]} ${Macro.Return} DPSTimer${i} 

${DPSTimer${i}}
            /if (${Select[${DPSText.Arg[3,|]},Me,MA]}) /call CombatTargetCheck
            | Reset values if 2nd value in dps for mob health exists
            /if (${DPSText.Arg[2,|].Length}) {
                /varset DPS[${i}] ${DPSText}           
                /varset DPSAt ${AssistAt}
                /varset DPSText 
                /varset DPSTargetID ${MyTargetID}
            }
        /next i
        /if (${DebugCombat}) /echo CombatCast: Leave
    /return
| -------------------------------------------------------------------------------------
| SUB: CombatPet
| -------------------------------------------------------------------------------------    
    Sub CombatPet
    /if (${PetAttack}) /return
        /declare AttackDelay int local 0
        /if (${Select[${Role},tank,pullertank,hunter]}) /varset AttackDelay 5
        /if (${Select[${Role},pettank]}) /varset AttackDelay 0
        /if (${Me.Pet.ID} && ${PetAttack}) /return
        /call CombatTargetCheck
        /if (${Target.PctHPs}<=${Math.Calc[${AssistAt}-${AttackDelay}]}) { 
            /pet attack
            /delay 5
            /varset PetAttack 200
        }
    /return
| -------------------------------------------------------------------------------------
| SUB: CombatReset
| -------------------------------------------------------------------------------------
    Sub CombatReset
        /if (${DebugCombat}) /echo CombatReset: Enter
        /if (${MyTargetID} && ${CombatStart}) {
            /echo SLAIN >> ${MyTargetName} << EXP: ${If[${Me.PctExp}<${MyExp},${Math.Calc

[100-${MyExp}+${Me.PctExp}]},${Math.Calc[${Me.PctExp}-${MyExp}]}]}% AAEXP: ${If

[${Me.PctAAExp}<${MyAAExp},${Math.Calc[100-${MyAAExp}+${Me.PctAAExp}]},${Math.Calc

[${Me.PctAAExp}-${MyAAExp}]}]}% 
            /popup SLAIN >> ${MyTargetName} << EXP: ${If[${Me.PctExp}<${MyExp},${Math.Calc

[100-${MyExp}+${Me.PctExp}]},${Math.Calc[${Me.PctExp}-${MyExp}]}]}% AAEXP: ${If

[${Me.PctAAExp}<${MyAAExp},${Math.Calc[100-${MyAAExp}+${Me.PctAAExp}]},${Math.Calc

[${Me.PctAAExp}-${MyAAExp}]}]}% 
        }
        /declare i int local
        /declare j int local
        /call MobRadar ${MeleeDistance}
        /for j 1 to 50
            /if (${AddsArray[${j},1].Equal[${MyTargetID}]}) /call RemoveFromArray ${j}
            /if (${MobCount}==0) /call RemoveFromArray ${j}
        /next j
        /varset MyTargetID 0
        /varset MyTargetName
        /varset ValidTarget 0
        /varset MercAssisting 0
        /varset CombatStart 0
        /varset Pulled 0
        /call PullReset
        /squelch /attack off
        /squelch /target clear
        /varset Attacking 0    
        /for i 1 to ${DPS.Size}
            /varset DPSTimer${i} 0
            /varset FDTimer${i}  0
        /next i
        /if (${IAmABard}) /call DoBardStuff
        /if (${Me.Pet.ID}) {
            /varset PetAttack 0
            /pet back off
            /if (${Me.AltAbility[Pet Discipline]}) /pet hold on
            /if (${Select[${Role},puller,pullertank]} && ${Math.Distance[${CampYLoc},

${CampXLoc}]}<=${CampRadius}) /pet guard
        }
        /if (!${TwistOn} && ${MeleeTwistOn}) /varset DPSTwisting 0
        /if (${LootOn}) /call LootStuff
        /if (${DebugCombat}) /echo CombatReset: Leave 
    /return
| -------------------------------------------------------------------------------------
| SUB: Check for adds
| -------------------------------------------------------------------------------------
    Sub CheckForAdds(CalledFrom)
        /doevents
        /if (${Debug}) /echo  ...debug  CheckForAdds: Enter from ${CalledFrom}
        /call MobRadar ${MeleeDistance}
        /if (${Debug}) /echo ...debug MobCount:${MobCount}
        | If no mobs, in a DMZone  or pulling leave
        /if (!${MobCount} || ${DMZ} || ${Pulling} || !${DPSOn} && !${MeleeOn} || ${Select

[${Role},puller,pullertank]} && ${Math.Distance[${CampYLoc},${CampXLoc}]}>=${CampRadius} || 

${IAmDead})  /return
        | If I have a vailid living target in camp radius leave 
        /if (!${Target.ID} && ${MyTargetID} && ${Spawn[${MyTargetID}].ID} && ${Spawn

[${MyTargetID}].Distance}<${CampRadius}) {
            /target id ${MyTargetID}
            /return
        }
        :moreadds
            | Spam Adds in camp
            /if (${AggroTargetID} && ${Target.Distance}<${CampRadius} && !${MyTargetID} && 

!${AddSpam}) {
                /popup Add(s) in camp detected 
                /echo Add(s) in camp detected
                /if (${EQBC.Connected} && ${EQBCOn} && (${MainAssist.Equal[${Me}]} || 

${Select[${Role},tank,pullertank]})) /docommand  /${EQBCSay} [+r+]Add(s) in camp detected

[+x+]
                /if (${Select[${Role},pullertank]}) /varset Pulled 0
                /varset AddSpam 5s
            }
            | Prevent puller from stalling if adds in camp and still returning from pulling 

mob.
            /if (${Select[${Role},puller,pullertank]} && ${Pulled} && ${Math.Distance

[${CampYLoc},${CampXLoc}]}>=15) /return
            /varset AddsInCamp 1
            /call Assist
            /if (!${Target.ID} && ${Select[${Role},tank,pullertank]}) /squelch /target ID 

${Spawn[${AggroTargetID}].ID}
            /if (${MezOn}) /call DoMezStuff 
            /if (${DoHeals}) /call CheckHealth
            /if (${CuresOn}) /call CheckCures
            /call Assist
            /call Combat
            /call MobRadar ${MeleeDistance}
         /if (${MobCount}>0 && ${AggroTargetID}) /goto :moreadds
        /varset AddsInCamp 0
        /if (${Debug}) /echo ...debug CheckForAdds: Leave
    /return
| -------------------------------------------------------------------------------------
| SUB: CastWhat
| -------------------------------------------------------------------------------------
    Sub CastWhat(string castWhat,int castTargetID)
        /if (${Debug}) /echo  CastWhat: Enter castWhat - ${castWhat} castTargetID - 

${castTargetID}
        /declare WasTwisting bool local ${Twist}
        /varset CastResult CAST_FAIL
        /if (${Me.CombatAbility[${castWhat}]} && !${Me.CombatAbilityTimer[${castWhat}]}) {
            /if (${WasTwisting}) {
                /twist off
                /delay 20 !${Twist}
            }
            /target id ${castTargetID}
            /delay 10 ${Target.ID}==${castTargetID}
            /disc ${castWhat}
            /varset CastResult CAST_SUCCESS
			/call CheckCasting 300 
        }
        | - Check & cast if item
        /if (${FindItem[=${castWhat}].ID} && ${FindItem[${castWhat}].Timer}==0) {
            /if (${WasTwisting}) {
                /twist off
                /delay 20 !${Twist}
            }
            /casting "${castWhat}|item" -targetid|${castTargetID}
            /varset CastResult ${Cast.Result}
            /delay 5s ${Cast.Status.Equal}
			/if (${WasTwisting} && !${Twist}) /twist
            /return ${CastResult}
        }
        | - Check & cast if AA
         /if (${Me.AltAbility[${castWhat}]} && ${Me.AltAbilityReady[${castWhat}]}) {
            /target id ${castTargetID}
            /delay 10 ${Target.ID}==${castTargetID}
			
			/if (!${IAmABard}) {
				/casting "${castWhat}"|alt -maxtries|2
                /varset CastResult ${Cast.Result}
            }
            /if (${IAmABard}) {
                /alt act ${Me.AltAbility[${castWhat}].ID}
                /varset CastResult CAST_SUCCESS
            }
        }
        | - Check & cast if spell
        /if (${Me.Book[${castWhat}]} && ${Spell[${castWhat}].Mana}<=${Me.CurrentMana}) {
            | Mem spell if not memmed
            /if (!${Me.Gem[${castWhat}]}) {
            /if (${Attacking} && ${MainAssist.Equal[${Me}]}) /return
                /if (${Bool[${Plugin[mq2instantmem]}]}) {
                    /memspell ${MiscGem} "${castWhat}" 
                } else {
                    /memorize "${castWhat}" ${MiscGem}
                }
                /delay 350 ${Cast.Ready[${castWhat}]}
            }
			/target id ${castTargetID}
			/delay 10 ${Target.ID}==${castTargetID}
            /if (${Cast.Ready[${castWhat}]} && !${IAmABard}) { 
                /casting "${castWhat}" -maxtries|2
                /varset CastResult ${Cast.Result}
				/call CheckCasting 300 
            }
			/if (${Cast.Ready[${castWhat}]} && ${IAmABard}) { 
                /twist once ${castWhat}
                /varset CastResult CAST_SUCCESS
            }
        }
        /if (${WasTwisting} && !${Twist}) /twist
    /return ${CastResult}
| -------------------------------------------------------------------------------------
| SUB: Do We Move
| -------------------------------------------------------------------------------------
    Sub DoWeMove
        /if (!${ReturnToCamp} && !${ChaseAssist}) /return
        /doevents
        /call EndMacroIf
        /declare PullMDist int local 3
        /declare ZDist float local ${Math.Distance[${CampZLoc}:${Me.Z}]}
        /declare circleDirection string local
        /if (${Debug}) /echo ...debug DoWeMove: Enter
        | - Shuts off ReturnToCamp if a toon moves a big distance defined by 

CampRadiusExceed ie CoH
        /if (${ReturnToCamp}) {
            /if (${Math.Distance[${CampYLoc},${CampXLoc}]} > ${CampRadiusExceed} && !

${Pulled}) {
                /varset ReturnToCamp 0
                /echo Leashing exceeded distance of ${CampRadiusExceed} turning off 

ReturnToCamp
                /return
            }
            /if (${Math.Distance[${CampYLoc},${CampXLoc}]} > 10 && !${AddsInCamp}) {
                | Prevent puller roles from returning to camphere spot and just pull from 

where they are if in camp radius.
                /if (${Select[${Role},puller,pullertank]} && ${Math.Distance[${CampYLoc},

${CampXLoc}]}<=${CampRadius} && !${Medding}) /return
                /if (${Navigation.MeshLoaded} && ${Math.Distance[${CampYLoc},${CampXLoc}]} 

> 15) {
                    /doevents
                    /nav ${CampXLoc} ${CampYLoc} ${CampZLoc} 
                    /delay 300 !${Navigation.Active}
                    /if (${Navigation.Active}) /nav stop
                } else {
                    /doevents
                    /moveto mdist 10
                    /moveto loc ${CampYLoc} ${CampXLoc}
                    /delay 250 ${MoveTo.Stopped}
                }
                | Move down if Z distance more than 3 due to levitation
                /call ZCheck ${ZDist} 3.1
                /if (!${CombatStart} || ${Pulled}) /face heading ${LookForward}
            }
        }
        /if (${ChaseAssist}) {
            /if (${Debug}) /echo ...debug ChaseAssist+++++++++++++++++++++++++ 
            /if (!${JustZoned} && (!${Spawn[${MainAssist}].ID}  || ${Spawn

[${MainAssist}].Distance} > ${CampRadiusExceed}) || ${Math.Calc[${Spawn[${MainAssist}].Z}-

${Me.Z}]}>100) {
                /if (${Debug}) /echo ...debug ChaseAssist exceed camp check
                /varset ChaseAssist 0
                /echo ChaseAssist distance exceeded: Turning off ChaseAssist
            }
            /if (${Spawn[${MainAssist}].Distance} > ${ChaseDistance} && ${Spawn

[${MainAssist}].Distance} < ${CampRadiusExceed}) {
                /if (${Debug}) /echo ...debug ChaseAssist MA distance check
                /stick ${ChaseDistance} id ${Spawn[${MainAssist}].ID} loose
                :AreWeThere
                    /delay 10
                 /if (${Me.Moving}) /goto :AreWeThere
            }
        }
        /if (${Debug}) /echo ...debug DoWeMove: Leave 
    /return
| -------------------------------------------------------------------------------------
| SUB: DoWeMed
| -------------------------------------------------------------------------------------
    Sub DoWeMed
        /if (!${MedOn} || ${AggroTargetID} && !${MedCombat}) /return
        /if (${Debug}) /echo ...debug DoWeMed enter || ${Me.Buff[Resurrection Sickness].ID}
        /declare Med2On int local 0
        /declare MedStat1 string local ${MedStat}
        /if (!${Me.Moving}) {
            /if (${Select[${Me.Class.ShortName},BST,PAL,RNG,SHD]} && ${Me.Pct${MedStat2}}<

${MedStart} && ${Me.Pct${MedStat}}>${MedStart})  {
                /varset MedStat1 ${MedStat}
                /varset MedStat ${MedStat2}
                /varset Med2On 1
            }
            /if (${Me.Pct${MedStat}}<${MedStart}) {
                /squelch /tar clear
                /if (${Attacking}) /call CombatReset dowemed
                /echo MEDDING-> ${MedStart}% ${MedStat} time to med.
                /if (${EQBC.Connected} && ${EQBCOn} && ${Select

[${Role},puller,pullertank,hunter]}) /docommand  /${EQBCSay} [+t+]PULLER-> My ${MedStat} is 

${MedStart}% time to med.[+x+]
                /if (${IAmABard} && ${TwistMed} && ${TwistOn}) /twist ${TwistMed}
                /varset Medding 1
            :wait_for_resume
                    /doevents
                    /if (${ReturnToCamp} && ${Math.Distance[${CampYLoc},${CampXLoc}]} > 10) 

{
                        /if (!${Me.Mount.ID} && ${Me.Sitting}) /stand
                        /call DoWeMove
                    }
                    /if (${Debug}) /echo ...debug ${MedStat} ${MedStat1} ${MedStat2} 
                    /delay 5
                    /call CheckCasting
                    /delay 5
					/call WaitSubs
                    /if (!${MedCombat}) {
                        /call CheckForAdds DoWeMed
                        /if (${AggroTargetID}) {
                            /if (${Med2On}) /varset MedStat ${MedStat1}
                             /varset Medding 0
                            /return
                        }
                    }
                /if (${Me.Pct${MedStat}}<100) /goto :wait_for_resume
                | /if (${Select[${Me.Class.ShortName},BST,PAL,RNG,SHD]} && ${Me.Pct

${MedStat2}}<100) /goto :wait_for_resume
            :done_medding  
            /if (${Med2On}) /varset MedStat ${MedStat1}  
            /varset Medding 0           
            /if (${Me.Sitting}) /stand
            }
        }
        /if (${Debug}) /echo ...debug DoWeMed leave 
    /return
| -------------------------------------------------------------------------------------
| SUB: CheckCasting
| -------------------------------------------------------------------------------------
    Sub CheckCasting(int CCTime)
	/if (${IAmABard}) /return
    /declare CCTimer timer local ${CCTime}
        /if (!${CCTimer}) /varset CCTimer 50
        :NotReady
            /if (${CCTimer}==0) /return
            /delay 5
        /if (${Me.Casting.ID}) /goto :NotReady
    /return
| -------------------------------------------------------------------------------------
| SUB: CheckBuffs 
| -------------------------------------------------------------------------------------
     Sub CheckBuffs
        /doevents
        /if (!${BuffsOn} || ${IAmDead})  /return
        /if (${ChaseAssist}) /call DoWeMove
        /if (${DebugBuffs}) /echo CheckBuffs: enter
        /declare i int local
        /declare j int local
        /declare k int local
        /declare l int local        
        /declare FullText string local 0
        /declare 1stPart string local 0
        /declare 2ndPart string local 0
        /declare 3rdPart string local 0
        /declare 4thPart string local 0
        /declare AuraName string local 
        /declare SummonAttempts int local 0
        /declare TempAura string local
        /declare SpellRange int local
        | Assign var IniIDList all the spawn ids from buff ini file 2345|2195|2391| etc
        /declare IniIDList string local ${Ini["KissAssist_Buffs.ini"]}
        /declare IniIDCount int local ${Math.Calc[${IniIDList.Count[|]}-1]}
        /declare IniBuffCount int local 0
        /declare IniBBuffList string local
        /declare IniBuffList string local
        /declare IniStackCheck[50] string local
        /declare PBTimerID int local
        /declare IniTempBuff string local
        | Group Buffs            
        /for i 1 to ${Buffs.Size}
            /doevents
            | If Buffs=NULL skip to next buff
            /if (${Buffs[${i}].Equal[null]} || ${Buffs[${i}].Arg[3,|].Equal[0]} || ${Buffs

[${i}].Arg[2,|].Equal[0]}) /goto :SkipBuff
            | Check for combat and skip redundant subs called in combat routines.
            /if (${DebugBuffs}) /echo Buff${i}=${Buffs[${i}]}
            /varset SpellRange ${Spell[${Buffs[${i}]}].Range}
            /if (${Spell[${Buffs[${i}]}].TargetType.Find[Group]})  /varset SpellRange 

${Spell[${Buffs[${i}]}].AERange}
            | Check for spells with 2 parts such as Exigent Focusing Rk. II,Talisman of 

Soul's Unity Rk. II - Set Buffs to the buff   
            /if (${Buffs[${i}].Arg[2,|].Length}) {
                /varset FullText ${Buffs[${i}]} 
                /varset 1stPart ${Buffs[${i}].Arg[1,|]}           
                /varset 2ndPart ${Buffs[${i}].Arg[2,|]}
                /varset 3rdPart ${Buffs[${i}].Arg[3,|]}           
                /varset 4thPart ${Buffs[${i}].Arg[4,|]}
                /if (${FullText.Arg[2,|].Equal[Mana]})      /varset 2ndPart Mana
                /if (${FullText.Arg[2,|].Equal[Aura]})      /varset 2ndPart Aura
                /if (${FullText.Arg[2,|].Equal[Mount]})     /varset 2ndPart Mount
                /if (${FullText.Arg[2,|].Equal[Dual]})      /varset 2ndPart Dual
                /if (${FullText.Arg[2,|].Equal[Me]})        /varset 2ndPart Me
                /if (${FullText.Arg[2,|].Equal[MA]})        /varset 2ndPart MA
                /if (${FullText.Arg[2,|].Equal[Summon]})    /varset 2ndPart Summon
                /if (${FullText.Arg[2,|].Equal[End]})       /varset 2ndPart End
                /if (${FullText.Arg[2,|].Equal[Melee]})     /varset 2ndPart Melee
                /if (${FullText.Arg[2,|].Equal[Caster]})    /varset 2ndPart Caster          

      
                /varset SpellRange ${Spell[${1stPart}].Range}
                /if (${Spell[${1stPart}].TargetType.Find[Group]})  /varset SpellRange 

${Spell[${1stPart}].AERange}
                | /varset Buffs[${i}] ${1stPart}
            }
            | /if (${Buffs[${i}].Equal[null]}) /goto :SkipBuff
            /if (!${SpellRange}) /varset SpellRange 100
            /if (${DebugBuffs}) /echo -- 1stPart:${1stPart} 2ndPart:${2ndPart} FullText:

${Buffs[${i}]} Type:${Spell[${1stPart}].TargetType}
            | Check and Cast mana type spells/aas/items - Canni/Paragon/Harvest
            /if (${2ndPart.Equal[Mana]}) { 
                /if (${Me.PctMana}<=${3rdPart} && ${Me.PctHPs}>${4thPart} && ${Cast.Ready

[${1stPart}]}) {
                    /if (${DebugBuffs}) /echo Canni/Paragon/Harvest
                    /target id ${Me.ID}
                    /delay 5
                    /call CastWhat "${1stPart}" ${Me.ID}
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) /echo Casting >> ${1stPart} 

<< for mana
                    | Combat check to return - no other buffing allowed
                    /if (${CombatStart} ||  ${IAmDead}) /return
                    /goto :SkipBuff
                }
            }
            /if (${AggroTargetID}) /goto :SkipBuff
            | Cast mount 
            /if (${2ndPart.Equal[Mount]} && !${3rdPart.Find[0]} && !${Me.Mount.ID} && !

${Attacking} && ${MountOn}) {
                /if (${DebugBuffs}) /echo Mount
                /call CastWhat "${1stPart}" ${Me.ID}
                /if (${Macro.Return.NotEqual[CAST_SUCCESS]}) /varset MountOn 0
                /call CheckCasting 80 
                /goto :SkipBuff
            }
            | If buff cost more mana than I have skip it
            /if ((${Spell[${1stPart}].Mana} || ${Spell[${Buffs[${i}]}].Mana})>

${Me.PctMana}) /goto :SkipBuff
            | Combat check to skip all buffs but mana regen  || ${Me.Buff[Resurrection 

Sickness].ID} || ${Me.Buff[Revival Sickness].ID}
            /if (${CombatStart}) /goto :SkipBuff
            | Check if aura is up
            /if (${2ndPart.Equal[Aura]}) {
                | Strip the Rk II/III out of the spell to check against aura window
                /if (${1stPart.Find[ Rk. III]}) {
                    /varset AuraName ${1stPart.Left[-8]} 
                } else /if (${1stPart.Find[ Rk. II]}) {
                    /varset AuraName ${1stPart.Left[-7]}
                } else /if (${1stPart.Find[ Rk.II]}) {
                    /varset AuraName ${1stPart.Left[-6]}    
                } else { 
                    /varset AuraName ${1stPart}
                }
                | Correct typo from SOE in monks 55 level aura
                /if (${1stPart.Find[Disciple's Aura]}) /varset AuraName Disciples Aura
                | Mage exceptions because aura is on pet not in aura window and other 

fucked up shit
                /if (${1stPart.Find[Arcane Distillect]}) /varset TempAura Arcane Distillect
                /if (${1stPart.Find[Earthen Strength]}) /varset TempAura Earthen Strength 

Effect
                /if (${1stPart.Find[Rathe's Strength]}) /varset TempAura Rathe's Strength 

Effect
                | Check if aura is up 4 parts - Mage | Everyone else | 2 auras cleric | 2 

auras enchamter
                /if (${Me.Pet.ID} && ${Select[${Me.Class.ShortName},MAG]} && 

${Me.Pet.Distance}<175 && (!${TempAura.Find[effect]} && !${Me.Aura[1].Find[${TempAura}]} || 

${TempAura.Find[effect]} && !${Me.PetBuff[${TempAura}]}) || ${Select

[${Me.Class.ShortName},CLR,ENC,MAG]}==0 && !${Me.Aura[1].Find[${AuraName}]} || ${Select

[${Me.Class.ShortName},CLR]} && !${Me.Aura[1].Find[${AuraName}]} && !${Me.AltAbility[Spirit 

Mastery]}  || !${Me.Aura[1].Find[${AuraName}]} && !${Me.Aura[2].Find[${AuraName}]} && 

${Me.AltAbility[Spirit Mastery]} || ${Select[${Me.Class.ShortName},ENC]} && !${Me.Aura

[1].Find[${AuraName}]} && !${Me.AltAbility[Auroria Mastery]} || !${Me.Aura[1].Find

[${AuraName}]} && !${Me.Aura[2].Find[${AuraName}]} && ${Me.AltAbility[Auroria Mastery]}) {
                    /if (${DebugBuffs}) /echo Aura
                    
                    | - Mutant Bards do this
                    /if (${Me.Class.ShortName.Equal[BRD]}) {
                        /if (!${Me.Gem[${1stPart}]}) {
                            /memorize "${1stPart}"|${MiscGem}
                            /delay 30
                        }    
                        /squelch /twist once ${Me.Gem[${1stPart}]}
                        /delay 50
                        /goto :SkipBuff
                    }
                    | - Normal casting
                    /if (${Select[${Me.Class.ShortName},BER,MNK,ROG,WAR]}) {
                        /disc ${1stPart}
                    } else {
                        /casting "${1stPart}"|${MiscGem}
                    }
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) /echo Casting Aura >> 

${1stPart} <<
                    /call CheckCasting 50 
                }
                /goto :SkipBuff 
            }
            | Check and Cast endurance discs - 2nd wind, respite, etc
            /if (${2ndPart.Equal[End]}) { 
                /if (${Me.PctEndurance}<=${3rdPart} && ${Me.CombatAbilityReady[${1stPart}]} 

&& !${Melee.DiscID}) {
                    /if (${DebugBuffs}) /echo Endurance Regen
                    /if (${Me.Sitting}) /stand
                    /delay 5
                    /docommand /disc ${1stPart}
                    /delay 10
                    /echo Casting >> ${1stPart} << for endurance
                    /goto :SkipBuff
                }
            }
            | Summon items ini example Buffs1=The Guardian's Pouch|Summon|Guardian Blade|

200
            /if (${2ndPart.Equal[Summon]}) {
                /if (${FindItemCount[=${3rdPart}]}<${4thPart}) {
                    :summonagain
                        /if (${Twist}) /multiline ; /squelch /twist off ; /varset Twisting 

0
                        /if (${Me.FreeInventory}==0) {
                            /echo No room in inventory skipping summoning >> ${3rdPart} <<.
                            /goto :summondone
                        }
                        | zerker code for summoning axes to prevent CTD
                        /if (${Select[${Me.Class.ShortName},BER]} && ${1stPart.Find[axe]} 

&& ${Me.CombatAbilityReady[${1stPart}]}) {
                            /docommand /disc ${1stPart}
                            /delay 80 ${Cursor.ID}
                            /varcalc SummonAttempts ${SummonAttempts}+1 
                            /goto :inventory
                        }
                        | Summon axes for zerkers had to be hard coded because spell is 

same name as teh item summoned.
                        /if (!${Select[${Me.Class.ShortName},BER]} && !${1stPart.Find

[axe]}) /call CastWhat "${1stPart}" ${Me.ID}
                        /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                            /delay 50 ${Cursor.ID}
                            /echo Summoned  >> ${3rdPart} << 
                            /varcalc SummonAttempts ${SummonAttempts}+1 
                            :inventory 
                                /autoinventory
                                /delay 10
                            /if (${Cursor.ID}) /goto :inventory
                            /if (${FindItemCount[=${3rdPart}]}==0 && ${SummonAttempts}>0) {
                                /echo Summoning >> ${3rdPart} << Failed - Check reagents, 

timer, etc
                                /echo -- Turning off ${1stPart} - ${1stPart}|Summon|

${3rdPart}|0
                                /varset FullText ${1stPart}|Summon|${3rdPart}|0
                                /varset SummonAttempts 0
                                /goto :summondone
                            }
                        }
                    |** /if (${Macro.Return.Equal[CAST_COMPONENTS]}) {
                        /echo You are missing components. Setting ${Buffs[${i}]} to NULL
                        /varset FullText NULL
                        /goto :SkipBuff
                    } **|
                    /if (${FindItemCount[=${3rdPart}]}<${4thPart}) /goto :summonagain
                    :summondone
                    /echo I now have ${4thPart} >> ${3rdPart} <<
                    /goto :SkipBuff
                }
            }  
            | Voice of Thule AA fix 
            /if (${1stPart.Equal[Voice of Thule]} && ${Me.AltAbility[Voice of Thule]} && 

${Me.AltAbilityReady[Voice of Thule]} && ${Buff${i}GM${j}}==0) {
                /casting "${1stPart}"|alt -targetid|${Spawn[${MainAssist} 

${MainAssistType}].ID} -maxtries|2
                /call CheckCasting 25 
                /varcalc Buff${i}GM${j} (${Spell[${1stPart}].Duration.TotalSeconds}*

${DurationMod})*10
                /goto :SkipBuff
            }
            /if (${Select[${2ndPart},Aura,End,Mount,Mana,Summon]}) /goto :SkipBuff
            | Check for spells with 2 parts such as Exigent Focusing Rk. II,Talisman of 

Soul's Unity Rk. II - Set Buffs to buff part of spell
            /if (${FullText.Arg[2,|].Equal[Dual]})  /varset Buffs[${i}] ${3rdPart} 
			/if (${Select[${FullText.Arg[2,|]},Me,MA,Caster,Melee]}) /varset 

Buffs[${i}] ${1stPart}
            | Cast buffs on MA
            /if (${2ndPart.Equal[MA]} && ${Spawn[${MainAssist} 

${MainAssistType}].Distance}<=${SpellRange} && !${Spawn[${MainAssist} 

${MainAssistType}].Moving} && ${Spawn[${MainAssist} ${MainAssistType}].ID} && ${Buff${i}

GM7}==0) {
				/call CastWhat "${Buffs[${i}]}" ${Spawn[${MainAssist} 

${MainAssistType}].ID}
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                    /echo Buffing ${Buffs[${i}]} on ${Spawn[${MainAssist} 

${MainAssistType}].CleanName}
                    /call CheckCasting 100
                    /varcalc Buff${i}GM7 (${Spell[${Buffs[${i}]}].Duration.TotalSeconds}*

${DurationMod})*10
                    /if (${DebugBuffs}) /echo MA Buff Timer ${Buff${i}GM7}
                    /varset WriteBuffsTimer 0
                    /call WriteBuffs
                    /goto :SkipBuff
                }
            } else {
				/if (${2ndPart.Equal[MA]}) /goto :SkipBuff
			}
            | Check if buff is up and if it stacks with existing buffs 
            /if (${DebugBuffs}) /echo BuffSlot: ${Me.Buff[${Buffs[${i}]}].ID} SongSlot: 

${Me.Song[${Buffs[${i}]}].ID} Stacks: ${Spell[${Buffs[${i}]}].Stacks[0]} 2nd Part: 

${Select[${2ndPart},Aura,Mount,Mana,End,Summon]}<1 Tar Type: ${Spell[${Buffs

[${i}]}].TargetType}
            /if (!${Me.Buff[${Buffs[${i}]}].ID} && ${Spell[${Buffs[${i}]}].Stacks[0]}) {
                | Check for spells with 2 parts such as Exigent Focusing Rk. II,Talisman of 

Soul's Unity Rk. II - Set Buffs to actual spell
                /if (${FullText.Arg[2,|].Equal[Dual]})  /varset Buffs[${i}] ${1stPart} 
                /if (${DebugBuffs}) /echo -- 2nd asssigned: ${Buffs[${i}]}
                | If Target.Type=Group then buff self with group buff
                /if (${Spell[${Buffs[${i}]}].TargetType.Find[group]}>=1) {
                    /call CastWhat "${Buffs[${i}]}" ${Me.ID}
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                        /echo Buffing >> ${Buffs[${i}]} <<
                        /doevents flush Worn_off
                        /varset WriteBuffsTimer 0
                        /call WriteBuffs
                        /varset IniNextTimer 35s
                    }
                }
				| If Target.Type=Single then buff each party member with 

single buff 
				/if (${Spell[${Buffs[${i}]}].TargetType.Find[single]}) {
					/if (${Group} && ${Me.CurrentMana}>${Spell[${Buffs

[${i}]}].Mana}*(${Group})) {
						/if (${DebugBuffs}) /echo Single Type Group 

Buff
					   /for j 0 to ${Group}
							/if (${DebugBuffs}) /echo !

${Group.Member[${j}].ID} || ${Spawn[${Group.Member[${j}]}].Distance}>=${SpellRange} || 

${2ndPart.Equal[Me]} && ${j}>=1 || ${2ndPart.Equal[MA]} && ${Group.Member[${j}].ID}!=

${Spawn[${MainAssistType} ${MainAssist}].ID} || ${Buff${i}GM${j}}
							| Check if party member is alive in 

zone and within spell range and spell timer does not exist
							/if (!${Group.Member[${j}].ID} || 

${Spawn[${Group.Member[${j}]}].Distance}>=${SpellRange} || ${Buff${i}GM${j}}) /goto 

:nextmember
							/if (${2ndPart.Equal[Me]} && ${j}

>=1) /goto :nextmember
							/if (${2ndPart.Equal[caster]} && 

${Select[${Group.Member

[${j}].Class.ShortName},CLR,DRU,SHM,BST,ENC,MAG,NEC,PAL,SHD,RNG,WIZ]}==0 || 

${2ndPart.Equal[Melee]} && ${Select[${Group.Member

[${j}].Class.ShortName},BER,BST,MNK,PAL,ROG,RNG,SHD,WAR]}==0) /goto :nextmember
							/if (${Me.CurrentMana}<${Spell

[${Buffs[${i}]}].Mana}) /goto :nextmember
							/call CastWhat "${Buffs[${i}]}" 

${Group.Member[${j}].ID}
							/if (${Macro.Return.Equal

[CAST_SUCCESS]}) {
								/echo Buffing ${Buffs

[${i}]} on ${Group.Member[${j}].CleanName}
								/varcalc Buff${i}GM${j} 

(${Spell[${Buffs[${i}]}].Duration.TotalSeconds}*${DurationMod})*10
								/doevents flush Worn_off
								/varset WriteBuffsTimer 0
								/call WriteBuffs
							}
							:nextmember
						/next j
					} else /if (${Select[${2ndPart},MA,Melee,Caster]}

==0) {
						/call CastWhat "${Buffs[${i}]}" ${Me.ID} 
					}
				}
				| If Target.Type=self then buff self 
                /if (${Spell[${Buffs[${i}]}].TargetType.Find[self]}) {
                    /if (${DebugBuffs}) /echo Self Buff
                    /call CastWhat "${Buffs[${i}]}" ${Me.ID} 
                    /if (${Macro.Return.Equal[CAST_COMPONENTS]}) {
                        /echo You are missing components. Setting ${Buffs[${i}]} to NULL
                        /varset Buffs[${i}] NULL
                        /varset FullText NULL
                        /delay 5
                        /goto :SkipBuff
                    }
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) /delay 20
                }
                | Check if buff needs pet as target ie Mage's Symbiosis line of mana buffs
                /if (${Me.Pet.ID} && ${Spell[${Buffs[${i}]}].TargetType.Find[pet]} || 

${Select[${Spell[${Spell[${Buffs[${i}]}].ID}].Name.Arg[2,]},Symbiosis,Siphon,Simulacrum]}) 

{
                    /if (${DebugBuffs}) /echo Self Buff that targets pet ie mage mana buff 

line
                    /call CastWhat "${Buffs[${i}]}" ${Me.Pet} 
                }
			}	
			| If buff is an item click it
			/if (${FindItem[${Buffs[${i}]}].Spell.Stacks[0]} && !${Me.Buff

[${FindItem["${Buffs[${i}]}"].Spell}].ID} && ${FindItem[${Buffs[${i}]}].Timer}==0 && 

${Select[${2ndPart},Aura,Mount,Mana]}<1)  {
				/if (${DebugBuffs}) /echo Items
				/if (${Twist}) /multiline ; /squelch /twist off ; /varset 

Twisting 0
				/echo Clicking > ${Buffs[${i}]} < 
				/call CastWhat "${Buffs[${i}]}" ${Me.ID}
			}
            | Check Buffs from ini 
			/if (${Redguides} && !${IniNextTimer}) {
                | IniIDCount = number of Char IDs counted in ini file. If 0 skip || Buff is 

null the the process.
                /if (${IniIDCount}<=0 || ${Buffs[${i}].Equal[null]}) /goto :SkipBuff
                | Start scan of buffs listed on toons in ini file
                /for k 1 to ${IniIDCount}
                    | If the Spawn ID is not in the zone and not a PC and not me skip to 

next ID
                    /if (!${Spawn[${IniIDList.Arg[${k},|]}].ID} || ${Spawn[${IniIDList.Arg

[${k},|]}].Type.NotEqual[PC]} || ${IniIDList.Arg[${k},|]}==${Me.ID}) /goto :NextCharCheck
                    | If Buff is a Mana,Aura,Mount,Me,Summon,End, an item, self buff or 

Spawn IdDis me skip because none of these are cast on others
                    /if (${Select[${FullText.Arg[2,|]},Mana,Aura,Mount,Me,Summon,End,0]} || 

${FindItemCount[${Buffs[${i}]}]}>=1 || ${Spell[${Buffs[${i}]}].TargetType.Find[self]}) 

/goto :NextCharCheck
                    | Set buff to correct spell to check for with Dual tag 
                    /if (${FullText.Arg[2,|].Equal[Dual]})  /varset Buffs[${i}] ${3rdPart} 
                    | If buff marked MA skipped if spawn ID isn't MA
                    /if (${FullText.Arg[2,|].Equal[MA]} && ${Spawn[${IniIDList.Arg

[${k},|]}].CleanName.NotEqual[${MainAssist}]}) /goto :NextCharCheck
                    /if (${2ndPart.Equal[Caster]} && ${Select[${Spawn[${IniIDList.Arg

[${k},|]}].Class.ShortName},CLR,DRU,SHM,BST,ENC,MAG,NEC,PAL,SHD,RNG,WIZ]}==0 || 

${2ndPart.Equal[Melee]} && ${Select[${Spawn[${IniIDList.Arg

[${k},|]}].Class.ShortName},BER,BST,MNK,PAL,ROG,RNG,SHD,WAR]}==0) /goto :NextCharCheck
                    | Temp variable to store buff name after stripping rk stuff makes it 

easier to compare
                    /varset IniTempBuff ${Buffs[${i}]}
                    /if (${Buffs[${i}].Find[ Rk. III]}) /varset IniTempBuff ${Buffs

[${i}].Left[-8]}
                    /if (${Buffs[${i}].Find[ Rk. II]})  /varset IniTempBuff ${Buffs

[${i}].Left[-7]}
                    /if (${DebugBuffs}) /echo ${Spawn[${IniIDList.Arg[${k},|]}].Name} 

${IniIDList.Arg[${k},|]} ${IniTempBuff} ${Buffs[${i}]}
                    | Assign var IniBBuffList blocked buffs list from ini file
                    /varset IniBBuffList ${Ini["KissAssist_Buffs.ini",${IniIDList.Arg

[${k},|]},"Blockedbuffs"]}
                    | If the current buff is on the blocked buff list skip it.
                    /if (${IniBBuffList.Find[${IniTempBuff}]}) /goto :NextCharCheck
                    | Assign var IniBuffList buffs list from ini file
                    /varset IniBuffList ${Ini["KissAssist_Buffs.ini",${IniIDList.Arg

[${k},|]},"Buffs"]}
                    | If current buff is on the buff list skip it
                    /if (${IniBuffList.Find[${IniTempBuff}]}) /goto :NextCharCheck
                    /if (${DebugBuffs}) /echo ${IniTempBuff} ${IniBuffList.Find

[${IniTempBuff}]}
                    | Assign buff count
                    /varset IniBuffCount ${Math.Calc[${IniBuffList.Count[|]}]}
                    | Check if current buff stacks will all existing buffs in list
                    /if (${DebugBuffs}) /echo ${Spawn[${IniIDList.Arg[${k},|]}].Name} 

${IniBuffCount} ${i} ${Buffs[${i}]}
                    /for l 1 to ${IniBuffCount}
                        /if (${Select[${Spell[${IniBuffList.Arg[${l},|]}].WillStack

[${Buffs[${i}]}]},TRUE,FALSE,NULL]}>=2) /goto :NextCharCheck
                    /next l
                    | If buff has dual tag assign current buff to spell that needs to be 

cast
                    /if (${FullText.Arg[2,|].Equal[Dual]}) /varset Buffs[${i}] ${1stPart} 
                    | varset ini buff timer toon Id spell Id to shorten var and clarity
                    /varset PBTimerID ${PIniNum.Arg[${k},|]}${Spell[${Buffs[${i}]}].ID}
                    | Define timer for spell i am about to cast
                    /if (!${Defined[IniBuffTimer${PBTimerID}]}) /declare IniBuffTimer

${PBTimerID} timer outer
                    /if (${DebugBuffs}) /echo ${Spawn[${IniIDList.Arg[${k},|]}].Name} 

${IniBuffList} Temp:${IniTempBuff} OnList:${IniBuffList.Find[${IniTempBuff}]} Timer:

${IniBuffTimer${PBTimerID}}
                    | Check if toon is within spell range and cast buff
                    /if (${Spawn[${IniIDList.Arg[${k},|]}].Distance}<=${SpellRange} && !

${IniBuffTimer${PBTimerID}}) {
                        /call CastWhat "${Buffs[${i}]}" ${IniIDList.Arg[${k},|]}
                        /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                            /echo Buffing >> ${Buffs[${i}]} << on ${Spawn[${IniIDList.Arg

[${k},|]}].CleanName}
                            /varset IniBuffTimer${PBTimerID} 60s
                            /varset IniNextTimer 65s 
                            /doevents flush Worn_off
                            /varset WriteBuffsTimer 0
                            /call WriteBuffs
                        }
                    }
                    /if (${DebugBuffs}) /echo IniBuffTimer${PBTimerID}:${IniBuffTimer

${PBTimerID}} IniNextTimer:${IniNextTimer}
                    :NextCharCheck
                    /if (${FullText.Arg[2,|].Equal[Dual]}) /varset Buffs[${i}] ${3rdPart}
                /next k
			}
         :SkipBuff
            | Reset spell vars
            /if (${FullText.Arg[2,|].Length}) {
                /varset Buffs[${i}] ${FullText}
                /varset FullText 0
                /varset 1stPart 0           
                /varset 2ndPart 0
                /varset 3rdPart 0         
                /varset 4thPart 0
            }
            /if (${DebugBuffs}) /echo ${i} ${Buffs[${i}]}
        /next i
        | /varset ReadBuffsTimer 30s
        /if (${DebugBuffs}) /echo CheckBuffs leave
    /return
   
| -------------------------------------------------------------------------------------
| SUB: DoPetStuff 
| -------------------------------------------------------------------------------------
Sub DoPetStuff
    /doevents
    /if (!${PetOn} || ${AggroTargetID}) /return
    /if (${Debug}) /echo DoPetStuff: enter
    /declare FocusCurrent string local ${InvSlot[${PetFocus.Arg[2,|]}].Item.Name} 
    /declare FocusSlot string local ${PetFocus.Arg[2,|]} ${PetFocus.Arg[1,|]}
    /declare FocusPet string local ${PetFocus.Arg[1,|]}
    /declare FocusSwitch int local 0
    /if (${Me.Pet.CleanName.Equal[${Me.Name}`s familiar]}) /pet get lost
    | Swap pet focus in pet cast
    /if (!${Me.Pet.ID} && ${Spell[${PetSpell}].Mana}<=${Me.CurrentMana}) {
        /if (${PetFocus.Arg[1,|].Length} && ${FindItemCount[=${FocusPet}]}) {
            /if (!${Cursor.ID} && ${FocusPet.NotEqual[${FocusCurrent}]}) {
                /call CheckCasting
                /exchange "${FocusPet}" ${FocusSlot} 
                /varset FocusSwitch 1
                /delay 5
            }
        } 
        /delay 3
        | Pet spell mem check
        /if (!${Me.Gem[${PetSpell}]}) {
            /memorize "${PetSpell}" ${MiscGem}
            /delay 350 ${Cast.Ready[${PetSpell}]}
        }
        | Summon Pet
        /casting "${PetSpell}" -maxtries|2
        /if (${My.Pet.ID}) /echo My pet is now: ${Me.Pet.CleanName} from ${PetSpell}
        | Swap pet focus out for regular item
        /if (${FocusSwitch} && !${Cursor.ID}) {
            /call CheckCasting
            /exchange "${FocusCurrent}" ${FocusSlot} 
            /delay 5
        }
        /if (${Select[${Role},puller,pullertank]}) /pet guard
        /if (${Me.AltAbility[Pet Discipline].RequiresAbility}) /pet hold on
        /if (${Me.AltAbility[Pet Discipline]}>5) /pet focus
    }
    /call CheckPetBuffs
    | Pet Toy routines
    /if (${Me.Pet.ID} && ${PetToysOn} && !${PetToysDone}) /call PetToys
    /if (${Debug}) /echo DoPetStuff: leave
/return 
| -------------------------------------------------------------------------------------
| SUB: CheckPetBuffs
| -------------------------------------------------------------------------------------    
Sub CheckPetBuffs
        /if (!${PetOn} || !${Me.Pet.ID} || !${PetBuffsOn}) /return
        /if (${Debug}) /echo CheckPetBuffs: enter
        /declare PTempBuff string local 
        /declare i int local
        /declare j int local
        /declare FoundPetBuff int local 0
        /for i 1 to ${PetBuffs.Size}
            /doevents
            /if (${PetBuffs[${i}].Equal[Null]}) /goto :SkipPetBuff
            | Check for pet spells in book to prevent double casting of items 
            /if (${Me.Book[${PetBuffs[${i}]}]} || ${Me.AltAbilityReady[${PetBuffs[${i}]}]}) 

{
                /varset PTempBuff ${PetBuffs[${i}]}
                /if (${PetBuffs[${i}].Find[ Rk. III]}) /varset PTempBuff ${PetBuffs

[${i}].Left[-8]}
                /if (${PetBuffs[${i}].Find[ Rk. II]}) /varset PTempBuff ${PetBuffs

[${i}].Left[-7]}
                /if (${Debug}) /echo ${i} ${Me.PetBuff[${PTempBuff}]} ${PetBuffs[${i}]} 

${PTempBuff}
                /for j 1 to 50
                    /if (${Me.PetBuff[${j}].Name.Find[${PTempBuff}]}) /varset FoundPetBuff 

1
                /next j
                /if (!${FoundPetBuff}) {
                    /call CastWhat "${PetBuffs[${i}]}" ${Me.Pet.ID}
                    /delay 20 
                    /varset FoundPetBuff 0
                    /goto :SkipPetBuff
                }
            }
            /if (${Debug}) /echo ${FindItem[${PetBuffs[${i}]}].Spell} ${Me.PetBuff

[${FindItem[${PetBuffs[${i}]}].Spell}]}
            /if (${Me.PetBuff[${FindItem[${PetBuffs[${i}]}].Spell}]}>=1) /goto :SkipPetBuff
            /if (${FindItem[=${PetBuffs[${i}]}].ID}) {
                /call CastWhat "${PetBuffs[${i}]}" ${Me.Pet.ID}
                /call CheckCasting 75
            } 
            :SkipPetBuff
            /varset FoundPetBuff 0
        /next i
    /if (${Debug}) /echo Pet Height: ${Me.Pet.Height} 
    /if (${Me.Pet.Height}>1.3 && ${PetShrinkOn}) {
        /call CastWhat "${PetShrinkSpell}" ${Me.Pet.ID}
        /delay 20
        /squelch /target clear
    }
/return        
| ----------------------------------------------------------------------------
| SUB: Check PetToys - Based on code from el_nene's autobot. Used with permission. 
| Autobot is available at www.macroquest2.com VIP macro section.
| ----------------------------------------------------------------------------
    Sub PetToys
        /declare i int local
        /declare j int local
        /declare GrabItem int local 0
        /declare PetToySpell string local 0
        /call OpenInvSlot 
        /if (${BagNum}==0) {
            /echo Top inventory slot 10 must be empty for Pet Toys to work.
            /varset PetToysOn 0
            /return
        }        
        /if (!${InvSlot[pack${BagNum}].Item.Container} && !${Me.FreeInventory}) {
            /echo Inventory is full
            /varset PetToysOn 0
            /return
        }        
        /for i 1 to ${PetToys.Size}
            /if (${PetToys[${i}].Equal[Null]}) /goto :SkipPetToy
            /varset PetToySpell ${PetToys[${i}]}   
            | Check for pet spells in book to prevent double casting of items 
            /if (${Me.Book[${PetToySpell}]}) {
                /call CastWhat "${PetToySpell}" ${Me.Pet.ID}
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) /echo Casting pet toy spell >> 

${PetToySpell} <<
                /delay 100 ${Cast.Ready[${PetToySpell}]}
                /delay 5s ${Cursor.ID}
                /if (!${Cursor.ID}) /return
                | Make sure pack$ is not a contanier and we will be able to have room
                /if (${Cursor.Container}) {
                    /nomodkey /itemnotify pack${BagNum} leftmouseup
                    /delay 2s !${Cursor.Container}
                    /delay 2 /autoinv
                    /delay 2s !${Cursor.ID}
                }
                /if (${InvSlot[pack${BagNum}].Item.Container} && ${InvSlot[pack

${BagNum}].Item.Name.Find[Phantom Satchel]}) {
                    /nomodkey /itemnotify pack${BagNum} rightmouseup
                    /delay 10
                    /for j 0 to ${InvSlot[pack${BagNum}].Item.Container}
                        /if (${InvSlot[pack${BagNum}].Item.Item[${j}].ID} && ${InvSlot

[pack${BagNum}].Item.Item[${j}].Name.Length}) {
                            /call GiveTo "${InvSlot[pack${BagNum}].Item.Item[${j}].Name}" 

${Me.Pet.ID}
                        }
                    /next j
                }
                /if (${Cursor.Name.Find[Summoned:]}) /call GiveTo "${Cursor.Name}" 

${Me.Pet.ID}    
                /if (${InvSlot[pack${BagNum}].Item.Name.Find[Phantom Satchel]}) /call 

DestroyBag 
                /goto :SkipPetToy
            }
        :SkipPetToy
        /next i
        /if (${Window[InventoryWindow].Open}) /keypress inventory 
        /varset PetToysDone 1
    /return
| ----------------------------------------------------------------------------
| SUB: Check OpenInvSlot - Based on code from el_nene's autobot. Used with permission. 
| Autobot is available at www.macroquest2.com VIP macro section.
| ----------------------------------------------------------------------------   
    Sub OpenInvSlot
        /declare i int local
        /for i 1 to 10
            /if (${InvSlot[pack${i}].Item.Container}) /goto :NextSlot
                /varset BagNum ${i}
                /return
            :NextSlot
        /next i
        /varset BagNum 0
    /return 
| ----------------------------------------------------------------------------
| SUB: Check DestroyBag - Based on code from el_nene's autobot. Used with permission. 
| Autobot is available at www.macroquest2.com VIP macro section.
| ----------------------------------------------------------------------------
    Sub DestroyBag
        /if (${InvSlot[pack${BagNum}].Item.Items}) {
            /echo Something is still in the bag aborting delete.
        }
        /if (${InvSlot[pack${BagNum}].Item.Items}==0 && ${InvSlot[pack

${BagNum}].Item.Name.Find[Phantom Satchel]}) {
            /nomodkey /itemnotify pack${BagNum} leftmouseup
            /delay 5s ${Cursor.ID}
            /if (${Cursor.Name.Find[Phantom Satchel]}) /destroy
            /delay 20 !${Cursor.ID}
        }
    /return
| ----------------------------------------------------------------------------
| SUB: Check GiveTo - Based on code from el_nene's autobot. Used with permission. 
| Autobot is available at www.macroquest2.com VIP macro section.
| ----------------------------------------------------------------------------   
    Sub GiveTo(string GItem, int GTarget)
        /if (${Target.ID}!=${GTarget}) {
            /target id ${GTarget}
            /delay 2s ${Target.ID}==${GTarget}
        }
        /if (${Target.Distance}>10 && ${Target.Distance}<=${CampRadius}) {
            /moveto id ${Target.ID}
            /delay 50 ${MoveTo.Stopped}
        } else {
            /if (${Target.Distance}>${CampRadius}) /return
        }
        /if (${FindItemCount[${GItem}]}>0 || ${Cursor.ID}) {
            /if (${Cursor.ID}==${FindItem[${GItem}].ID}) {
                /goto :CursorFree
            } else {
                /shift /itemnotify ${FindItem[${GItem}].InvSlot} leftmouseup
                /delay 20 ${Cursor.ID}
            }
            :CursorFree
                /nomodkey /click left target   
                /delay 5
            /if (${Cursor.ID}) /goto :CursorFree
        } else /return
        /delay 10
        /notify GiveWnd GVW_Give_Button leftmouseup
        /delay 200 !${Window[GiveWnd].Open}
        /echo Giving ${GItem} to ${Target.CleanName}
    /return
              
| ----------------------------------------------------------------------------
| SUB: Check Plugin
| ----------------------------------------------------------------------------
    Sub CheckPlugin(string pluginname)
        /if (${Debug}) /echo ...debug CheckPlugin: enter
        /if (!${Bool[${Plugin[${pluginname}]}]}) {
            /squelch /plugin ${pluginname}
            /echo ${pluginname} not detected! This macro requires it! Loading ...
        }
        /if (${Debug}) /echo ...debug CheckPlugin: leave
    /return
| ----------------------------------------------------------------------------
| SUB: Load Ini
| ----------------------------------------------------------------------------
    Sub LoadIni(string sectionName, string varName, string varType, string varValue, string 

varArray, string FileName)
        /if (${Debug}) {
            /delay 2
            /echo ...debug Sub Loadini ${sectionName} ${varName} ${varType} ${varValue} 

${varArray} ${FileName}
        }
        | Assign ini name to default ini if not defined 
        /if (${FileName.Length}==0) {
            /declare FileName string local
            /varset FileName ${IniFileName}
        } 
        | Check if ini value is asking for an array ie buff1 to buff20
        /if (${${varArray}.Size}>0) {
            /declare i int local
                /for i 1 to ${${varArray}.Size}
                    /if (!${Ini[${FileName},${sectionName},${varArray}${i}].Length}) /ini 

"${FileName}" "${sectionName}" "${varArray}${i}" "${varValue}"
                    /if (${Ini[${FileName},${sectionName},${varArray}${i}].Length}) /varset 

${varArray}[${i}]  ${Ini[${FileName},${sectionName},${varArray}${i}]}
                /next i
            /return
        } else {
            /if (!${Defined[${varName}]} && ${Defined[varType]}) /declare ${varName} 

${varType} outer
            /if (!${Ini[${FileName},${sectionName},${varName}].Length}) {
                /if (${varValue.Length}) {
                    /ini "${FileName}" "${sectionName}" "${varName}" "${varValue}"
                    /varset ${varName} ${varValue}
                    /if (${Debug}) /echo ...debug Sub Loadini /varset ${varName} 

${varValue}
                }
            } else {
                /varset ${varName} ${Ini[${FileName},${sectionName},${varName}]} 
            }
        }
        /if (${Debug}) /echo ...debug LoadIni: leave
    /return
| ----------------------------------------------------------------------------
| SUB: End Mac If
| ----------------------------------------------------------------------------  
    Sub EndMacroIf 
        /doevents
        /if (${Debug}) /echo ...debug EndMacroIf: Enter
        /if (${GameState.Equal[CHARSELECT]}) /endmac
        | I died wait for rez loop
        :WaitOnRez
        /if ((${Me.Hovering} || ${CampZone} != ${Zone.ID}) && ${RezAcceptOn} && ${IAmDead}) 

{
            /if (${Attacking}) /call CombatReset
            /delay 10
            /goto :WaitOnRez
        }
        /if (!${RezAcceptOn} && ${CampZone} != ${Zone.ID}) /endmac
        /if (${Debug}) /echo ...debug EndMacroIf: leave
    /return

| ----------------------------------------------------------------------------
| SUB: Do Bard Stuff
| ----------------------------------------------------------------------------  
    Sub DoBardStuff 
        /if (${Me.Class.Name.NotEqual[Bard]}) /return
        /if (${Debug}) /echo ...debug DoBardStuff: Enter
        /if (${MeleeTwistOn} && ${Attacking} && !${DPSTwisting}) { 
            /varset DPSTwisting 1
            /varset Twisting 0
            /squelch /twist ${MeleeTwistWhat}
            /echo == Starting melee twist
        }
        /if (${TwistOn} && !${Attacking} && !${Twisting}) {
            /varset DPSTwisting 0
            /varset Twisting 1
            /squelch /twist ${TwistWhat}
            /echo == Starting normal twist
        }
        /if (!${TwistOn} && !${Attacking} && ${Twist}) /squelch /twist off
        /delay 1
        /if (${Debug}) /echo ...debug DoBardStuff: leave
    /return
| ----------------------------------------------------------------------------
| SUB: CheckHealth    
| ----------------------------------------------------------------------------  
    Sub CheckHealth
        /if (!${HealsOn}) /return
        /if (${DebugHeal}) /echo Sub CheckHealth enter
        /declare i                  int         local       0
        /declare MostHurtName       string      local    
        /declare MostHurtType       string      local    
        /declare MostHurtID         int         local       0
        /declare MostHurtHP         int         local       100
        /declare MostHurtNo         int         local       0
        /declare GroupHealthAvg     string      local       0
        | This is to target Main Assist out of group if class other than SK or Necro
        /if (!${Spawn[${MainAssist} ${MainAssistType} group].ID} && ${Spawn[${MainAssist} 

${MainAssistType}].ID} && ${Spawn[${MainAssist} ${MainAssistType}].Type.NotEqual[corpse]} 

&& ${Select[${Me.Class.ShortName},NEC,SHD]}==0 && ${Spawn[${MainAssist}].ID}!=${Me.Pet.ID} 

&& ${Spawn[${MainAssist}].ID}!=${Me.ID}) {
            /target id ${Spawn[${MainAssist} ${MainAssistType}].ID}
            /delay 5
            /if (${DebugHeal}) /echo Tank OOG: ${Spawn[${MainAssist}].PctHPs} ${Spawn

[${MainAssist} ${MainAssistType}].ID}  ${Spawn[${MainAssist} 

${MainAssistType}].Type.NotEqual[corpse]}
            /if (${Spawn[${MainAssist} ${MainAssistType}].PctHPs} < 100) /call DoHealStuff 

"${MainAssist}" "${MainAssistType}" ${Spawn[${MainAssist} ${MainAssistType}].PctHPs} 6
        } else {
            /if (${Spawn[${MainAssist} ${MainAssistType}].PctHPs} < 100) /call DoHealStuff 

"${MainAssist}" "${MainAssistType}" ${Spawn[${MainAssist} ${MainAssistType}].PctHPs} 6
        }
        | Check self health if not grouped
        /if (!${Group} && ${Me.PctHPs} < 100) /call DoHealStuff "${Me}" PC ${Me.PctHPs} 0
        /if (${Group} && !${JustZoned} && !${JoinedParty}) {
            /for i 0 to ${Group}
                /if (${Group} && ${Group.Member[${i}].ID} && ${Group.Member

[${i}].Type.NotEqual[corpse]}) {
                /if (${DebugHeal}) /echo -- Most Hurt:${i} ${MostHurtNo} ${MostHurtName} 

${MostHurtID} ${MostHurtHP}
                    /if (${Group.Member[${i}].PctHPs} < ${MostHurtHP}) {
                        /varset MostHurtName ${Group.Member[${i}].CleanName}
                        /varset MostHurtType ${Group.Member[${i}].Type}            
                        /varset MostHurtID ${Group.Member[${i}].ID}
                        /varset MostHurtHP ${Group.Member[${i}].PctHPs}
                        /varset MostHurtNo ${i} 
                    }
                } 
            /next i
            /if (${MostHurtHP} < 100) /call DoHealStuff "${MostHurtName}" "${MostHurtType}" 

${MostHurtHP} ${MostHurtNo}
            | Group Health Check
            /call GrouopHealthCheck
            /varset GroupHealthAvg ${Macro.Return}
            /if (${DebugHeal}) /echo Group Health Average ${GroupHealthAvg}
            | Check for group heals
            /if (${GroupHealthAvg} < 100 && ${Group}) /call DoGrouopHealStuff 

${GroupHealthAvg}
        }
        /if (${AutoRezOn}) /call RezCheck
        /if (${PetOn} && ${Me.Pet.ID} && ${Me.Pet.PctHPs} < 100) /call DoPetHealStuff 
        /if (${DebugHeal}) /echo Sub CheckHealth leave
    /return
|----------------------------------------------------------------------------
| SUB: Do Heal Stuff 
|----------------------------------------------------------------------------         
    Sub DoHealStuff(HealName, HealType, int HealHPs, int WhoNum)
        /if (!${HealsOn} || ${Me.Moving} || ${Window[RespawnWnd].Open}) /return
        /if (${DebugHeal}) /echo  DoHealStuff: Enter ${HealName} ${HealType} ${HealHPs} 

${WhoNum} 
        /doevents
        /declare i              int     local   0
        /declare HealSpell      string  local
        /declare HealPct        int     local
        /declare HealTag        string  local
        /declare HealThem       int     local   ${Spawn[${HealName} ${HealType}].ID}
        /declare MainAssistID   int     local   ${Spawn[${MainAssist} 

${MainAssistType}].ID}
        /declare HealMA         int     local   0
        /if (${DebugHeal}) /echo ${Spawn[${HealName} ${HealType}].ID} || ${Select

[${HealType},PC,Pet,Mercenary]}
        | Check for player in zone and type skip heal if false
        /if (!${Spawn[${HealName} ${HealType}].ID} || !${Select

[${HealType},PC,Pet,Mercenary]}) /return  
        | If whonum=6 assign tank priority
        /if (${WhoNum}>=6 || ${HealThem}==${MainAssistID}) {
            /varset HealMA 1 
            /varset WhoNum 6
        }   
        /for i 1 to ${Heals.Size}
        | If heal is null or off |0 skip it
        /if (!${Heals[${i}].Length} || ${Heals[${i}].Arg[2,|].Equal[0]}) /goto :NextHeal
            /varset HealSpell   ${Heals[${i}].Arg[1,|]} 
            /varset HealPct     ${Heals[${i}].Arg[2,|]}
            /varset HealTag     ${Heals[${i}].Arg[3,|]}
            /if (${HealTag.Find[!MA]} && ${HealMA}) /goto :NextHeal
            /if (${HealTag.Find[MA]} && !${HealMA}) /goto :NextHeal
            | Check For Life Taps 
            /if (${HealTag.Find[Tap]}) { 
                /if (${CombatStart} && ${Me.PctHPs}<=${HealPct} && ${Spawn

[${MyTargetID}].ID} && ${Spawn[${MyTargetID}].Distance}<=${Spell[${HealSpell}].MyRange} && 

${Spell${i}GM0}==0) {
                    /call CastWhat "${HealSpell}" ${Spawn[${MyTargetID}].ID}
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                        /echo -- ${HealSpell} for  >> ${Me.CleanName} << 
                        /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+o

+]${HealSpell} for  >> ${Me.CleanName} <<[+x+]
                        /varcalc Spell${i}GM0 (${Spell

[${HealSpell}].Duration.TotalSeconds}*${DurationMod})*10
                        /if (${DebugHeal}) /echo Assign Timer:Spell${i}GM0 (${Spell

[${HealSpell}].Duration.TotalSeconds}*${DurationMod}) ${Spell${i}GM0}
                        /return
                    }
                   /call CheckCasting 50
                } else {
                    /goto :NextHeal
                }
            }
            | Shammy/druid heal skip over group type check
            /if (${Me.Class.Name.Equal[Shaman]} && ${Spell[${HealSpell}].Name.Find

[Intervention]} || ${Me.Class.Name.Equal[Druid]} && ${Spell[${HealSpell}].Name.Find

[Survival]}) /goto :ShamanHeal
            | If type group heal skip 
            /if (${Spell[${HealSpell}].TargetType.Find[group]} || ${Spell[${FindItem

[${HealSpell}].Spell}].TargetType.Find[group]})  /goto :NextHeal
            /if (${DebugHeal}) /echo DoHealStuff GM:${WhoNum} ${HealName} HealAt:${HealPct} 

Heal:${i} ${HealSpell} HealTimer:Spell${i}GM${WhoNum} ${Spell${i}GM${WhoNum}}            
            :ShamanHeal
            | Check conditons for heals
            /if ((${Select[${Spell[${HealSpell}].TargetType},Single,Self]} || ${Spell

[${FindItem[${HealSpell}].Spell}].TargetType.Find[self]} || ${Me.Class.Name.Equal[Shaman]} 

&& ${Spell[${HealSpell}].Name.Find[Intervention]} || ${Me.Class.Name.Equal[Druid]} && 

${Spell[${HealSpell}].Name.Find[Survival]}) && ${Spawn[${HealName} ${HealType}].PctHPs}<=

${HealPct} && ${HealThem} && ${Spawn[${HealName} ${HealType}].Distance}<=${Spell

[${HealSpell}].MyRange} && ${Spell${i}GM${WhoNum}}==0) {
                /if (${Select[${MacroQuest.Server},zek]} && ${Select[${Target.Type},PC]}) {
                    /if (${Me.Combat}) {
                        /attack off
                        /delay 25 !${Me.Combat}
                    }
                    /squelch /target id ${HealThem}
                    /delay 5
                }
                /if (!${Cast.Ready[${HealSpell}]})  /goto :NextHeal
                /call CastWhat "${HealSpell}" ${HealThem}
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                    /echo -- ${HealSpell} on  >> ${Spawn[${HealName} 

${HealType}].CleanName} << 
                    /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+o

+]${HealSpell} on  >> ${Spawn[${HealName} ${HealType}].CleanName} <<[+x+]
                    /varcalc Spell${i}GM${WhoNum} (${Spell

[${HealSpell}].Duration.TotalSeconds}*${DurationMod})*10
                    /if (${DebugHeal}) /echo  Assign Timer:Spell${i}GM${WhoNum} ${Spell

[${HealSpell}].Duration.TotalSeconds}*${DurationMod} ${Spell${i}GM${WhoNum}}
                    /return
                }
                /call CheckCasting 100
            }
        :NextHeal
        /next i
        /if (${DebugHeal}) /echo DoHealStuff: Leave
    /return    
| ----------------------------------------------------------------------------
| SUB: Group Health Check 
| ----------------------------------------------------------------------------
    Sub GrouopHealthCheck
        /if (${DebugHeal}) /echo GrouopHealthCheck: Enter
        /declare j                  int     local   0
        /declare GroupHealthTl      float   local   .1
        /declare GroupHealthPct     float   local   0
        /declare NotDead            int     local   0
        /for j 0 to ${Group}
            /if (${Group} && ${Group.Member[${j}].ID} && ${Group.Member

[${j}].Type.NotEqual[corpse]}) {
                | Calculate total group health for group heal spells
                /if (${Group.Member[${j}].Distance}<100) { 
                    /if (${DebugHeal}) /echo -- Group Health: GM:${j} Health:

${Group.Member[${j}].PctHPs}
                    /varcalc GroupHealthTl ${GroupHealthTl}+${Group.Member[${j}].PctHPs}
                    /varcalc NotDead ${NotDead}+1
                    /varcalc GroupHealthPct ${GroupHealthTl}/${NotDead}
                }
            }
        /next j
            /if (${DebugHeal}) /echo GrouopHealthCheck: Leave ${GroupHealthPct}
    /return ${GroupHealthPct}
| ----------------------------------------------------------------------------
| SUB: Do Group Heal Stuff 
| ----------------------------------------------------------------------------
Sub DoGrouopHealStuff(int GroupHealth)
    /if (${DebugHeal}) /echo DoGroupHealStuff: Enter ${GroupHealth} 
    /doevents
    /declare j              int     local
    /declare HealSpell      string  local
    /declare HealPct        string  local
    /for j 1 to ${Heals.Size}
        /if (!${Heals[${j}].Length} || ${Heals[${j}].Arg[2,|].Equal[0]}) /return
        /varset HealSpell   ${Heals[${j}].Arg[1,|]} 
        /varset HealPct     ${Heals[${j}].Arg[2,|]}
        /if (${Select[${Spell[${HealSpell}].TargetType},Single,Self]} || ${Spell

[${FindItem[${HealSpell}].Spell}].TargetType.Find[self]}) /goto :NextHeal2
        /if (${Me.Class.Name.Equal[Shaman]} && ${Spell[${HealSpell}].Name.Find

[Intervention]} || ${Me.Class.Name.Equal[Druid]} && ${Spell[${HealSpell}].Name.Find

[Survival]}) /goto :NextHeal2
        /if (${DebugHeal}) /echo DoGroupHealStuff: ${HealSpell} ${HealPct}
        /if (${Spell[${HealSpell}].TargetType.Find[group]} || ${Spell[${FindItem

[${HealSpell}].Spell}].TargetType.Find[group]}) /if (${DebugHeal}) /echo DoHealStuff -- 

Group Heal Spell/Item:${Spell[${HealSpell}].TargetType.Find[group]}/${Spell[${FindItem

[${HealSpell}].Spell}].TargetType.Find[group]}) Spell:${HealSpell} GpAvg:${GroupHealth} 

HealAt:${HealPct} Timer:${SpellGH${j}}==0 
        /if (${GroupHealth}<=${HealPct} && ${SpellGH${j}}==0 && (${Spell

[${HealSpell}].TargetType.Find[group]} || ${Spell[${FindItem

[${HealSpell}].Spell}].TargetType.Find[group]}) && ${Group}) {
            /call CastWhat "${HealSpell}" ${Me.ID}
            /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                /if (${DebugHeal}) /echo -- ${HealSpell} on  >> Group << 
                 /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+o

+]${HealSpell} on  >> Group <<[+x+]
                /varcalc SpellGH${j} (${Spell[${HealSpell}].Duration.TotalSeconds}*

${DurationMod})*10
                /if (${DebugHeal}) /echo Assign Timer:SpellGH${j} (${Spell

[${HealSpell}].Duration}*${DurationMod}.TotalSeconds) ${SpellGH${j}}
                /return
            }                
        }
    :NextHeal2
    /next j
    /if (${DebugHeal}) /echo DoGroupHealStuff: Leave
/return
| -------------------------------------------------------------------------------------
| SUB: DoPetHealStuff
| -------------------------------------------------------------------------------------  
    Sub DoPetHealStuff  
        | Check if my pet needs healing
        | /echo pet heal
        /declare j int local 
        /for j 1 to ${Heals.Size}
            /if (${Heals[${j}].Arg[3,|].NotEqual[pet]} || !${Heals[${j}].Length} || 

${Heals[${j}].Arg[2,|]}==0) /goto :NextPetHeal
            /if (${Me.Pet.PctHPs}<=${Heals[${j}].Arg[2,|]} && ${Me.Pet.ID} && 

${Me.Pet.Distance}<${Spell[${Heals[${j}].Arg[1,|]}].Range}) {
               /if (${DebugHeal}) /echo PET (${Heals[${j}].Arg[3,|].Find[PET]} && 

${HealThem}==${Me.ID} && ${Me.Pet.PctHPs}<=${HealPct} && ${Me.Pet.ID} && 

${Me.Pet.Distance}<${Spell[${Heals[${j}].Arg[1,|]}].Range}) 
               /call CastWhat "${Heals[${j}].Arg[1,|]}" ${Me.Pet.ID}
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                    /echo -- ${Heals[${j}].Arg[1,|]} on  >> ${Me.Pet.CleanName} << 
                    /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+o

+]${Heals[${j}].Arg[1,|]} on  >> ${Me.Pet.CleanName} <<[+x+]
                    /varcalc PetHealTimer${j} (${Spell[${Heals[${j}].Arg

[1,|]}].Duration.TotalSeconds}*${DurationMod})*10
                }
            }
            :NextPetHeal
        /next j
    /return

| -------------------------------------------------------------------------------------
| SUB: Rez Check
| -------------------------------------------------------------------------------------
    Sub RezCheck    
    /doevents
    /if (!${AutoRezOn} || ${DMZ}) /return
    /declare i int local
    /declare j int local
    /declare CorpseCount int local
    /declare RezMeID int local
    /declare RezID int local
    /declare RezRadius int local 150
    /if (${AutoRezOn} && !${Me.Hovering}) {
        | Do I have a Corpse
        /varset RezMeID ${Spawn[corpse ${Me} radius ${RezRadius} zradius 50].ID}
        /if (${RezMeID} && ${OOCRezTimer${RezMeID}}==0 && ${Cast.Ready[${AutoRezWith}]}) {
        /if (!${Defined[OOCRezTimer${RezMeID}]}) /declare OOCRezTimer${RezMeID} timer outer 

1m
            /target id ${RezMeID}
            /delay 10 ${Target.ID}
            /if (${Target.Distance}>${CampRadius}) /corpse
            /delay 10
            /call  CastWhat "${AutoRezWith}" ${Target.ID}
            /if (${Cast.Result.Equal[CAST_SUCCESS]}) /varset OOCRezTimer${RezMeID} 3m
        }
        | Does Group Member have a corpse?
        /for i 0 to ${Group}
        /if (${Group.Member[${i}].Type.NotEqual[corpse]}) /goto :NextChar
            | Check for group member corpses and battle rez
            /if (${Group.Member[${i}].Type.Equal[corpse]} && ${BattleRezTimer${i}}==0 && 

${Cast.Ready[${AutoRezWith}]}) {
                /if (${Group.Member[${i}].Type.Equal[corpse]} && ${Group.Member

[${i}].Distance}<${RezRadius}) {
                /tar pc ${Group.Member[${i}].CleanName}
                    /delay 10 ${Target.ID}
                        /if (${Target.Distance}<100) {
                            /if (${Target.Distance}>${CampRadius} && !

${Target.CleanName.Find[${MainAssist}]}) /corpse
                            /delay 10
                            /call  CastWhat "${AutoRezWith}" ${Target.ID}
                            /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                                /echo BATTLE REZZED =>> ${Group.Member[${i}]} <<=
                                /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /

${EQBCSay} [+o+]BATTLE REZZED =>> ${Group.Member[${i}]} <<=[+x+]
                                /varset BattleRezTimer${i} 3m
                            } else {
                                /varset BattleRezTimer${i} 1m
                            }
                        }
                    }
                }
            :NextChar
        /next i
        | Out of Combat Rez   
        /varset CorpseCount ${SpawnCount[corpse radius ${RezRadius} zradius 50]} 
        /if (${CorpseCount}>0 && !${CombatStart}) {
            /for j 1 to ${CorpseCount} 
                /varset RezID ${NearestSpawn[${j},corpse radius ${RezRadius} zradius 

50].ID}
                /if (${Spawn[${RezID}].Deity.ID} && ${Spawn[${RezID}].Type.Equal[corpse]} 

&& ${OOCRezTimer${RezID}}==0 && ${Cast.Ready[${AutoRezWith}]}) {
                    /target id ${RezID}
                    /delay 10 ${Target.ID}==${RezID}
                    /if (!${Defined[OOCRezTimer${RezID}]}) /declare OOCRezTimer${RezID} 

timer outer 1m
                    /if (${Target.Distance}<=${RezRadius}) {
                        /echo REZZED =>> ${Spawn[${RezID}].CleanName} <<=
                        /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+o+]

REZZED =>> ${Spawn[${RezID}].CleanName} <<=[+x+]
                        /call  CastWhat "${AutoRezWith}" ${Target.ID}
                        /delay 10
                        /if (${Cast.Result.Equal[CAST_SUCCESS]}) /varset OOCRezTimer

${RezID} 3m
                    }
                }
            /next j 
        }
    }
/Return
| -------------------------------------------------------------------------------------
| SUB: Loot Stuff
| -------------------------------------------------------------------------------------
    Sub LootStuff
        /if (!${LootOn} || ${AggroTargetID})  /return 
        /if (${Debug}) /echo ...debug LootStuff: Enter
        /if (${Me.FreeInventory}==0) {
            /echo Inventory is full. Looting OFF
            /varset LootOn 0
            /return
        }
        /doevents 
        /call LootMobs
        /if (${ReturnToCamp}) /call DoWeMove
        /if (${Debug}) /echo ...debug LootStuff: Leave
    /return
| -------------------------------------------------------------------------------------
|   MobRadar
| -------------------------------------------------------------------------------------
    Sub MobRadar(int CountRadius)
        /if (${DMZ}) /return
        /if (${Debug}) /echo ...debug MobRadar ${CountRadius} Enter
        /declare NMob string local
        /declare i int local
        /declare k int local
        | Skip mobs on Ignore Mob list if not on xtarget
        /for k 1 to 10
            /if (${MobsToIgnore.Arg[${k},,].Length} && !${MobsToIgnore.Find[null]} && 

${Debug}) /echo ... debug Ignore ${MobsToIgnore.Arg[${k},,]}
            /if (${MobsToIgnore.Arg[${k},,].Length} && ${Select[${AddsArray[${i},3]},

${Me.XTarget[1].Name},${Me.XTarget[2].Name},${Me.XTarget[3].Name},${Me.XTarget[4].Name},

${Me.XTarget[5].Name},${Me.XTarget[6].Name},${Me.XTarget[7].Name},${Me.XTarget[8].Name},

${Me.XTarget[9].Name},${Me.XTarget[10].Name}]}==0)  /squelch /alert add 3 

"${MobsToIgnore.Arg[${k},,]}"
        /next k
        /varset MobCount ${SpawnCount[npc targetable los radius ${CountRadius} zradius 50 

noalert 3]}
        /for i 1 to ${MobCount}
			/varset NMob ${NearestSpawn[${i},npc targetable los radius 

${CountRadius} zradius 50 noalert 3].ID}
            /if (${i}>10) /goto :ArrayExceed
            /if (${AddsArray[${i},1].NotEqual[NULL]} && (${Spawn[${AddsArray

[${i},1]}].Type.Equal[Corpse]} || !${Spawn[${AddsArray[${i},1]}].ID})) /call 

RemoveFromArray ${i}
            /if (${MobCount}>0 && ${Select[${NMob},${AddsArray[1,1]},${AddsArray[2,1]},

${AddsArray[3,1]},${AddsArray[4,1]},${AddsArray[5,1]},${AddsArray[6,1]},${AddsArray[7,1]},

${AddsArray[8,1]},${AddsArray[9,1]},${AddsArray[10,1]}]}==0) /call AddToArray ${NMob}       

      
            :ArrayExceed
       /next i
       /squelch /alert clear 3
        /if (${Debug}) /echo ...debug MobRadar leave
    /return
| -------------------------------------------------------------------------------------
| SUB: Add to Array
| -------------------------------------------------------------------------------------
    Sub AddToArray(int AddMobID)
    /if (!${AddMobID}) /return
        /if (${Debug}) /echo AddToArray ${AddMobID} enter
        /declare i int local 
        /for i 1 to 10
            /if (${AddsArray[${i},1].Equal[NULL]}) {
                /varset AddsArray[${i},1] ${Spawn[${AddMobID}].ID}
                /varset AddsArray[${i},2] ${Spawn[${AddMobID}].Level}
                /varset AddsArray[${i},3] ${Spawn[${AddMobID}].CleanName}
                /if (${Debug}) /echo ARRAY Assign >> ${AddsArray[${i},3]} << to AddsArray

${i}.
                /return
            }
        /next i
         /if (${Debug}) /echo AddToArray leave
    /return
| -------------------------------------------------------------------------------------
| SUB: Remove From Array
| -------------------------------------------------------------------------------------    
    Sub RemoveFromArray(int ArNum)
        /if (${AddsArray[${ArNum},1].Equal[NULL]}) /return
        /if (${Debug}) /echo RemoveFromArray ${ArNum} enter
        /if (${Debug}) /echo ARRAY Remove >> ${AddsArray[${ArNum},3]} << from AddsArray

${ArNum}.
        /varset AddsArray[${ArNum},1] NULL
        /varset AddsArray[${ArNum},2] NULL
        /varset AddsArray[${ArNum},3] NULL
        /if (${MezOn}) {
            /varset MezCount[${ArNum}] 0
            /varset MezTimer${ArNum} 0
        }
        /if (${Debug}) /echo RemoveFromArray leave
    /return
| -------------------------------------------------------------------------------------
| SUB: Clear Array
| -------------------------------------------------------------------------------------
    Sub ClearArray
        /declare i int local 
        /for i 1 to ${MobCount}
            /call RemoveFromArray ${i}
        /next i
        /varset MobCount 0
     /return
| -------------------------------------------------------------------------------------
| SUB: Do Mez Stuff
| -------------------------------------------------------------------------------------
    Sub DoMezStuff
        /doevents
        /if (!${MezOn} || ${Window[RespawnWnd].Open} || ${DMZ}) /return        
        /if (${DebugMez}) /echo ...debug_mez DoMezStuff: enter
        /declare i int local
        /declare SkipMezOld int local ${Ini[${IniFileName},Mez,MezStopHPs]}
        | Reset skip mez on health setting if tank dies to 1%
        /if (!${Spawn[${MainAssist}].ID}) /varset MezStopHPs 1
        /call MobRadar ${MezRadius}
		/if (${DebugMez}) /echo ${MobCount}<2 && ${Spawn[${MainAssist}].ID}
        /if (${MobCount}<2 && ${Spawn[${MainAssist} ${MainAssistType}].ID}) /return 
        /for i 1 to 10
            | Every Mez test conditon is listed seperately for clarity
            | Test -> array not empty, target=array, above mez hps, within mez levels, line 

of sight, not a giant, immune list, mob ignore list,  already mez'd timer, Merc tank mob<=1 
            /if (${DebugMez}) /echo ${i}
			/if (${DebugMez}) /echo (${AddsArray[${i},1].Equal[NULL]})
            /if (${AddsArray[${i},1].Equal[NULL]})  /goto :SkipMez
            /if (${DebugMez}) /echo ${AddsArray[${i},1].Equal[${MyTargetID}]} && ${Spawn

[${MainAssist}].ID}
            /if (${AddsArray[${i},1].Equal[${MyTargetID}]} && ${Spawn[${MainAssist} 

${MainAssistType}].ID}) /goto :SkipMez
            /if (${DebugMez}) /echo ${Spawn[${AddsArray[${i},1]}].PctHPs}<${MezStopHPs}
            /if (${Spawn[${AddsArray[${i},1]}].PctHPs}<${MezStopHPs}) /goto :SkipMez
			/if (${DebugMez}) /echo (${AddsArray[${i},2]}>${MezMaxLevel} || 

${AddsArray[${i},2]}<${MezMinLevel})
            /if (${AddsArray[${i},2]}>${MezMaxLevel} || ${AddsArray[${i},2]}<

${MezMinLevel}) /goto :SkipMez
			/if (${DebugMez}) /echo !${Spawn[${AddsArray

[${i},1]}].LineOfSight})
            /if (!${Spawn[${AddsArray[${i},1]}].LineOfSight}) /goto :SkipMez 
			/if (${DebugMez}) /echo ${Spawn[${AddsArray

[${i},1]}].Body.Name.Equal[Giant]}) /goto :SkipMez 
            /if (${Spawn[${AddsArray[${i},1]}].Body.Name.Equal[Giant]}) /goto :SkipMez 
            /if (${MezImmune.Find[${AddsArray[${i},3]}]}) {
                /if (${MMTimer${i}}==0) /docommand  /${EQBCSay} [+g+]MEZ Immune Detected -> 

${AddsArray[${i},3]} <- ID:${AddsArray[${i},1]}[+x+]
                /varset MMTimer${i} 1m
                /goto :SkipMez
            }
            | /if (${MobsToIgnore.Find[${AddsArray[${i},3]}]} && ${Select[${AddsArray

[${i},3]},${Me.XTarget[1].Name},${Me.XTarget[2].Name},${Me.XTarget[3].Name},${Me.XTarget

[4].Name},${Me.XTarget[5].Name},${Me.XTarget[6].Name},${Me.XTarget[7].Name},${Me.XTarget

[8].Name},${Me.XTarget[9].Name},${Me.XTarget[10].Name}]}==0) /goto :SkipMez 
            /if (${Me.CurrentMana}<${Spell[${MezSpell}].Mana}) /goto :SkipMez
            /if (${MezTimer${i}} > 0) /goto :SkipMez
            /if (${MobCount}<=1 && ${Spawn[${MainAssist} ${MainAssistType}].ID} && 

(${Spawn[${MainAssist} ${MainAssistType}].Type.Equal[Mercenary]} || ${Spawn[${MainAssist} 

${MainAssistType}].Type.Equal[Pet]}))  /goto :SkipMez
            /if (${Spawn[${MainAssist} ${MainAssistType} group].ID} && ${Select

[${AddsArray[${i},1]},${Me.XTarget[1].ID},${Me.XTarget[2].ID},${Me.XTarget[3].ID},

${Me.XTarget[4].ID},${Me.XTarget[5].ID},${Me.XTarget[6].ID},${Me.XTarget[7].ID},

${Me.XTarget[8].ID},${Me.XTarget[9].ID},${Me.XTarget[10].ID}]}==0) /goto :SkipMez
            /if (${DebugMez}) /echo ...debug_mez MezTimer${i} ${MezTimer${i}} ${Spawn

[${AddsArray[${i},1]}].ID} ${i}
            | Necros can't AEMez
            /if (${MezAECount}>0 && ${MobCount}>=${MezAECount} && ${MezAETimer}==0 && 

${Spawn[${AddsArray[${i},1]}].ID} && ${Select[${Me.Class.ShortName},BRD,ENC]})  {
                /if (${MyTargetID} && ${CombatStart}) {
                    /call MezMobsAE ${MyTargetID}
                } else {
                    /call MezMobsAE ${AddsArray[${i},1]}
                }
            }
            /call MezMobs ${AddsArray[${i},1]} ${i}
            :SkipMez
        /next i
        /if (${Spawn[${MainAssist} ${MainAssistType}].ID} && ${MezStopHPs}==1) /varset 

MezStopHPs ${SkipMezOld}
        /if (${DebugMez}) /echo ...debug_mez DoMezStuff: Leave
    /return
| -------------------------------------------------------------------------------------
| SUB: Mez Mobs AE 
| -------------------------------------------------------------------------------------
Sub MezMobsAE(int AEMezID)
    | Bard AE mez code
    /declare i int local 1
    /if (${IAmABard}) { 
        /squelch /twist once ${Me.Gem[${MezAESpell}]}
        /echo MEZZING-> AE Mezzing Now - ${MezAESpell}
        /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+g+]MEZZING-> AE 

Mezzing Now - ${MezAESpell} [+x+]
        /delay 35 
        /varset MezAETimer 300
    }
    | Enchanter AE mez code
    /if (${Me.Class.Name.Equal[Enchanter]}) { 
        /echo I AM AE MEZZING ${MezAESpell}
        /call CastWhat "${MezAESpell}" ${AEMezID}
        /echo I JUST CAST AE MEZ ${MezAESpell}
        /delay 3s ${Cast.Ready[${MezAESpell}]}
        /varset MezAETimer ${Spell[${MezAESpell}].Duration.TotalSeconds}s
         /if (${DebugMez}) /echo  ...debug_mez TIMER SET ${MezAETimer}
        /echo MEZZING-> AE Mezzing Now - ${MezAESpell}
        /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+g+]AE MEZZING-> 

${MezAESpell} [+x+]
    }
    | Reset all mez timers to 0 after AE Mez
    /for i 1 to 10
        /varset MezTimer${i} 0
    /next i
/return
| -------------------------------------------------------------------------------------
| SUB: Mez Mobs 
| -------------------------------------------------------------------------------------
    Sub MezMobs(int MobID, int TimerNum)
        /if (${DebugMez}) /echo ...debug_mez MezMobs enter MobID:${MobID} Timer#:

${TimerNum}
        /declare MezFail int local 0
        /declare MezTry int local 1
        /if (${Me.Combat}) {
                /attack off
                /delay 25 !${Melee.Combat}
        }  
        /squelch /target id ${MobID}
        /if (${Target.ID}==${MobID}) {
            /if (${MezCount[${TimerNum}]}<1) /echo MEZZING-> ${Spawn[${MobID}].CleanName} 

<- ID:${MobID}
            /if (${EQBC.Connected} && ${EQBCOn} && ${MezCount[${TimerNum}]}<1) /docommand  

/${EQBCSay} [+g+]MEZZING-> ${Spawn[${MobID}].CleanName} <- ID:${MobID}[+x+]
            /if (${MezCount[${TimerNum}]}>=1) /echo ReMEZZING-> ${Spawn

[${MobID}].CleanName} <- ID:${MobID}
            /if (${EQBC.Connected} && ${EQBCOn} && ${MezCount[${TimerNum}]}>=1) /docommand  

/${EQBCSay} [+g+]ReMEZZING-> ${Spawn[${MobID}].CleanName} <- ID:${MobID}[+x+]
            | Chanter mez code
            :retrymez
            /if (${Me.Class.Name.Equal[Enchanter]}) { 
                /delay 3s ${Cast.Ready[${MezSpell}]}
                /call CastWhat "${MezSpell}" ${MobID}
                /varcalc MezFail ${MezFail}+1
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) { 
                    /varcalc MezCount[${TimerNum}] ${MezCount[${TimerNum}]}+1
                    /varcalc MezTimer${TimerNum} ((${Spell

[${MezSpell}].Duration.TotalSeconds}+${MezMod})*10)*.85
                    /if (${DebugMez}) /echo ...debug_mez MezTimer${TimerNum} ${MezTimer

${TimerNum}}
                }
                /if (${Macro.Return.Equal[CAST_RESIST]} && ${MezFail}<2) {
                    /echo MEZ Resisted -> ${Spawn[${MobID}].CleanName} <- ID:${MobID}
                    /docommand  /${EQBCSay} [+g+]MEZ Resisted -> ${Spawn

[${MobID}].CleanName} <- ID:${MobID}[+x+]
                    /goto :retrymez
                }
            }
            | Bard mez code
            /if (${IAmABard}) { 
                /squelch /twist once ${Me.Gem[${MezSpell}]}
                /delay 35 
                /squelch /target clear
                /varcalc MezCount[${TimerNum}] ${MezCount[${TimerNum}]}+1
                /varset MezTimer${TimerNum} 110
            }  
            | Necro mez code
            /if (${Me.Class.Name.Equal[Necromancer]}) { 
                /delay 3s ${Cast.Ready[${MezSpell}]}
                /call CastWhat "${MezSpell}" ${MobID}
                /delay 5s ${Cast.Status.Equal}
                /varcalc MezFail ${MezFail}+1
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) { 
                    /varcalc MezCount[${TimerNum}] ${MezCount[${TimerNum}]}+1
                    /varcalc MezTimer${TimerNum} ((${Spell

[${MezSpell}].Duration.TotalSeconds}+${MezMod})*10)*.85
                    /if (${DebugMez}) /echo MezTimer${TimerNum} ${MezTimer${TimerNum}}
                }
                /if (${Macro.Return.Equal[CAST_RESIST]} && ${MezFail}<2) {
                    /echo MEZ Resisted -> ${Spawn[${MobID}].CleanName} <- ID:${MobID}
                    /docommand  /${EQBCSay} [+g+]MEZ Resisted -> ${Spawn

[${MobID}].CleanName} <- ID:${MobID}[+x+]
                    /goto :retrymez
                }
            }
            /varset MezTry 0    
        }
    /if (${DebugMez}) /echo ...debug_mez MezMobs leave
    /return
| -------------------------------------------------------------------------------------
| SUB: Event MezBroke 
| -------------------------------------------------------------------------------------   
Sub Event_MezBroke(meztext,mezmob,mezbreaker)
    /if (${DebugMez}) /echo ...debug_mez event mezbroke enter
        /if (!${MezOn} || ${MyTargetID}==${Spawn[${mezmob}].ID}) /return
        /declare i int local
        /echo => ${mezbreaker} <= has AWAKENED ${mezmob}.
        /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+g+]>> ${mezbreaker} 

<< has awakened -> ${mezmob}<-[+x+]
        /if (${Spawn[mezbreaker].CleanName.NotEqual[${MainAssist}]}) {
            /for i 1 to 10
                /if (${AddsArray[${i},1].Equal[${Spawn[${mezmob}].ID}]}) {
                    /echo Resetting Mez Timer ${mezmob} ID:${Spawn[${mezmob}].ID}
                    /varset MezTimer${i} 0
                }
            /next i
        }
        /doevents flush Event_MezBroke
    /if (${DebugMez}) /echo ...debug_mez event mezbroke leave
/return    
| -------------------------------------------------------------------------------------
| SUB: Event MezImmune 
| -------------------------------------------------------------------------------------    
    Sub Event_MezImmune(int MezID)
    /if (${MezTry} || ${Select[${Me.Class},Bard,Enchanter]}==0) /return 
        | Assign temp var MezImmune list
        /declare ImmuneAdd string local ${MezImmune}
        | If mezimmune default text with the word null in it assign var spawn clean name
        /if (${ImmuneAdd.Find[null]}) {
            /varset ImmuneAdd ${Spawn[${MezID}].CleanName}
        } else {
            /varset ImmuneAdd ${ImmuneAdd},${Spawn[${MezID}].CleanName}
        }
        /if (!${MezImmune.Find[${Spawn[${MezID}].CleanName}]}) /ini "${InfoFileName}" 

"${Zone}" "MezImmune" "${ImmuneAdd}"
        /echo MEZ Immune -> ${Spawn[${MezID}].CleanName} <- ID:${MezID} Adding to MezImmune 

list.
        /docommand  /${EQBCSay} [+g+]MEZ Immune -> ${Spawn[${MezID}].CleanName} <- ID:

${MezID} Adding to MezImmune list.[+x+]
        | Reassign mezimmune var the new list
        /varset MezImmune ${ImmuneAdd}
    /return
| -------------------------------------------------------------------------------------
| SUB: Event AddToIgnore 
| -------------------------------------------------------------------------------------    
    Sub Event_AddToIgnore(Message,string MTIgnore)
        /if (!${MTIgnore.Length} || ${MTIgnore.Find[null]} || ${Spawn[${MTIgnore}].ID}==

${Me.ID}) {
            /echo Add to Ignore=NULL nothing added to list.
            /return
        }
        | Assign temp var MezImmune list
        /declare IgnoreAdd string local ${MobsToIgnore}
        /declare IgnoreCorpse string local
        | If mezimmune default text with the word null in it assign var spawn clean name
        /if (${IgnoreAdd.Find[null]}) {
            /varset IgnoreAdd ${Spawn[${MTIgnore}].CleanName}
        } else {
            /varset IgnoreAdd ${IgnoreAdd},${Spawn[${MTIgnore}].CleanName}
        }
        | Remove 's corpse if closest match is a mob corpse
        /if (${IgnoreAdd.Right[-10].Find[corpse]}) /varset IgnoreAdd ${IgnoreAdd.Right[-8]}
        /if (${MobsToIgnore.Find[${Spawn[${MTIgnore}].CleanName}]}) {
            /echo ${Spawn[${MTIgnore}].CleanName} already on Ignore List.
            /return
        }
        /if (!${MobsToIgnore.Find[${Spawn[${MTIgnore}].CleanName}]}) {
            /ini "${InfoFileName}" "${Zone}" "MobsToIgnore" "${IgnoreAdd}"
            /echo AddToIgnore -> ${Spawn[${MTIgnore}].CleanName} <- Adding to Ignore list.
        } else {
            /echo ${Spawn[${MTIgnore}].CleanName} already on Ignore List.
            /return
        }
         | Reassign mezimmune var the new list
        /varset MobsToIgnore ${IgnoreAdd}
    /return   
| -------------------------------------------------------------------------------------
| SUB: Pick pocket
| -------------------------------------------------------------------------------------    
    Sub Event_Picked
    /if (${Cursor.ID}) /autoinventory
    /return   

| -------------------------------------------------------------------------------------
| SUB: Event_ToggleVariable  Check whenever the player is changing any variable via /echo
| -------------------------------------------------------------------------------------    
    Sub Event_ToggleVariable(string Line, string Command, string Command2)
        /declare i int local
        | Toggle Variables & Set Variables
        /if (${Defined[${Command}]}) {
            /declare OnOff local
            /if (${Command2.NotEqual[NULL]}) {
                /varset ${Command} ${Command2}
            } else /if (${${Command}}) {
                /varset ${Command} 0
                /varset OnOff Off
                /if (!${ChaseAssist} && ${Stick.Active})  /squelch /stick off
            } else {
                /varset ${Command} 1
                /varset OnOff On
                /if (${Command.Equal[ChaseAssist]}) {
                    /if (${ReturnToCamp}) /varset ReturnToCamp 0
                }
                | Turn on return to camp & set new y,x coord
                /if (${Command.Equal[ReturnToCamp]}) {
                    /varset CampXLoc ${Me.X} 
                    /varset CampYLoc ${Me.Y}
                    /varset CampZLoc ${Me.Z}
                    /varset LookForward ${Me.Heading.DegreesCCW}
                    | Turn off ChaseAssit if on
                    /if (${ChaseAssist}) {
                        /varset ChaseAssist 0
                        /squelch /stick off
                        /echo >> ChaseAssist Off
                    }
                    /echo >> New camp set ${Me.Y}, ${Me.X}
                }
            }
           | /ini "${IniFileName}" "${sectionName}" "${varName}" "${varValue}"
            /echo >> Set ${Command}: ${OnOff}
            /return
        }
    /return
| -------------------------------------------------------------------------------------
| SUB: DoMiscStuff 
| -------------------------------------------------------------------------------------    
    Sub DoMiscStuff
    /if (${Debug}) /echo ...debug DoMiscStuff enter
        | Accept trades
        /if (${Window[TradeWnd].Open} && ${Window[TradeWnd].HisTradeReady} && !

${Cursor.ID}) /notify TradeWnd TRDW_Trade_Button leftmouseup
        | Accept group invite
        /if (${Window[GroupWindow].Child[GW_FollowButton]} && ${AcceptInvitesOn}) /invite
        | Open HoTT window if available
        /if (${HoTTOn} && !${Window[TargetOfTargetWindow].Open} && ${Me.LAHoTT} && 

${Me.GroupSize}>2) /windowstate TargetOfTargetWindow open
        | Ditch wizards familiar
        /if (${Me.Pet.CleanName.Equal[${Me.Name}`s familiar]} && 

${Me.Class.ShortName.Equal[Wiz]}) /pet get lost
    /if (${Debug}) /echo ...debug DoMiscStuff leave
    /return
| -------------------------------------------------------------------------------------
| SUB: Can I do Stuff  - Check if invis moving ducked etc
| -------------------------------------------------------------------------------------  
    Sub CanIDoStuff
    /if (${Debug}) /echo ...debug CanIDoStuff enter
    /if (${Me.Buff[Resurrection Sickness].ID}) /varset IAmDead 0
    :IAmBusy
        /doevents
        /delay 2
        /call EndMacroIf
        /if (${Me.Moving} || ${Me.State.Equal[feign]} || ${ChaseAssist}==0 && 

${AggroTargetID}==0 && ${Me.Invis} && ${Me.Class.Name.NotEqual[Rogue]} || ${Me.Stunned} || 

${Me.Ducking} || ${Me.State.Equal[BIND]}) /goto :IAmBusy
        /if (${Window[MerchantWnd]} || ${Window[GiveWnd]} || ${Window[SpellBookWnd]} || 

${Window[BigBankWnd]} || ${Window[BankWnd]} || ${Window[GuildBankWnd]}  || ${Window

[TributeMasterWnd]} || ${Window[GuildTributeMasterWnd]}) /goto :IAmBusy
    /if (${Debug}) /echo ...debug CanIDoStuff leave
    /return  
| -------------------------------------------------------------------------------------
| SUB: Mercs Do What
| -------------------------------------------------------------------------------------  
    Sub MercsDoWhat
        /if (!${MercOn}) /return
        /if (${Debug}) /echo MercsDoWhat enter
        /if (${Me.Mercenary.Equal[Active]}) /varset MercInGroup 1
        | Revive the merc if dead and previously detected in group
        /if (${MercInGroup} && ${Window[MMGW_ManageWnd].Child[MMGW_SuspendButton].Enabled} 

&& ${Me.Mercenary.Equal[UNKNOWN]}) /notify MMGW_ManageWnd MMGW_SuspendButton LeftMouseUp
        /if (${MercAssistAt}>=${Spawn[${MyTargetID}].PctHPs} && ${Me.Mercenary.Equal

[Active]} && ${CombatStart} && !${MercAssisting}) { 
            /mercassist
            /if (${DebugCombat}) /echo MERC ${Spawn[${MyTargetID}].CleanName} %:${Spawn

[${MyTargetID}].PctHPs} ID:${Spawn[${MyTargetID}].ID} 
            /varset MercAssisting 1
        }
        /if (${Debug}) /echo MercsDoWhat leave
    /return
| -------------------------------------------------------------------------------------
| Check and set roles
| -------------------------------------------------------------------------------------     
    Sub CheckRoles
        /if (${Debug}) /echo ...debug CheckRoles enter 
        /if (${Role.Equal[tank]}) { 
            /if (${Debug}) /echo ...debug Looks like I am Main Tank. Wish me luck.
            /if (!${Defined[MainAssist]}) /varset MainAssist ${Me}
            /squelch /melee aggro=1
            /varset AssistAt 100
            /varset StickHow front 15
        }
        /if (${Role.Equal[puller]}) { 
            /if (${DebugPull}) /echo ... debug_pull role puller
            /if (${DebugPull}) /echo ... debug_pull Looks like I am Puller.
            /squelch /melee aggro=0
            /varset ReturnToCamp 1
            /varset ChaseAssist 0
            /varset CampRadiusExceed ${MaxRadius}
            /if (${Pet.ID}) /pet guard
        }
        /if (${Role.Equal[pullertank]}) { 
            /if (${DebugPull}) /echo ... debug_pull role pullertank
            /if (${DebugPull}) /echo ... debug_pull Looks like I am Puller and Tank.
            /varset MainAssist ${Me}
            /squelch /melee aggro=1
            /varset AssistAt 100
            /varset StickHow front 12
            /varset ReturnToCamp 1
            /varset ChaseAssist 0
            /varset CampRadiusExceed ${MaxRadius}
            /if (${Pet.ID}) /pet guard
        }
        /if (${Select[${Role},hunter]}) { 
            /if (${DebugPull})  /echo ... debug_pull role hunter
            /if (${DebugPull})  /echo ... debug_pull Looks like I am Hunting.
            /varset MainAssist ${Me}
            /squelch /melee aggro=1
            /varset AssistAt 100
            /varset StickHow front 12
            /varset CampRadiusExceed ${MaxRadius}
            /varset ReturnToCamp 0
            /varset MobsTooClose 15
            /if (${Pet.ID}) /pet follow
        }
        /if (${Select[${Role},petassist]}) { 
            /if (${DebugPull}) /echo ... debug_pull role petassist
            /if (${DebugPull}) /echo ... debug_pull Looks like I am assisting a pet.
            /squelch /melee aggro=0
            /varset MeleeOn 0
        }
        /if (${Select[${Role},pettank]}) { 
            /if (${DebugPull}) /echo ... debug_pull role petassist
            /if (${DebugPull}) /echo ... debug_pull Looks like I am assisting a pet.
            /squelch /melee aggro=0
            /varset MeleeOn 0
        }
        /if (${Debug}) /echo ...debug CheckRoles leave
    /return
| -------------------------------------------------------------------------------------
| SUB: PullRange
| -------------------------------------------------------------------------------------
   Sub PullRange
       /if (${DebugPull}) /echo ... debug_pull PullRange enter
       /declare PullItemRange int local
        /if (${Select[${FindItem[=${PullWith.Arg[1,|]}].Type},Archery,Throwing,Throwingv2]} 

&& ${FindItemCount[=${PullWith.Arg[1,|]}]} && ${Redguides}) {
            /varset PullItem ${PullWith.Arg[1,|]}
            /varset PullItemRange ${FindItem[=${PullWith.Arg[1,|]}].Range}
            /if (!${Defined[PullItemRange]}) /varset PullItemRange 50
            /if (${FindItem[=${PullWith.Arg[2,|]}].WornSlot[ammo]} && ${FindItemCount[=

${PullWith.Arg[2,|]}]}) {
                /varset PullAmmo ${PullWith.Arg[2,|]}
                /if (${FindItem[=${PullWith.Arg[1,|]}].Type.Equal[Archery]}) {
                    /varcalc PullItemRange ${PullItemRange}+${FindItem[=${PullWith.Arg

[2,|]}].Range}
                } 
                /call PullVars ${Math.Calc[${PullItemRange}*.9]} Ranged ${PullItemRange}
            } else {
                /echo I can't find any ammo defaulting to Melee for PullWith
                /varset PullWith Melee
                /call PullVars 15 Melee 15
                /return
            }
        } 
        /if (${Me.CombatAbility[${PullWith}]} || ${Me.Book[${PullWith}]} || 

${Me.AltAbility[${PullWith}]})  {
            /if (${Select[${Role},puller,pullertank]})  /call PullVars ${Math.Calc[${Spell

[${Spell[${PullWith}].ID}].Range}/1.25]} "${PullWith}" ${Spell[${Spell

["${PullWith}"].ID}].Range}
            /if (${Select[${Role},hunter]})  {
                /call PullVars ${Math.Calc[${Spell[${Spell[${PullWith}].ID}].Range}/2.75]} 

"${PullWith}" ${Spell[${Spell["${PullWith}"].ID}].Range}
            }
        }
        /if (${PullWith.Equal[Melee]})  /call PullVars 15 Melee 15
        /if (${DebugPull}) /echo ... debug_pull PullRange leave
    /return
| -------------------------------------------------------------------------------------
| SUB: PullVars
| -------------------------------------------------------------------------------------
    Sub PullVars(int pRange, pType, int pRange2)
        /if (${DebugPull}) /echo ... debug_pull PullVars enter
        /varset PullRange ${pRange}
        /varset PullWith ${pType} 
        /varset PullRangeActual ${pRange2}
        /if (${DebugPull}) /echo ... debug_pull PullVars leave
    /return 
| -------------------------------------------------------------------------------------
| SUB: FindMobToPull
| -------------------------------------------------------------------------------------
    Sub FindMobToPull
    /if (${DMZ} || !${Select[${Role},puller,pullertank,hunter]} || ${Pulled} || 

${AggroTargetID}) /return
        /if (!${Select[${Role},puller,pullertank,hunter]} || ${Me.Buff[Resurrection 

Sickness].ID} || ${Me.Buff[Revival Sickness].ID} || ${IAmDead}) /return
        /if (${DebugPull}) /echo ... debug_pull FindMobToPull enter
        /if (!${PullRange}) /call PullRange
        /doevents
        /declare i int local
        /declare k int local
        /declare PullCount int local
        /declare PullingTimer timer local 10s
        /varset Pulling 0
        /call CheckForAdds FindMobToPull
        /call GroupWatch
        /echo Looking for Close Range Mobs
		| Clear alert list 1, add mobs to ignore alert list1, set timer to keep 

alert list managable for pulling no alert 1
		/if (!${PullAlertTimer}) {
			/call AlertClear 1
			| Add Ignore Mob list to alert list
			/for k 1 to 10
				/if (${DebugPull}) /echo ... debug_pull FindMobToPull: 

${MobsToIgnore.Arg[${k},,]}
				/if (${MobsToIgnore.Arg[${k},,].Length}) /squelch /alert 

add 1 "${MobsToIgnore.Arg[${k},,]}"
			/next k
			/varset PullAlertTimer 5m
		}
        :FindMob
        /if (${Navigation.MeshLoaded} || ${Select[${Role},hunter]}) {
            /varset PullCount ${SpawnCount[npc radius ${MaxRadius} zradius ${MaxZRange} 

targetable noalert 1]}
        } else {
            /varset PullCount ${SpawnCount[npc los radius ${MaxRadius} zradius ${MaxZRange} 

targetable noalert 1]}
        }
        /for i 0 to ${PullCount}
            /doevents
            /if (${Navigation.MeshLoaded} || ${Select[${Role},hunter]}) {
                /squelch /target id ${NearestSpawn[${i}, npc radius ${MaxRadius} zradius 

${MaxZRange} targetable noalert 1].ID}
            } else {
                /squelch /target id ${NearestSpawn[${i}, npc los radius ${MaxRadius} 

zradius ${MaxZRange} targetable noalert 1].ID}
            }
            /if (${Target.ID}) {
                /varset Pulling 1
                /call ValidateTarget
                /if (${DebugPull}) /echo ... debug_pull FindMobToPull Target: 

${Target.CleanName} Valid: ${ValidTarget} MacReturn ${Macro.Return}
                /if (${ValidTarget}==0) {
                    /squelch /alert add 1 id ${Target.ID}
                    /squelch /target clear
                    /varset Pulling 0
                    /goto :FindMob
                }
                /echo PULLING-> ${Target.CleanName} <- ID:${Target.ID} at ${Int

[${Target.Distance}]} feet.
                /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+t+]PULLING-> 

${Target.CleanName} <- ID:${Target.ID} at ${Int[${Target.Distance}]} feet.[+x+]
                /varset MyTargetID ${Target.ID}
                /varset MyTargetName ${Target.CleanName}
                /if (${Pulling} && ${MyTargetID}) /call Pull
                /return
            }
        /next i
        /if (!${Target.ID}) {
            /varcalc FailCounter ${FailCounter}+1
            | /echo No Valid Target in Range ${MaxRadius} - ${FailCounter} Time(s)
            /if (${FailCounter}>=${FailMax}) {
                /varset FailCounter 0
				/call AlertClear 1
                /if (${PullWait}) {
                    /echo Waiting ${PullWait} seconds for mobs to respawn.
                    /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+t+]

PULLING-> Waiting ${PullWait} seconds for mobs to respawn.[+x+]
                    /call PullDelay ${PullWait}
                }
                /return
            }
            /if (${PullingTimer}==0) /return
            /goto :FindMob
        }
        /if (${DebugPull}) /echo ... debug_pull FindMobToPull leave 
    /return 
| -------------------------------------------------------------------------------------
| SUB: PullDelay
| -------------------------------------------------------------------------------------   
    Sub PullDelay(int TimerAmount)
        /if (${Debug}) /echo PullDelay ${TimerAmount} enter
        /declare PDTimer timer local ${TimerAmount}s
        /varset Pulling 0
        :WaitForTimer
            /doevents
            /call CheckForAdds PullDelay
            /delay 2
            /if (${PDTimer}) /goto :WaitForTimer
        /if (${Debug}) /echo PullDelay leave  
    /return
| -------------------------------------------------------------------------------------
| SUB: Pull
| -------------------------------------------------------------------------------------
    Sub Pull
        /doevents
        /if (${DMZ} || !${Select[${Role},puller,pullertank,hunter]} || !${Pulling}) /return
        /if (${DebugPull}) /echo ... debug_pull Pull enter
        /declare PullTimer timer local 300
        /declare PullAttempts int local 0
        /declare PullDist float local ${PullRange}
        /declare tempAmmo string local ${InvSlot[ammo].Item.Name}
        /declare rangedSwitch int local 0
        /declare ammoSwitch int local 0
        /varset Pulled 0
        /varset PullTooFar 0
        /varset CantHit 0
        /declare AutoFireOff int local ${AutoFireOn}
        /if (${DebugPull}) /echo ... debug_pull PullDist: ${PullDist}
        | Set autofire setting off during pulls if not using ranged item to pull
        /if (${AutoFireOff}) /varset AutoFireOn 0
        /if (!${Me.Mount.ID} && ${Me.Sitting}) /stand
        /if (${LootOn}) /call LootStuff
        :PullAgain
            /if (${Target.ID}!=${MyTargetID}) /squelch /tar id ${MyTargetID}
            /delay 10 ${Target.ID}==${MyTargetID}
            /if (${AggroTargetID} && ${Math.Distance[${CampYLoc},${CampXLoc}]} < 

${CampRadius}) {
                /echo Looks like mobs in camp aborting pull.
                /call PullReset
                /call CheckForAdds Pull
                /return
            }
            /if (${PullWith.Equal[Ranged]}) {
                /if (${DebugPull}) /echo ... debug_pull PULL: Ranged
                | Cursor check sometimes summoned items get stuck on cursor.
                /if (${Cursor.ID}) /autoinventory
                /if (${OrigRanged.NotEqual[${PullItem}]} && ${OrigRanged.NotEqual[null]} ) 

{
                    /call CheckCasting
                    /exchange "${PullItem}" ranged
                    /varset rangedSwitch 1
                    /delay 5
                }
                /if (${tempAmmo.NotEqual[null]} && ${tempAmmo.NotEqual[${PullAmmo}]}) {
                    /call CheckCasting
                    /exchange "${PullAmmo}" ammo
                    /delay 5
                    /if (${tempAmmo.NotEqual[${PullAmmo}]}) /varset ammoSwitch 1
                }
            }
            | - Filter to prevent pulling until AA/Disc/Spell is ready.
            /if (${PullTimer} && !${AggroTargetID} && !${Select[${PullWith},Melee,Ranged]} 

&& !${Select[TRUE,${Me.SpellReady[${PullWith}]},${Me.AltAbilityReady[${PullWith}]},

${Me.CombatAbilityReady[${PullWith}]}]}) /goto :PullAgain
            /varset PullAttempts 0
            /if (${DebugPull}) /echo ... debug_pull START PULL
            | Set group role puller to adjust for merc running up while pulling if soloing
            /if (${Group}==1 && !${Group.Puller.Name.Equal[${Me}]} && ${Select

[${Role},puller]} && ${Spawn[${MainAssist}].Type.Equal[Mercenary]}) /call AssignGroupRole 

set "${Me.CleanName}" 3
            /if (${Target.Distance}>${PullDist} && ${Math.Distance[${Spawn

[${Target.ID}].Y},${Spawn[${Target.ID}].X}:${CampYLoc},${CampXLoc}]}<${MaxRadius}) {
            :WeThereYet
                /if (${Target.LineOfSight} || ${Select[${Role},hunter]}) {
				   /moveto id ${Target.ID} mdist ${PullDist} 
				   /delay 5
				} else /if (${Navigation.MeshLoaded}) {
					/if (!${Target.LineOfSight}) {
						/varset PullDist 50
					} else {
						/varset PullDist ${PullRange}
					}
					/nav ${Target.X} ${Target.Y} ${Target.Z}
					:DistanceCheck
						/delay 5
						/if (${PullTimer}==0) /goto :NavPullRelease
					/if (${Target.Distance}>${PullDist} && !

${Target.LineOfSight} && !${AggroTargetID}) /goto :DistanceCheck
					:NavPullRelease
					/if (${Navigation.Active}) /nav stop
				}
			}
			/doevents
			| Pull counter used to in conjunction with 1s delay for timing
			/varcalc PullAttempts ${PullAttempts}+1
			| If random aggro while pulling, stop and return to camp
			/if (${AggroTargetID}) {
				/varset Pulled 1
				/varset MyTargetID 0
				/varset MyTargetName
				/if (${Navigation.Active}) /nav stop
				/goto :DonePulling
			}
			| Exit pull and reset if timed out or wandered too far from camp
			/if (${PullTimer}==0 || ${Math.Distance[${CampYLoc},${CampXLoc}]} 

>= ${Math.Calc[${MaxRadius}*.94]} || ${PullAttempts}>=15 && !${Target.LineOfSight} && !

${Select[${Role},hunter]} || !${Spawn[${MyTargetID}].ID}) {
				/squelch /alert add 1 id ${Target.ID}
				/call PullReset
				/if (${DebugPull}) /echo :DonePulling-Exit pull and reset 

if timed out or wandered too 
				/goto :DonePulling
			}
			| Try and pull again after 7 seconds or 2 seconds if target is 

moving
			/if (${PullAttempts}>=7 || ${PullAttempts}>=2 && ${Target.Speed}

>25) {
				| Make range smaller to creep closer to mob if los or 

moving
				/varcalc PullDist ${PullDist}*.6
				/goto :PullAgain
			}
			| 1s timer used in conjunction with PullAttempts to control pulling
			/delay 10 
			/if (${DebugPull})  /echo ... debug_pull Attempt: ${PullAttempts}
			| Distance loop check until mob in range to pull
        /if (${Target.Distance}>${PullRange}) /goto :WeThereYet
        | If mob moves out of line of sight during pull try moveto mob again
        /if (!${Target.LineOfSight} && !${Select[${Role},hunter]} && ${PullTimer}) {
            /varcalc PullDist ${PullDist}*.8
            /goto :PullAgain
        }
        /if (${Target.ID} && ${Target.Distance}<${PullRange}) {
			/moveto off
			/if (${Navigation.Active}) /nav stop
			| Validate target one more time before pulling
				/call ValidateTarget
				/if (${ValidTarget}==0) {
					/squelch /alert add 1 id ${Target.ID}
					/squelch /target clear
					/echo Aborting Pull! Target invalid now! Reason:

${Macro.Return}
					/call PullReset
					/goto :DonePulling
				}
			| Handle pulling with Melee setting
			/if (${PullWith.Equal[Melee]}) {
				/if (${DebugPull}) /echo ... debug_pull PULL: Melee
				/if (!${Select[${Role},hunter]}) {
					| Turn off mq2melee function so pullertank doesn't 

attack mob on pull
					/if (${Select[${Role},pullertank]}) /squelch /melee 

melee=0
					:AttackAgain
						/face fast
						/attack on
						/delay 5
					/if (!${AggroTargetID} && ${Target.PctHPs}==100) 

/goto :AttackAgain
					| Turn off combat so puller returns to camp
					/if (${Select[${Role},puller,pullertank]}) {
						:StopCombat
							/attack off
							/stick off
							/squelch /target clear
						| Cycle until combat off and mob is aggro'd 

   
						/if (${Me.Combat} && (${AggroTargetID} || 

${Target.PctHPs}<100)) /goto :StopCombat
						| Turn on mq2melee function back on after 

pull
						/if (${Select[${Role},pullertank]}) 

/squelch /melee melee=1
					}
				}
				/varset Pulled 1
			} else /if (${PullWith.Equal[Ranged]}) {
				/if (${DebugPull}) /echo ... debug_pull PULL: Ranged
				:RangedAgain
					/doevents
					/if (${AggroTargetID}) /goto :GotAggro
					/if (${CantHit}) {
						/varset CantHit 0
						/varcalc PullDist ${PullDist}*.8
						/goto :PullAgain
					}
					/squelch /face nolook
					/if (${Target.ID}==${MyTargetID}) /range
					/delay 5
					/if (${DebugPull}) /echo ... debug_pull 

${PullTimer} && (!${AggroTargetID} || ${Target.PctHPs}==100))
				/if ((${PullTimer} && (!${AggroTargetID} || 

${Target.PctHPs}==100)) || !${PullTooFar}) /goto :RangedAgain
				:GotAggro
				/varset Pulled 1
			} else {
				/if (${DebugPull}) /echo ... debug_pull PULL: Cast
				/delay 1s ${MoveTo.Stopped} || !${Navigation.Active}
				/face fast
				/if (${AggroTargetID}) /goto :PullAgain
				/call CastWhat "${PullWith}" ${Target.ID}
				/if (${Macro.Return.Equal[CAST_CANNOTSEE]}) {
					/varcalc PullDist ${PullDist}*.8
					/goto :PullAgain
				}
				/if (${Macro.Return.Equal[CAST_SUCCESS]}) /varset Pulled 1
				/delay 1s ${AggroTargetID}
			}
		}
        | If pull failed start over while timer > 0
        /if (!${Pulled}) /goto :PullAgain
        :DonePulling
        /if (${rangedSwitch}) {
            /call CheckCasting
            /exchange "${OrigRanged}" ranged
            /varset rangedSwitch 0
            /delay 5
        }
        /if (${ammoSwitch}) {
            /call CheckCasting
            /exchange "${tempAmmo}" ammo
            /varset ammoSwitch 0
            /delay 5
        }
        /varset Pulling 0
        | Turn autofire back on
        /if (${AutoFireOff}) {
            /if (${DebugPull}) /echo ... debug_pull AutoFire on
            /varset AutoFireOff 0
            /varset AutoFireOn 1
        }
		/if (${Select[${Role},hunter]} && ${MyTargetID}) {
			/call Combat
			/call CombatReset
			/if (${DebugPull}) /echo debug_pull Leaving hunter comabt
		}
        /if (${DebugPull}) /echo ... debug_pull Done Pulling
        /if (${ReturnToCamp}) {
            /call WaitForMob
            /varset Pulled 0
        }
        /if (${DebugPull}) /echo ... debug_pull Pull leave ${Spawn[${MyTargetID}].ID}
    /return 
| -------------------------------------------------------------------------------------
| SUB: Wait for Mob
| -------------------------------------------------------------------------------------
    Sub WaitForMob
        /if (${DebugPull}) /echo ... debug_pull Sub WaitForMob enter
        /if (${Select[${Role},hunter]}) /return
        /declare WaitTimer timer local 30s
        /if (${Pulled}) {
            /if (${DebugPull}) /echo ... debug_pull Wait For Mob
            /call DoWeMove
            /declare FaceTimer timer local 0
            /if (${InvSlot[ranged].Item.Name.NotEqual[${OrigRanged}]} && 

${OrigRanged.NotEqual[null]}) {
                /call CheckCasting
                /exchange "${OrigRanged}" ranged
            }
            :WaitForMob 
                /if (${Target.ID} && ${FaceTimer}==0 ) /face fast nolook
                /doevents
                /call MobRadar ${CampRadius}
                /if (${MobCount}>=2 || ${MobCount}==1 && ${AddsArray[1,1]}!=${MyTargetID}) 

{
                    /varset MyTargetID 0
                    /varset MyTargetName
                    /call CheckForAdds WaitForMob
                }
                | if target lost somehow add to ignore list and continue pulls
                /if (!${AggroTargetID} || ${WaitTimer}==0) {
                    /if (${DebugPull}) /echo ... debug_pull Sub WaitForMob /return no 

AggroTargetID
                    /alert add 1 id ${Target.ID}
                    /call PullReset
                    /return
                }
                /varset FaceTimer 1s
            | /if (${Math.Distance[${Target.Y},${Target.X}:${CampYLoc},${CampXLoc}]}>=

${CampRadius})  /goto :WaitForMob
            /if (${Spawn[${MyTargetID}].Distance}>=${CampRadius})  /goto :WaitForMob
        }
        /if (${Group}==1 && ${Select[${Role},puller]} && ${Group.Puller.Name.Equal[${Me}]} 

&& ${Spawn[${MainAssist}].Type.Equal[Mercenary]} && ${Spawn[${MyTargetID}].Distance}<=

${MeleeDistance}) /call AssignGroupRole unset "${Me.CleanName}" 3
        /if (${DebugPull}) /echo ... debug_pull Sub WaitForMob leave    
        /if (${MyTargetID} && !${AggroTargetID}) /call PullReset
     /return
| -------------------------------------------------------------------------------------
| SUB: Reset Pull variables
| -------------------------------------------------------------------------------------
    Sub PullReset
        /if (${DebugPull}) /echo ... debug_pull PullReset enter
        /doevents
        /varset Pulling 0
        /varset Pulled 0
        /varset MyTargetID 0
        /varset MyTargetName 
        /attack off
        /moveto off
        /if (${Navigation.Active}) /nav stop
        /squelch /target clear
        /if (${DebugPull}) /echo ... debug_pull PullReset leave
    /return
| -------------------------------------------------------------------------------------
| SUB: GroupWatch
| -------------------------------------------------------------------------------------
    Sub GroupWatch
    /if (!${GroupWatchOn} || ${AggroTargetID}) /return
        /if (${Debug}) /echo ...debug GroupWatch enter
        /declare i int local
        /declare GrpMemType string local
        /declare GrpMemName string local
        /declare GrpMemClass string local
        /declare GrpMemStat string local        
        /if (!${Spawn[${MainAssist} ${MainAssistType}].ID} && !${Select

[${Role},tank,pullertank,hunter]}) {
            /echo I am not detecting Main Assist pausing.
            :WaitForMA
				/doevents
				/call CheckForAdds GroupWatch
				/call WaitSubs
				/if (${Spawn[${MainAssist} ${MainAssistType}].ID}) {
					/echo Main Assist is back resuming action.
					/return
				}
				/delay 5
            /goto :WaitForMA
        }
        /for i 1 to 5
            /if (!${Group.Member[${i}].ID} || ${Group.Member[${i}].Type.Equal[corpse]} ) 

/goto :SkipCheck
            /if (${GroupWatchOn}==2 && !${Select[${Group.Member

[${i}].Class.ShortName},CLR,DRU,SHM]}) /goto :SkipCheck         
            /varset GrpMemType ${Group.Member[${i}].Type} 
            /varset GrpMemName ${Group.Member[${i}].CleanName} 
            /varset GrpMemClass ${Group.Member[${i}].Class.ShortName} 
            /if (${Select[${GrpMemClass},BER,MNK,ROG,WAR]}) {
                /varset GrpMemStat Endurance 
            } else {
                /varset GrpMemStat Mana 
            }
             /if (${Debug}) /echo ...debug ${i} /call CheckStats 1 "${GrpMemName}" 

"${GrpMemClass}" "${GrpMemType}" ${GrpMemStat} 20 90            
            /call CheckStats 1 "${GrpMemName}" ${GrpMemClass} ${GrpMemType} ${GrpMemStat} 

20 90
            /if (${Select[${GrpMemClass},BST,PAL,RNG,SHD]}) /call CheckStats 1 

"${GrpMemName}" "${GrpMemClass}" "${GrpMemType}" Endurance 20 90
            :SkipCheck
        /next i
        /if (${Debug}) /echo ...debug GroupWatch leave
    /return
| -------------------------------------------------------------------------------------
| SUB: CheckStats
| -------------------------------------------------------------------------------------
    Sub CheckStats(int statcheck, charname, ckclass, cktype, stat, int pause,int resume)
        /if (!${statcheck} || !${Spawn[${ckclass} ${cktype} ${charname}].ID} || ${Spawn

[${ckclass} ${cktype} ${charname}].Current${stat}}>${pause}) /return 
        /if (${DebugPull}) /echo ... debug_pull CheckStats enter
        /if (${DebugPull}) /echo ... debug_pull statcheck ${statcheck} charname ${charname} 

ckclass ${ckclass} stat ${stat} pause ${pause} resume ${resume}
        /echo Waiting for ${charname} to med up to ${resume}% ${stat}.
        /if (${EQBC.Connected} && ${EQBCOn} && ${Select[${Role},puller,pullertank,hunter]}) 

/docommand  /${EQBCSay} [+t+]Waiting for >> ${charname} << to med up to ${resume}% 

${stat}.[+x+]
        /varset Pulling 0
        /if (${IAmABard} && ${TwistMed} && ${TwistOn}) /twist ${TwistMed}
        /varset Medding 1
        :wait_for_resume
            /doevents
            /if (${ReturnToCamp} && ${Math.Distance[${CampYLoc},${CampXLoc}]} > 10 ) {
                /if (!${Me.Mount.ID} && ${Me.Sitting}) /stand
                /call DoWeMove 
                /delay 100 ${MoveTo.Stopped}
            }
            /delay 5
            /call CheckCasting
            /delay 5
			/call CheckForAdds CheckStats
            /call WaitSubs
        /if (${Spawn[${ckclass} ${cktype} ${charname}].Current${stat}}<${resume}) /goto 

:wait_for_resume
        /echo ${charname} is now above ${resume}% ${stat} resuming activity.
        /if (${EQBC.Connected} && ${EQBCOn} && ${Select[${Role},puller,pullertank,hunter]}) 

/docommand  /${EQBCSay} [+t+]${charname} is now above ${resume}% ${stat} resuming 

activity.[+x+]
        /if (!${Me.Mount.ID} && ${Me.Sitting}) /stand
        /varset Medding 0
        /if (${DebugPull}) /echo ... debug_pull CheckStats leave
    /return  
| -------------------------------------------------------------------------------------
| SUB: alert clear
| -------------------------------------------------------------------------------------
    Sub AlertClear(int ListToClear)
        /if (${DebugPull}) {
			/echo ... debug_pull enter AlertClear 
			/echo ... debug_pull Clearing Alert list ${AlertList}.
		}
        /squelch /alert clear ${ListToClear}
		/delay 5
        /if (${DebugPull}) /echo ... debug_pull leave AlertClear 
    /return
| -------------------------------------------------------------------------------------
| SUB: Assign Group Role
| -------------------------------------------------------------------------------------
    Sub AssignGroupRole(ASGOnOff, AGRName, AGRRole)
        /echo ${ASGOnOff} ${AGRName} ${AGRRole}
        /docommand /grouproles ${ASGOnOff} ${AGRName} ${AGRRole}
        /delay 5
    /return
| -------------------------------------------------------------------------------------
| SUB: Event CantSee CantHit
| -------------------------------------------------------------------------------------
    Sub Event_CantSee
        /if (${Debug}) /echo Event_CantSee
        | Reset position via stick
        /if (${Attacking}) {
            /if (${Debug}) /echo Can't See my target. Moving Closer.
            /if (${Me.Sitting}) /stand
            /squelch /face fast
            /if (${StickHow.NotEqual[0]}) {
                /stick 10 ${StickHow} id ${MyTargetID}
            } else /stick 10 pin id ${MyTargetID}
        }
        /if (${Debug}) /echo leave Event_CantSee
    /return 
| -------------------------------------------------------------------------------------
| SUB: Event CantHit
| -------------------------------------------------------------------------------------
    Sub Event_CantHit
        /if (${Debug}) /echo Event_CantHit
        | Reset position via stick
        /if (${Pulling}) {
            /varset CantHit 1
        }
        /if (${Debug}) /echo leave Event_CantHit
    /return 
| ----------------------------------------------------------------------------
| SUB: Event Switch
| ----------------------------------------------------------------------------
    Sub Event_Switch 
        /echo New target called!
        /call CombatReset
        /call Assist
        /call Combat
    /return 
| ----------------------------------------------------------------------------
| SUB: Event GotHit
| ----------------------------------------------------------------------------
    Sub Event_GotHit
        /if (${AggroTargetID} && !${Target.ID} && !${ReturnToCamp}) { 
            /call CheckForAdds Event_GotHit
        } 
        /if (${Pulled} && ${Select[${Role},pullertank]} && ${NearestSpawn[npc los radius 

${CampRadius} targetable].ID}!=${MyTargetID}) {
            /varset MyTargetID 0
            /varset MyTargetName 
        }
    /return 
| ----------------------------------------------------------------------------
| SUB: Event Zoned
| ----------------------------------------------------------------------------
    Sub Event_Zoned(Message)
        /if (${Message.Find[Drunken Monkey]} || ${Message.Find[effects]}) /return
        /if (${!JustZoned}) /echo Just zoned
        /delay 60s ${Me.ID}
        /varset JustZoned 200
        /if (${ReturnToCamp} && ${CampZone}!=${Zone.ID}) /varset RememberCamp 1
        /varset LastZone ${Zone.ID} 
        | Shut down combat and mez in GH, GL, PoK, PoT, and Abysmal
        /if (${Select[${Zone.ID},345,344,202,203,279]}) {
            /varset DMZ 1
        } else /varset DMZ 0
        /if (${ReturnToCamp} && ${CampZone}!=${Zone.ID}) /varset ReturnToCamp 0
        /if (${RememberCamp} && ${CampZone}==${Zone.ID} && ${Math.Distance[${CampYLoc},

${CampXLoc}]}<=100) {
            /varset ReturnToCamp 1
            /varset RememberCamp 0
        }
        /call CombatReset zoned
    /return
| ----------------------------------------------------------------------------
| SUB: Event Joined 20s switch to prevent heals from firing off
| ----------------------------------------------------------------------------
    Sub Event_Joined(string Jmessage,string Joinee)
         /echo ${Joinee} has joined the party.
         /varset JoinedParty 200
     /return
| ----------------------------------------------------------------------------
| SUB: Event Too Close
| ----------------------------------------------------------------------------    
    Sub Event_TooClose
        /if (${MyTargetID} && ${AutoFireOn} && ${CombatStart}) {
            /varset AutoFireOn 0
            /killthis
            /timed 300 /varset AutoFireOn 1
        }
    /return
| ----------------------------------------------------------------------------
| SUB: Event Camping - end macro
| ----------------------------------------------------------------------------  
    Sub Event_Camping
        /end
    /return   
| ----------------------------------------------------------------------------
| SUB: Event Too Far 
| ----------------------------------------------------------------------------     
    Sub Event_TooFar
        /if (${Target.Distance}<${CampRadius} && ${MeleeOn} && ${CombatStart}) /squelch 

/stick 8 ${StickHow} id ${MyTargetID}
        /call ZCheck ${ZDist} 4.1
        /if (${Select[${Role},pullertank,puller]} && ${Pulling}) {
            /varset PullTooFar 1
        }
    /return
| ----------------------------------------------------------------------------
| SUB: Event Change Var Int resets various interger settings from ini file
| ----------------------------------------------------------------------------
    Sub Event_ChangeVarInt(string Line, string ISection, string IName, int IVar) 
        /if (${Debug}) Event_ChangeVarInt ${ISection} ${IName} ${IVar}
        /if (${IVar}) {
            /echo Changing ${IName} to ${IVar}
            /varset ${IName} ${IVar}
            /ini "${IniFileName}" "${ISection}" "${IName}" "${IVar}"
        }
    /return
| ----------------------------------------------------------------------------
| SUB: Event Task Update - EQBC message 
| ----------------------------------------------------------------------------   
    Sub Event_TaskUpdate(Line,name) 
        /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+t+]Task updated...

(${name})[+x+]    
    /return
| ----------------------------------------------------------------------------
| SUB: Event Gain Something - EQBC message 
| ----------------------------------------------------------------------------   
    Sub Event_GainSomething(string Line,string text)
        /if (!${EQBC.Connected} || !${EQBCOn}) /return
        /if (${Line.Find["ABILITY POINT!"]}) {
            /docommand  /${EQBCSay} [+w+]${Me.Name} gained an AA, now has ${Me.AAPoints} 

unspent[+x+]
        } else /if (${Line.Find[LEVEL]}) {
            /docommand  /${EQBCSay} [+w+]${Me.Name} gained a level, now is Level 

${Me.Level}[+x+]
        } else /if (${Line.Find[GROUP LEADERSHIP]}) {
            /docommand  /${EQBCSay} [+w+]${Me.Name} gained group leadership, now has 

${Me.GroupLeaderPoints} unspent[+x+]
        }
    /return 
| ----------------------------------------------------------------------------
| SUB: Event Kiss Edit - Edit ini file in MQ2NotePad 
| ----------------------------------------------------------------------------   
    Sub Event_KissE
        /if (!${Bool[${Plugin[MQ2Notepad]}]}) {
            /echo This function requires MQ2Notepad to be loaded..
            /echo 1. Please copy MQUI_NotepadWindow.xml to your Everquest/UIFiles/default 

or custom ui folder
            /echo 2. then /Plugin MQ2notepad
        }
        /if (${Bool[${Plugin[MQ2Notepad]}]}) {
            /docommand /notepad kissassist_${Me}.ini
        }
    /return
| ----------------------------------------------------------------------------
| SUB: Event ImDead
| ----------------------------------------------------------------------------
 Sub Event_ImDead
     /echo I have died. And the Angels wept. 
     /varset IAmDead 1
     /timed 7000 /varset IAmDead 0
/return
| ----------------------------------------------------------------------------
| SUB: Event GoM On
| ----------------------------------------------------------------------------
    Sub Event_GoMOn
        /varset GoMActive 1
        /call GoMCastSpell
    /return
| ----------------------------------------------------------------------------
| SUB: Event GoM Off
| ----------------------------------------------------------------------------
    Sub Event_GoMOff
        /varset GoMActive 0
    /return    
| ----------------------------------------------------------------------------
| SUB: Event GUEQBC - Echo guild meassages in EQBC
| ----------------------------------------------------------------------------   
    Sub Event_GUEQBC(Message,GUName,GUText)
        /if (${GUName.Equal[${Me.CleanName}]}) /return
        /if (${EQBC.Connected} && ${Select[${EQBCOn},2,4]}) /docommand  /${EQBCSay} [+m+] 

${GUName} tells Guild: ${GUText} [+x+]
    /return    
| ----------------------------------------------------------------------------
| SUB: Event GUEQBC - Echo fellowship meassages in EQBC
| ----------------------------------------------------------------------------   
    Sub Event_FSEQBC(Message,FSName,FSText)
        /if (${FSName.Equal[${Me.CleanName}]}) /return
        /if (${EQBC.Connected} && ${Select[${EQBCOn},3,4]}) /docommand  /${EQBCSay} [+p+] 

${FSName} tells Fellowship: ${FSText} [+x+]
    /return      
| ----------------------------------------------------------------------------
| SUB: AFK Tools from AHTools by Anonymous Hero
| ----------------------------------------------------------------------------   
    Sub AFKTools
    /declare holding bool local
    /if (${CampZone}!=${Zone.ID}) /return  
    /if (${AFKToolsOn}) {
        :CZLockDown
            /if (${Posse.Strangers}>=1) {
                /if (!${holding}) {
                    /echo [AHTools] Macro on hold due to player activity in camp radius.
                     /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+r+]

**PCS DETECTED IN CAMP RADIUS**[+x+]
                    /multiline ; /beep ; /timed 1 /beep ; /timed 1 /beep ; /timed 5 /beep ; 

/timed 5 /beep ; /timed 5 /beep ; /timed 5 /beep ; /timed 1 /beep ; /timed 1 /beep 
                    /varset holding 1
                }
                /delay 1s
                /call CheckForAdds AFKTools
                /doevents
        /goto :CZLockDown 
        } else { /varset holding 0 }
    }
    :GMLockDown
    /if (${SpawnCount[GM]}>=1) {
        /if (${AFKGMAction}==1) {
            /if (!${holding}) {
                /echo [AHTools] Macro on hold due to GM Presence 
                /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+r+]** GM 

DETECTED **[+x+]
                /multiline ; /beep ; /timed 1 /beep ; /timed 1 /beep ; /timed 5 /beep ; 

/timed 5 /beep ; /timed 5 /beep ; /timed 5 /beep ; /timed 1 /beep ; /timed 1 /beep 
                /varset holding 1
            }
            /goto :GMLockDown
        } else {
            /varset holding 0
        }
        /if (${AFKGMAction}==2) /multiline ; /echo [AHTools] Ending Macro due to GM 

Presence ; /mq2log [AHTools] Ending Macro due to GM Presence ; /endmacro
        /if (${AFKGMAction}==3) /multiline ; /echo [AHTools] Unloading MQ2 due to GM 

Presence; /mq2log [AHTools] Unloading MQ2 due to GM Presence ; /unload
        /if (${AFKGMAction}==4) /multiline ; /echo [AHTools] Quitting out of EQ due to GM 

Presence ; /mq2log [AHTools] Quitting out of EQ due to GM Presence ; /quit
    }
/return
| ----------------------------------------------------------------------------
| SUB: Burn Section
| ----------------------------------------------------------------------------  
    Sub Event_Burn
        /declare i int local
        /declare BurnSpell string local
        /declare BurnTarget string local
        /declare BurnTargetID int local
        /echo BURN ACTIVATED => Autobots Transform <=
        /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+r+]BURN ACTIVATED => 

Autobots Transform <=[+x+]
        /for i 1 to ${Burn.Size}
            /if (${Burn[${i}].Arg[2,|].Length}) {
                /varset BurnSpell ${Burn[${i}].Arg[1,|]}
                /varset BurnTarget ${Burn[${i}].Arg[2,|]}
            } else {
                /varset BurnSpell ${Burn[${i}]}
            }
            /if (${BurnSpell.Equal[null]}) /goto :SkipBurnEntry
                /if (${BurnTarget.Equal[null]} || ${BurnTarget.Equal[Mob]}) /varset 

BurnTargetID ${MyTargetID}
                /if (${BurnTarget.Equal[Me]}) /varset BurnTargetID ${Me.ID}
                /if (${BurnTarget.Equal[MA]}) /varset BurnTargetID ${Spawn[${MainAssist} 

${MainAssistType}].ID}
                /if (${BurnTarget.Equal[Pet]}) /varset BurnTargetID ${Me.Pet.ID}
                | /delay 30 ${Cast.Ready[${BurnSpell}]} 
                /call CastWhat "${BurnSpell}" ${BurnTargetID}
            :SkipBurnEntry
        /next i
        /doevents flush Event_Burn
    /return
| ----------------------------------------------------------------------------
| SUB: Campfire Section -  Code from toomanynames, wizbomb
| ----------------------------------------------------------------------------
     Sub Event_Campfire
        /windowstate FellowshipWnd open
        /delay 5
        /nomodkey /notify FellowshipWnd FP_Subwindows tabselect 2
        /delay 1s
        /nomodkey /notify FellowshipWnd FP_RefreshList leftmouseup
        /delay 1s
        /nomodkey /notify FellowshipWnd FP_CampsiteKitList listselect 1
        /delay 1s
        /nomodkey /notify FellowshipWnd FP_CampsiteKitList leftmouse 1
        /delay 1s
        /nomodkey /notify FellowshipWnd FP_CreateCampsite leftmouseup
        /delay 1s
        /windowstate FellowshipWnd close
    /return
| ----------------------------------------------------------------------------
| SUB: Sort Array
| ----------------------------------------------------------------------------        
    Sub SortArray(ArrayName, HiLo, SortHow)
        /declare i                  int     local
        /declare j                  int     local
        /declare k                  int     local
        /declare l                  int     local
        /declare TempHighest        string  local ${HiLo} 
        /declare TempHighPos        int     local 0
        /declare NewArrayPos        int     local 0
        /declare NewArraySize       int     local 0    
        /declare TempArray[${${ArrayName}.Size}] string     local 0
        | Assign Array to temp array
        /for i 1 to ${${ArrayName}.Size}
            /if (${Debug}) /echo ${i} ${${ArrayName}[${i}]} 
            /varset TempArray[${i}] ${${ArrayName}[${i}]}
        /next i
        | Sort Temp Array
        /for k 1 to ${${ArrayName}.Size} 
            /for j 1 to ${${ArrayName}.Size}
                /if (${TempArray[${j}].Arg[2,|]}!=0 && ${TempArray[${j}].Arg[2,|]} 

${SortHow} ${TempHighest.Arg[2,|]}) {
                    /varset TempHighest ${TempArray[${j}]}
                    /varset TempHighPos    ${j}
                }
            /next j
            :NextTempArray
            | Rebuild original array with new sorted order
            /varcalc NewArrayPos ${NewArrayPos}+1
            /if (${TempHighest.Length} && ${TempHighest.NotEqual[${HiLo}]}) {
                /varset ${ArrayName}[${NewArrayPos}] ${TempHighest}
                /varset TempArray[${TempHighPos}]
                /varcalc NewArraySize ${NewArraySize}+1
            } else {
                /varset ${ArrayName}[${NewArrayPos}] 
            }
            | Reset vars 
            /varset TempHighest ${HiLo}
            /varset    TempHighPos ${k}
            /if (${Debug}) /echo  ${NewArrayPos} ${${ArrayName}[${k}]} 
        /next k
    /return
| ----------------------------------------------------------------------------
| SUB: Sort Array
| ----------------------------------------------------------------------------        
    Sub SortArray2(ArrayName, HiLo, SortHow)
        /declare i                  int     local
        /declare j                  int     local
        /declare k                  int     local
        /declare l                  int     local
        /declare TempHighest        string  local ${HiLo} 
        /declare TempHighPos        int     local 0
        /declare NewArrayPos        int     local 0
        /declare NewArraySize       int     local 0    
        /declare TempArray[${${ArrayName}.Size}] string     local 0
        | Assign Array to temp array
        /for i 1 to ${${ArrayName}.Size}
            /if (${Debug}) /echo ${i} ${${ArrayName}[${i}]} 
            /varset TempArray[${i}] ${${ArrayName}[${i}]}
        /next i
        | Sort Temp Array
        /for k 1 to ${${ArrayName}.Size} 
                /if (${TempArray[${k}].NotEqual[null]}) {
                    /varset TempHighest ${TempArray[${k}]}
                    /varset TempHighPos ${k}
                }
            :NextTempArray
            | Rebuild original array with new sorted order
            /varcalc NewArrayPos ${NewArrayPos}+1
            /if (${TempHighest.Length} && ${TempHighest.NotEqual[${HiLo}]}) {
                /varset ${ArrayName}[${NewArrayPos}] ${TempHighest}
                /varset TempArray[${TempHighPos}]
                /varcalc NewArraySize ${NewArraySize}+1
            } else {
                /varset ${ArrayName}[${NewArrayPos}] 
            }
            | Reset vars 
            /varset TempHighest ${HiLo}
            /varset TempHighPos ${k}
            /if (${Debug}) /echo  ${NewArrayPos} ${${ArrayName}[${k}]} 
        /next k
    /return
| ----------------------------------------------------------------------------
| SUB: ZCheck /call ZCheck current ,Z to check, difference
| ----------------------------------------------------------------------------
    Sub ZCheck(float Zcur, float Zdiff)
        | Move down if Z distance more than Zcheck due to levitation
        /if (${Zcur}>=${Zdiff}) {
            /keypress end hold
            /delay 10
            /keypress end
        }
    /return
| ----------------------------------------------------------------------------
| SUB: Event_WornOff - secondary check to rebuff
| ----------------------------------------------------------------------------
    Sub Event_WornOff(string Line, string wospell, string wotarget)
        /if (!${RebuffOn} || ${wotarget.Equal[${Me}]} || ${AggroTargetID} || 

${Me.Class.Name.Find[bard]} || ${IniNextTimer}) /return
        /echo ${wospell} ${wotarget}
        /declare i int local
        /declare j int local
        /declare MyBuff int local 1
        /for i 1 to ${Buffs.Size}
            /for j 1 to ${Group}
                /if (${Group.Member[${j}].CleanName.Equal[${wotarget}]} && ${Buffs

[${i}].Find[${wospell}]}) {
                    /varset Buff${i}GM${j} 0
                    /echo ${wotarget} needs ${wospell} because it wore off. 
                    /if (${Select[${Spell[${wospell}].TargetType},single,group]} && 

${Me.Buff[${wospell}].ID})  /nomodkey /notify BuffWindow buff${Math.Calc[${Me.Buff

[${wospell}].ID}-1].Int} leftmouseup
                }
            /next j
            | If MA out of group listen for buffs wearinig off
            /if (!${Spawn[${MainAssist} ${MainAssistType} group].ID} && ${Spawn

[${MainAssist} ${MainAssistType}].CleanName.Equal[${wotarget}]} && ${Buffs[${i}].Find

[${wospell}]}) {
                /varset Buff${i}GM7 0
                /echo {wotarget} needs ${wospell} because it wore off.
            }
        /next i
    /return
| ----------------------------------------------------------------------------
| SUB: Write Buffs
| ----------------------------------------------------------------------------
    Sub WriteBuffs
        /if (${WriteBuffsTimer} || !${Redguides}) /return
        /if (${Debug}) /echo ...debug WriteBuffs Enter
        /declare i int local 0
        /declare k int local 0
        /declare Blockedbuff string local
        /declare Blockedbufflist string local
        /declare BuffList string local
        /declare Writebufflist string local
        /call CleanBuffsFile
        | Write day of the month and hour. Entry will be deleted if more than a hour old
        /if (!${Ini["KissAssist_Buffs.ini",${SectionName},Day].Length}) /ini 

"KissAssist_Buffs.ini" "${Me.ID}" Day "${Time.Day}"
        /if (!${Ini["KissAssist_Buffs.ini",${SectionName},Hour].Length}) /ini 

"KissAssist_Buffs.ini" "${Me.ID}" Hour "${Time.Hour}"
        /if (!${Ini["KissAssist_Buffs.ini",${SectionName},Zone].Length}) /ini 

"KissAssist_Buffs.ini" "${Me.ID}" Zone "${Zone.ID}"
        /if (!${Ini["KissAssist_Buffs.ini",${SectionName},Buffs].Length}) /ini 

"KissAssist_Buffs.ini" "${Me.ID}" Buffs 
        /if (!${Ini["KissAssist_Buffs.ini",${SectionName},Blockedbuffs].Length}) /ini 

"KissAssist_Buffs.ini" "${Me.ID}" Blockedbuffs  
        | Write all current buffs to Kissassist_Buffs.ini file
        /for i 0 to 40 step 1
            /if (${Window[BuffWindow].Child[BW_Buff${i}_Button].Child[Buff

${i}].Tooltip.Find[(]}) {
                /varset BuffList ${Window[BuffWindow].Child[BW_Buff${i}_Button].Child[Buff

${i}].Tooltip.Arg[1,(].Left[-1]} 
            } else {
                /varset BuffList ${Window[BuffWindow].Child[BW_Buff${i}_Button].Child[Buff

${i}].Tooltip} 
            }        
            /if (${BuffList.Length}) {
                /if (${Debug}) /echo ...debug WriteBuffs: ${i}-${BuffList}
                /varset Writebufflist ${Writebufflist}|${BuffList}
            }
        /next i
        /ini "KissAssist_Buffs.ini" "${Me.ID}" Buffs "${Writebufflist}"
        /delay 15
        | Open Blocked Buffs window temporarily to read blocked buffs
         /if (!${Window[BlockedBuffWnd].Open} && !${BBWindowOpen}) {
            /windowstate BlockedBuffWnd open
            /varset BBWindowOpen 30m
        }
        | Write all blocked buffs to Kissassist_Buffs.ini file
        /for k 0 to 29
            /varset Blockedbuff ${Window[BlockedBuffWnd].Child[BW_BLOCKEDBUFF${k}

_Button].Child[BBuff${k}].Tooltip} 
            /if (${Blockedbuff.Length}) {
                | /echo ${Window[BlockedBuffWnd].Child[BW_BLOCKEDBUFF${k}_Button].Child

[BBuff${k}].Tooltip} 
                /varset Blockedbufflist ${Blockedbufflist}|${Blockedbuff}
            }
        /next k
        /if (${Blockedbufflist.Length}) /ini "KissAssist_Buffs.ini" "${Me.ID}" Blockedbuffs 

"${Blockedbufflist}"
        /if (${Window[BlockedBuffWnd].Open}) /windowstate BlockedBuffWnd close
        /varset WriteBuffsTimer 30s
        /if (${Debug}) /echo ...debug WriteBuffs Leave
    /return
| ----------------------------------------------------------------------------
| SUB: Clean Buffs File
| ----------------------------------------------------------------------------
    Sub CleanBuffsFile
        /declare i int local
        /declare SectionList string local ${Ini["KissAssist_Buffs.ini"]}
        /declare SectionName string local
        /for i 1 to ${SectionList.Count[|]}
            /varset SectionName ${SectionList.Arg[${i},|]}
            /if (${DebugBuffs}) /echo ${i} ${SectionName} ${Math.Calc[${Ini

["KissAssist_Buffs.ini",${SectionName},Day]}-${Time.Day}]} ${Math.Calc[${Time.Hour}-${Ini

["KissAssist_Buffs.ini",${SectionName},Hour]}]}
            /if (${Ini["KissAssist_Buffs.ini",${SectionName},Day].NotEqual[${Time.Day}]}) 

/ini "KissAssist_Buffs.ini" ${SectionName} NULL NULL
            /if (${Math.Calc[${Time.Hour}-${Ini["KissAssist_Buffs.ini",

${SectionName},Hour]}]}!=0) /ini "KissAssist_Buffs.ini" ${SectionName} NULL NULL
        /next i
    /return
| ----------------------------------------------------------------------------
| SUB: GoM Cast
| ----------------------------------------------------------------------------
    Sub GoMCastSpell
    /if (!${GoMActive} || ${GoMCast.Equal[null]} || ${GoMSpell.Find[spell]} || !

${CombatStart}) /return
            | Release timer after trying to cast for 5 secs
            /declare GoMTimer timer local 5s
            /echo Gift of Mana detected trying to cast ${GoMCast}   
            :CastGoM
                /if (${Cast.Ready[${GoMCast}]}) {
                    /if (${GoMTarget.Equal[Mob]} && ${MyTargetID})               /call 

CastWhat "${GoMCast}" ${MyTargetID}
                    /if (${GoMTarget.Equal[Me]} && ${Me.ID})                     /call 

CastWhat "${GoMCast}" ${Me.ID}
                    /if (${GoMTarget.Equal[MA]} && ${Spawn[${MainAssist}].ID})   /call 

CastWhat "${GoMCast}" ${Spawn[${MainAssist}].ID}
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                        /varset GoMActive 0
                        /return
                    }
                }
            /if (${GoMActive} || ${GoMTimer}) /goto :CastGoM
    /return
| ----------------------------------------------------------------------------
| SUB: AE check - cast area effect spells depending on set number of mobs
| ----------------------------------------------------------------------------
Sub AECheck
	/if (${DebugCombat}) /echo Enter AECheck
    /declare i int local
    /declare AESpell string local
    /declare AEMobCount int local
    /declare AETarget string local
    /declare AETargetID int local
    /call MobRadar ${AERadius}
    /if (${MobCount}<=1) /return
    /for i 1 to ${AE.Size}
        /varset AESpell ${AE[${i}].Arg[1,|]}
        /varset AEMobCount ${AE[${i}].Arg[2,|]}
        /varset AETarget ${AE[${i}].Arg[3,|]}
        /if (!${AEMobCount}) /goto :NextAE
            /if (${AEMobCount}<=${MobCount}) {
                /if (${AETarget.Equal[null]} || ${AETarget.Equal[Mob]}) /varset AETargetID 

${MyTargetID}
                /if (${AETarget.Equal[Me]}) /varset AETargetID ${Me.ID}
                /if (${AETarget.Equal[MA]}) /varset AETargetID ${Spawn[${MainAssist}].ID}
                /if (${AETarget.Equal[Pet]}) /varset AETargetID ${Me.Pet.ID}
                /call CastWhat "${AESpell}" ${MyTargetID}
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) /echo Casting AE ${AESpell} 
            }
        :NextAE
    /next i
	/if (${DebugCombat}) /echo Leave AECheck
/return
| ----------------------------------------------------------------------------
| SUB: WriteDebuffs
| ----------------------------------------------------------------------------
Sub WriteDebuffs
    /declare DebuffList string local  ${Math.Calc[${Debuff.Poisons}+${Debuff.Diseases}+

${Debuff.Curses}]} 
    /if (${Debuff} && !${NeedCuring}) {
        /varset NeedCuring 1
        /ini "KissAssist_Buffs.ini" "${Me.ID}" Debuffs "${DebuffList}"
    }
    /if (!${Debuff} && ${NeedCuring}) {
        /varset NeedCuring 0
        /ini "KissAssist_Buffs.ini" "${Me.ID}" Debuffs "${DebuffList}"
    }       
/return
| ----------------------------------------------------------------------------
| SUB: CheckCures
| ----------------------------------------------------------------------------
    Sub CheckCures
    /if (!${CuresOn}) /return
        /declare i int local 
        /declare j int local 
        /declare Debuffed int local ${Math.Calc[${Debuff.Poisons}+${Debuff.Diseases}+

${Debuff.Curses}]} 
        /declare IniIDList string local ${Ini["KissAssist_Buffs.ini"]}
        /declare IniIDCount int local ${Math.Calc[${IniIDList.Count[|]}-1]}
        /declare IniDebuffCount int local 0
        /declare IniDebuffList string local
        /for i 1 to ${Cures.Size}
            /if (!${Cures[${i}].Length}) /goto :NextCure
            /for j 1 to ${IniIDCount}
                /varset IniDebuffCount ${Ini["KissAssist_Buffs.ini",${IniIDList.Arg

[${j},|]},"Debuffs"]}
                /if (${IniDebuffCount} && ${Spawn[${IniIDList.Arg[${j},|]}].ID} && ${Spawn

[${IniIDList.Arg[${j},|]}].Distance}<100) {
                    /call CastWhat "${Cures[${i}]}" ${IniIDList.Arg[${j},|]}
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                        /echo Curing >> ${Spawn[${IniIDList.Arg[${j},|]}].CleanName} << 

with ${Cures[${i}]}
                        /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+o+]

Curing >> ${Spawn[${IniIDList.Arg[${j},|]}].CleanName} << with ${Cures[${i}]}[+x+]
                    }
                }
            /next j 
            /if (${Debuffed}) {
               /call CastWhat "${Cures[${i}]}" ${Me.ID}
                /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                    /echo -- Curing with ${Cures[${i}]}
                    /if (${EQBC.Connected} && ${EQBCOn}) /docommand  /${EQBCSay} [+o+]

Curing with ${Cures[${i}].Arg[1,|]}[+x+]
                }
            }
            :NextCure
        /next i
    /return    
| ----------------------------------------------------------------------------
| SUB: WaitSubs - bunch of crap to call while medding stnading around etc
| ----------------------------------------------------------------------------
    Sub WaitSubs
		/if (!${Me.Mount.ID} && !${Me.Sitting}) /sit
		/call CheckHealth
		/call CheckCures
		/call DoMezStuff
		/call WriteBuffs
		/call RezCheck
		/call DoPetStuff
		/call CheckBuffs
		/call MercsDoWhat
	/return
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

your code looks correct the problem might be the text is wrong in the event try

Rich (BB code):
#Event  Picked          "#*#You have stolen#*#"

MQ2melee can do it as well

/melee pickpocket=1
/melee save

will do what you want
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

also make sure you have compile 20130317a because autoinventory was screwed up early and was patched
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Thanks.

So essentially, I want this:
Rich (BB code):
| -------------------------------------------------------------------------------------
| SUB: Pick pocket
| -------------------------------------------------------------------------------------    
    Sub Event_Picked
/melee pickpocket=1
/melee save
    /return
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

no. those commands have nothing to do with the macro. just type in those commands to activate pick pocket on your rogue and mq2melee will handle it all
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Anyone willing to share a good KISS friendly zone or instance that I could use to level from 90-95?
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

It really depends on how strong your tank is, and if you have an enchanter. I've found higher tier underfoot zones are completely empty.

Personally I leave a character in a zone for 24 hours with a macro that checks for other players and when it finds them writes it to an ini their loc and how long they stayed in zone. Fungal Forest has had no people in a full weekend of sitting there,and I went 12 days total in underquarry with 11 people zoning in, no one for more than 10 minutes, and no one ever coming within 250 of my camp.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

My shaman gets stuck casting Pack of Wurt Rk. II over and over again. Everything else seems to be working ok though.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

I have a few questions if someone who's more literate in kiss than myself could answer. I fully expect every question i asked has been asked ad answered and i just fail at basic reading.

Is there anything coded for mana reiteration lines of chanter spells to hit any/all casters? Just so many chanter aura to choose from would be nice to not have one dedicated to it. or use the weaker bard version.

Is there a follow and or pause function, to help with the roaming groups. Short of /end and restarting them as your getting beat on.

I probably missed it in guide/forums what is the default range to heal/cast/engage an npc? And is there a way to adjust it? Not all camps are created equal.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

As i suspected it was a failure to RTFM.

please correct me if I'm wrong

for following /chase - Toggle chase/follow Main Tank on/off solves that.

NEW! Added Melee and Caster tags to Buffs Section for single target buff spells. Mostly for lower level spells
Is that what i would want to use for Mana Reiteteration?

Now if i could just find the /mb mbp button i would retire from modbot 100%.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

for /mb mbp I do this from my tank/person moving the group around. 2 eq hotkeys, and the command is sent through eqbc, where all my alts have eqbc control turned on.

/bca //mqp (pauses the macro)
/bca //target tankname
/bca //stick

then to stop them

/bca //keypress s
/bca //mqp unpauses the macro
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

Have a few Questions about
NEW! - DPSOn=2 - DPS feature to cast spells in an absolute order instead of based on mob health %'s.
DPSOn=0/1/2 - Off/On cast normal by mob health/On but cast in order of mob health %
The following would cast 1 2 3 4 starting at 97% of mob HEALTH. This feature is based on the health tag |97% |90% but will cast in order and does not check mob health other than when to start. So you would use 1-100% to rank the spells in the order you want them cast.

Okay I'm old and slow but i think what your saying is that, it will go based on an set cast order.

What I am trying to get my wizard to do is.

Chaos Char, Wildmana Barrage, Chaos Char, Wildmana Barrage, Flashpyre, Klixcyk's Fire, Concussion, Flashpyre, Ethereal Combustion

But it's not going in the order or it's possible the order is not being reset back to the start after each mob.

Rich (BB code):
[DPS]
DPSOn=2
DPSSkip=1
DPSInterval=4
DPS1=Fury of Ro|99|Me
DPS2=Fundament: First Spire of Arcanum|98|Me
DPS3=Chaos Char Rk. II|97
DPS4=Wildmana Barrage Rk. II|96
DPS5=Chaos Char Rk. II|95
DPS6=Wildmana Barrage Rk. II|94
DPS7=Flashpyre Rk. II|93 
DPS8=Klixcxyk's Fire Rk. II|92
DPS9=Concussive Burst Rk. II|91 "concussive only in here to ensure flash is off refresh"
DPS10=Flashpyre Rk. II|90
DPS11=Ethereal Combustion Rk. II|85

Is my dps section if anyone can see where i screwed the pooch at
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

As i suspected it was a failure to RTFM.

please correct me if I'm wrong

for following /chase - Toggle chase/follow Main Tank on/off solves that.

NEW! Added Melee and Caster tags to Buffs Section for single target buff spells. Mostly for lower level spells
Is that what i would want to use for Mana Reiteteration?

Now if i could just find the /mb mbp button i would retire from modbot 100%.

/mb mbp button what does that do?

/chase yes.

NEW! Added Melee and Caster tags to Buffs Section for single target buff spells. Mostly for lower level spells
Is that what i would want to use for Mana Reiteteration?

No. Mana Reiteteration is wonky and doesn't behave like a normal aura. I am working on a fix this weekend.
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

/bca //chase will follow the tank
From your tank will do it. Kiss is coded to recognize when toons are invis or moving.
/bca //chase will stop following the tank
 
Re: KissAssist 6 Updated 03/01/2013 v6.3

it Toggles doheals dobuffs doevents etc all to false as well it interrupts any casts. Great for moving toon's. combined with it's follow you can pick up and move in just a few seconds.




It also has a /mb follow that auto Dismounts then sticks them at behind 20 or /mb follow close that sticks them at 3 or 5 i forget.
 
KissAssist Release KissAssist 6 Updated 05/27/2013 v6.5

Users who are viewing this thread

Back
Top
Cart