• 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 5.6 Updated 11/13/2012

Re: KissAssist 5.4 Updated 10/28/2012

Oh I see. You are not targeting yourself on start up. All my hot keys are /mac kissassist pullertank Toonname so i never see that. I can add that it makes sense since no one else can be pullertank.

Usage - /mac kissassist Role TankName 95 or just target Main Tank and /mac kissassist.
 
Re: KissAssist 5.2 Updated 10/04/2012

wouldn't the necro using this know that and would only activate it if they were fighting undead?

as for a coding solution

Rich (BB code):
/if (${Target.Race}==${ZombieRaceID}) /return
ect for all the undead races... i think theres only a few... zombie and skelly... you could set a list just like your ignore/pull list for each zone and let players choose what they want the mezz code to go for... <--- that all made sense in my head but probably no one elses...

I would never bother coding undead recognition. I would just use the MQ2Cast event target invalid or whatever. If people use the undead versions instead of the normal version they need to learn their class.
 
Re: KissAssist 5.4 Updated 10/28/2012

i ment for the lower levels... do necros get a lower level mez on all mobs? anywho... there was also a few other things i haven't worked out... necros have a spell that turns the npc undead (you can probably see where i'm going from here :)) how would you set up the ini file so it casts that spell then casts the undead slow (or the undead line of spells and such that makes being a necro in a undead so awsome) i've tried to setting them into dps1 and dps2 but 2 problems... they don't react quickly enough... and sometimes the spell a doesn't land so spell b wont work...
 
Re: KissAssist 5.4 Updated 10/28/2012

i ment for the lower levels... do necros get a lower level mez on all mobs? anywho... there was also a few other things i haven't worked out... necros have a spell that turns the npc undead (you can probably see where i'm going from here :)) how would you set up the ini file so it casts that spell then casts the undead slow (or the undead line of spells and such that makes being a necro in a undead so awsome) i've tried to setting them into dps1 and dps2 but 2 problems... they don't react quickly enough... and sometimes the spell a doesn't land so spell b wont work...

Screaming Terror lv 22 mez up to 55
http://everquest.allakhazam.com/db/spell.html?spell=549
 
Re: KissAssist 5.4 Updated 10/28/2012

Noticed on my 95 Cleric that he will target a PC's corpse but doesn't cast his Blessing of Ressurection but spams the MQ2 HuD that he is Rezzing.
 
Re: KissAssist 5.4 Updated 10/28/2012

Download the new compile AA's were just fixed
 
Re: KissAssist 5.5 Updated 11/12/2012

I love this insane mac,it's so beautiful..thanks a ton Maskoi, u master of macro=)

Btw, could you consider to add 2 more function to this awesome mac in the future:

1. Add cure funtion to those class who can cure
2.Add Pullpath so puller can pull mobs based on preset path.

1 maybe easy but 2 i think need some work .Just my 2 cp..
K
 
Re: KissAssist 5.5 Updated 11/12/2012

Cures are tough because one toon has to notify another to cure them. Kiss doesn't communicate with other toons currenty but MQ2Posse is opening a lot of possibilities.

i am exploring several options for pull pathing I am not sure which is the easiest so still testing stuff. Kiss will have some kind of path option in the next month or so.
 
Re: KissAssist 5.5 Updated 11/12/2012

5.5 looks crazy on my notepad when i opened it, so i copied and pasted here and it looks fine.
Rich (BB code):
| - kissassist.mac v5.5 by Maskoi 11/13/2012
| - KISS Assist - A simple multi class assist macro
| Requires MQ2Cast, MQ2Exchange. MQ2Melee, MQ2MoveUtils, MQ2Rez 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  Burn            "#*#|${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    "#*#Reset #1# #2# #3#"
#Event  GainSomething   "#*#You have gained|#1#|"
#event  GoMOn           "You've 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  FSEQBC          "#1# tells the fellowship, #2#"
#Event  Joined           "#1# has joined the group."
#Event  KissE           "#*#kissedit#*#"
#Event  MezBroke        "#1# has been awakened by #2#.
| #Event  MezImmune       "Your target cannot be mesmerized#*#" 
#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#*#"

|-------------------------------------------------------------------------------------
| 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       5.5
    /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 /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                int         0 
    /call LoadIni General MiscGem               int         8 
    /call LoadIni General HoTTOn                int         1 
| ************************* 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 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 *****************************************|      
    /if (${Me.Class.Name.Equal[Bard]}) {
        /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
    /declare Heals[10]                          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"
    }
| ************************* 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"
        /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
    }
| ************************* Mez *****************************************|            
    /if (${Select[${Me.Class.ShortName},BRD,ENC]}) {
        /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"
        /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
        /declare MezImmuneID                    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 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 AFKToolsOn           int         0
    /call LoadIni AFKTools AFKGMAction          string      "/quit"
    /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 Attacking              int         outer       0
    /declare PetAttack              int         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 WasTwisting            int         outer       0    
    /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              int         outer       0
    /declare JoinedParty            int         outer       0
    /declare MercAssisting          int         outer       0
    /declare WriteBuffsTimer        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 PBuffCheck[50]         string      outer
    /declare PBBuffCheck[50]        string      outer
    /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 5PointPullAll          string      outer
    /declare AddSpam                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 Progression servers not having 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 MQ2Exchange     
    /call CheckPlugin MQ2Melee
    /call CheckPlugin MQ2Moveutils
    /call CheckPlugin MQ2Rez
    /if (${Me.Class.Name.Equal[Bard]}) /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
    |  Set MQ2moveutils variables
    /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
    | Initialize variables for ninjadvloot.inc include file
    /call SetupAdvLootVars
    /if (${HealsOn}) /call SortArray Heals 100|100 <
    /if (${DPSOn}) /call SortArray DPS 0|0 >
    /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]}) {
        /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}
    }

    /if (!${Spawn[${Target}].ID} && ${Role.Equal[PullerTank]}) {
        /Ttarget ${Me}
        /delay 10
    }
    | Error control no tank selected end macro
    /if (!${Spawn[${Target}].ID} || !${Select[${Target.Type},Mercenary,PC,Pet]}) {
        /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
|-------------------------------------------------------------------------------------
| Main Loop
|-------------------------------------------------------------------------------------   
        :MainLoop
            /doevents
            /call CheckForAdds MainLoop
            /call DoMezStuff
            /call CheckHealth
            /call RezCheck
            /call DoMiscStuff
            /call CanIDoStuff
            /call MercsDoWhat
            /call DoPetStuff
            /call WriteBuffs
            /call CheckBuffs
            /call DoBardStuff
            /call DoWeMed            
            /call GroupWatch
            /call FindMobToPull
            /call Pull
            /call Assist
            /call Combat
            /call LootStuff
            /call DoWeMove
            /call AFKTools
        /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}].ID} && ${MainAssist.NotEqual[${Me}]} && ${Select[${Role},tank,pullertank]}==0 && ${Spawn[${MainAssist}].Distance}<200) /assist ${MainAssist}
            /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,Mercenary]}) /return BadTargetType
        /if (${DebugCombat}) /echo Validate 2
        /if (${MobsToIgnore.Find[null]}) /goto :SkipIgnore
            /for k 1 to 10
                | /if (${Target.CleanName.Equal[${MobsToIgnore.Arg[${k},,]}]}) /return MobOnIgnoreList
                /if (${Target.CleanName.Find[${MobsToIgnore.Arg[${k},,]}]}) /return MobOnIgnoreList
            /next k
        :SkipIgnore 
        | 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}) /return LOS
            /if (${SpawnCount[loc ${Target.X} ${Target.Y} radius 10 pc]}>=1 && ${Pulling}) /return PCNear
            /if (${Target.PctHPs}<=99) /return PullNotFullHealth
            /if (${DebugPull}) /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}].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}) /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 (${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 /bc [+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} 10 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 
                }
            } 
            :Attack
                /doevents
                /if (${MercOn} && !${MercAssisting} && ${MyTargetID}) /call MercsDoWhat
                /if (${MezOn}) /call DoMezStuff 
                /if (${PetOn}) /call CombatPet
                /if (${HealsOn}) /call CheckHealth  
                /if (${DPSOn}) /call CombatCast 
                /call CheckBuffs
                /if (${Me.Class.Name.Equal[Bard]}) /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 (${Spawn[${MyTargetID}].Type.Equal[Corpse]} || !${Spawn[${MyTargetID}].ID})  /return
            /if (!${DPS[${i}].Length}) /return
            /doevents
            /if (${MezOn}) /call DoMezStuff
            /if (${MercOn} && !${MercAssisting} && ${MyTargetID}) /call MercsDoWhat
            /if (${PetOn}) /call CombatPet
            /if (${HealsOn}) /call CheckHealth
            /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 (${DPSText.Arg[3,|].Find[MA]}) /varset DPSTargetID ${Spawn[${MainAssist}].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}
                }
                /if (${HealsOn}) /call CheckHealth
                /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
                    }
                }
                /call CheckCasting
            :skipcast
            /if (${DebugCombat}) /echo ${DPS[${i}]} ${Macro.Return} DPSTimer${i} ${DPSTimer${i}}
            | 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}
            }
            /if (${Select[${DPSText.Arg[3,|]},Me,MA]}) /call CombatTargetCheck
        /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 (${Me.Pet.ID} && ${PetAttack}) /return
        /call CombatTargetCheck
        /if (${Target.PctHPs}<=${Math.Calc[${AssistAt}-${AttackDelay}]}) { 
            /pet attack
            /delay 5
            /varset PetAttack 1
            | Make Pet attack every 20s
            /timed 200 /varset PetAttack 0
        }
    /return
|-------------------------------------------------------------------------------------
| SUB: CombatReset
|-------------------------------------------------------------------------------------
    Sub CombatReset
        /if (${DebugCombat}) /echo CombatReset: Enter
        /if (${MyTargetID} && ${CombatStart}) /echo SLAIN >> ${MyTargetName} <<
        /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 (${Me.Class.Name.Equal[Bard]}) /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]}) /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})  /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}) {
                /popup Add(s) in camp detected 
                /echo Add(s) in camp detected
                /if (${EQBC.Connected} && ${EQBCOn} && (${MainAssist.Equal[${Me}]} || ${Select[${Role},tank,pullertank]})) /docommand /bc [+r+]Add(s) in camp detected[+x+]
                /if (${Select[${Role},pullertank]}) /varset Pulled 0
            }
            | 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
            /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 TempItem int local 0
        /varset CastResult CAST_FAIL
        /if (${Me.CombatAbility[${castWhat}]} && !${Me.CombatAbilityTimer[${castWhat}]}) {
            /target id ${castTargetID}
            /delay 10 ${Target.ID}==${castTargetID}
            /disc ${castWhat}
            /varset CastResult CAST_SUCCESS
        }
        | - Check & cast if item
        /if (${FindItem[=${castWhat}].ID} && ${FindItem[${castWhat}].Timer}==0) {
            /casting "${castWhat}|item" -targetid|${castTargetID}
            /delay 2s
            /varset CastResult ${Cast.Result}
            /return ${CastResult}
            | /if (${CastResult.Equal[CAST_SUCCESS]} && !${FindItem[=${castWhat}].ID}) /return ${CastResult} 
        }
        | - Check & cast if AA
         /if (${Me.AltAbility[${castWhat}]} && ${Me.AltAbilityReady[${castWhat}]}) {
            /if (${Me.Class.Name.NotEqual[Bard]})  { 
                /target id ${castTargetID}
                /delay 10 ${Target.ID}==${castTargetID}
                /casting "${castWhat}"|alt -maxtries|2
                /varset CastResult ${Cast.Result}
            }
            /if (${Me.Class.Name.Equal[Bard]}) {
                /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 200 ${Cast.Ready[${castWhat}]}
            }
            /if (${Cast.Ready[${castWhat}]}) { 
                /target id ${castTargetID}
                /delay 10 ${Target.ID}==${castTargetID}
                /casting "${castWhat}" -maxtries|2
                /varset CastResult ${Cast.Result}
            }
        }
        /call CheckCasting       
    /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
                    /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 (!${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 /bc [+t+]PULLER-> My ${MedStat} is ${MedStart}% time to med.[+x+]
                /if (${Me.Class.Name.Equal[Bard]} && ${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
                    /if (!${Me.Mount.ID} && !${Me.Sitting}) /sit
                    /call WriteBuffs
                    /call DoPetStuff
                    /call CheckBuffs
                    /call CheckHealth
                    /call RezCheck
                    /call DoMezStuff
                    /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
        /declare CCTimer timer local 50
        :NotReady
            /if (${CCTimer}==0) /return
        /if (${Me.Class.Name.NotEqual[Bard]} && (${Cast.Status.NotEqual} || ${Me.Casting.ID})) /goto :NotReady
    /return
|-------------------------------------------------------------------------------------
| SUB: CheckBuffs 
|-------------------------------------------------------------------------------------
     Sub CheckBuffs
        /doevents
        /if (!${BuffsOn})  /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
        /declare PIniNum string local ${Ini["KissAssist_Buffs.ini"]}
        /declare PBuffNum int local ${Math.Calc[${PIniNum.Count[|]}-1]}
        /declare PBuffCount int local 0
        /declare CTempBuff string local
        /declare StackSkip int local
        | Group Buffs            
        /for i 1 to ${Buffs.Size}
            | If Buffs=NULL skip to next buff
            /if (!${Buffs[${i}].Length} || ${Buffs[${i}].Arg[3,|].Equal[0]}) /goto :SkipBuff
            | Check for combat and skip redundant subs called in combat routines.
            /if (!${CombatStart}) {
                /call CheckForAdds CheckBuffs
                /call CanIDoStuff
                /if (${HealsOn}) /call CheckHealth
            }
            /if (${DebugBuffs}) /echo #${i} 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 (${DebugBuffs}) /echo #${i} Buff${i}=${Buffs[${i}]}
                /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
                /varset SpellRange ${Spell[${1stPart}].Range}
                /if (${Spell[${1stPart}].TargetType.Find[Group]})  /varset SpellRange ${Spell[${1stPart}].AERange}
            }
            /if (!${SpellRange}) /varset SpellRange 100
            /if (${DebugBuffs}) /echo -- 1st assigned: 2ndPart:${2ndPart} ${Buffs[${i}]} 
            | 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}) /return
                    /goto :SkipBuff
                }
            }
            | Combat check to skip all buffs but mana regen
            /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 { 
                    /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
                    /echo Casting Aura >> ${1stPart} <<
                    | - 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}
                    }
                    /delay 5s
                }
                /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
                /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}
                            /if (${Macro.Return.Equal[CAST_SUCCESS]}) /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 (${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
                /delay 25
                /varcalc Buff${i}GM${j} (${Spell[${1stPart}].Duration.TotalSeconds}*${DurationMod})*10
                /goto :SkipBuff
            }
            | Check Buffs from ini
            /if (${Redguides}) {
                /if (${PBuffNum}<=0) /varset PBuffNum 1
                /for k 1 to ${PBuffNum}
                    /if (${Select[${Buffs[${i}].Arg[2,|]},Mana,Aura,Mount,MA,Me,Summon,End]} || ${FindItemCount[${Buffs[${i}]}]}>=1 || ${Spell[${Buffs[${i}]}].TargetType.Find[self]} || ${Me.ID}==${PIniNum.Arg[${k},|]} ) /goto :NextBuffCheck
                    /if (${FullText.Arg[2,|].Equal[Dual]})  /varset Buffs[${i}] ${3rdPart} 
                    /if (${Spawn[${PIniNum.Arg[${k},|]}].ID}) {
                        /if (!${Defined[PBuffsTimer${Spell[${Buffs[${i}]}].ID}]}) /declare PBuffsTimer${Spell[${Buffs[${i}]}].ID} timer outer 
                        /varset CTempBuff ${Buffs[${i}]}
                        /if (${Buffs[${i}].Find[ Rk. III]}) /varset CTempBuff ${Buffs[${i}].Left[-8]}
                        /if (${Buffs[${i}].Find[ Rk. II]}) /varset CTempBuff ${Buffs[${i}].Left[-7]}
                        /if (${DebugBuffs}) /echo ${PIniNum.Arg[${k},|]} ${CTempBuff} ${Buffs[${i}]}
                        /varset PBBuffCheck[${k}] ${Ini["KissAssist_Buffs.ini",${PIniNum.Arg[${k},|]},"Blockedbuffs"]}
                        /if (${PBBuffCheck[${k}].Find[${CTempBuff}]}) /goto :NextBuffCheck
                        /varset PBuffCheck[${k}]  ${Ini["KissAssist_Buffs.ini",${PIniNum.Arg[${k},|]},"Buffs"]}
                        /if (${DebugBuffs}) /echo ${Spell[${1stPart}].TargetType.Find[group]} ${PBuffCheck[${k}].Find[${CTempBuff}]}
                        /if (${PBuffCheck[${k}].Count[|]}<=0) /goto :NextBuffCheck
                        /varset PBuffCount ${Math.Calc[${PBuffCheck[${k}].Count[|]}-1]}
                        /for l 1 to ${PBuffCount}
                         | /echo ${Buffs[${i}]} ${PBuffCheck[${k}].Arg[${l},|]} ${Spell[${Buffs[${i}]}].WillStack[${PBuffCheck[${k}].Arg[${l},|]}]} ${Select[${Spell[${Buffs[${i}]}].WillStack[${PBuffCheck[${k}].Arg[${l},|]}]},TRUE,FALSE,NULL]}
                            /if (${Select[${Spell[${Buffs[${i}]}].WillStack[${PBuffCheck[${k}].Arg[${l},|]}]},TRUE,FALSE,NULL]}==2) /goto :NextBuffCheck
                        /next l
                        /if (!${PBuffCheck[${k}].Find[${CTempBuff}]} && !${PBuffsTimer${Spell[${Buffs[${i}]}].ID}}) {
                            /if (${FullText.Arg[2,|].Equal[Dual]}) /varset Buffs[${i}] ${1stPart} 
                            /if (${Spell[${1stPart}].TargetType.Find[group]}>=1 || ${Spell[${Buffs[${i}]}].TargetType.Find[group]}>=1)  {
                                /if (${DebugBuffs}) /echo CastWhat "${Buffs[${i}]}" ${PIniNum.Arg[${k},|]} ${Spawn[${PIniNum.Arg[${k},|]}].CleanName}
                                /if (${Spawn[${PIniNum.Arg[${k},|]}].Distance}<=${SpellRange}) /call CastWhat "${Buffs[${i}]}" ${PIniNum.Arg[${k},|]}
                                /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                                    /if (${FullText.Arg[2,|].Equal[Dual]}) /varset Buffs[${i}] ${3rdPart}
                                    /echo Buffing >> ${Buffs[${i}]} << on ${Spawn[${PIniNum.Arg[${k},|]}].CleanName}
                                    /varset PBuffsTimer${Spell[${Buffs[${i}]}].ID} 750
                                }
                            }   
                        }
                        :NextBuffCheck
                        /if (${FullText.Arg[2,|].Equal[Dual]}) /varset Buffs[${i}] ${3rdPart}
                    }
                /next k
            }
            /if (${Select[${2ndPart},Aura,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 (${FullText.Arg[2,|].Equal[Me]} || ${FullText.Arg[2,|].Equal[MA]}) /varset Buffs[${i}] ${1stPart}
            | Cast buffs on MA out of Group
            /if (${2ndPart.Equal[MA]} && ${Spawn[${MainAssist} ${MainAssistType}].Distance}<=${SpellRange} && !${Spawn[${MainAssist} ${MainAssistType}].Moving} && !${Spawn[${MainAssist} ${MainAssistType} group].ID} && ${Spawn[${MainAssist} ${MainAssistType}].ID} && ${Spawn[${MainAssist} ${MainAssistType}].Type.NotEqual[corpse]} && ${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}
                    /delay 60 ${Me.SpellReady[${Buffs[${i}]}]}
                    /varcalc Buff${i}GM7 (${Spell[${Buffs[${i}]}].Duration.TotalSeconds}*${DurationMod})*10
                    /if (${DebugBuffs}) /echo MA out of group Timer ${Buff${i}GM7}
                    /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]}<1 Tar Type: ${Spell[${Buffs[${i}]}].TargetType}
            /if (!${Me.Buff[${Buffs[${i}]}].ID} && ${Spell[${Buffs[${i}]}].Stacks[0]} || ${FullText.Arg[2,|].Equal[MA]} && ${Spawn[${MainAssist} ${MainAssistType} group].ID}) {
                | 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 && ${2ndPart.NotEqual[MA]}) {
                    /call CastWhat "${Buffs[${i}]}" ${Me.ID}
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                        /echo Buffing >> ${Buffs[${i}]} <<
                    }
                }
                | 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}+1)) {
                        /if (${DebugBuffs}) /echo Single Type Group Buff
                       /for j 0 to ${Group}
                            | Check if party member is in zone and within spell range and if spell is set to cast on self only |Me
                            /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}}
                            /if (!${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}}) /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}
                                /delay 60 ${Me.SpellReady[${Buffs[${i}]}]}
                                /varcalc Buff${i}GM${j} (${Spell[${Buffs[${i}]}].Duration.TotalSeconds}*${DurationMod})*10
                            }
                            /delay 20
                            :nextmember
                        /next j
                    } else /if (${2ndPart.NotEqual[MA]}) {
                        /call CastWhat "${Buffs[${i}]}" ${Me.ID} 
                        /delay 20
                    }
                }
                | 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} 
                    /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} 
                    /delay 20
                }
            }
            | 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}
                /delay 15s !${Me.Casting.ID} 
            }
        :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
            }
        /next i
        /if (${DebugBuffs}) /echo CheckBuffs leave
    /return
|-------------------------------------------------------------------------------------
| SUB: DoPetStuff 
|-------------------------------------------------------------------------------------
    Sub DoPetStuff
        /doevents
        /if (!${PetOn} || ${AggroTargetID}) /return
        /if (${Debug}) /echo DoPetStuff: enter
        /declare PTempBuff string local 
        /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
        /declare i int local
        /declare j int local
        /declare FoundPetBuff 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
            /casting "${PetSpell}"|${MiscGem} -maxtries|2
            /delay 350 ${Cast.Ready[${PetSpell}]}
            /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
        }
        /if (${Me.Pet.ID}) {
            | Pet Buffs 
            /if (${PetBuffsOn}) {
                /for i 1 to ${PetBuffs.Size}
                /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}
                } 
                :SkipPetBuff
                /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
            }
        }
    /if (${Debug}) /echo DoPetStuff: leave
    /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}) {
            /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}) {
            /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})) {
            | 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}
            /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}
        }
        /if (${AutoRezOn}) /call RezCheck
        /if (${PetOn} && ${Me.Pet.ID} && ${Me.Pet.PctHPs} < 100) /call DoPetHealStuff 
        /if (${DebugHeal}) /echo Sub CheckHealth 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 /bc [+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: 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 j              int     local 0
        /declare HealSpell      string  local
        /declare HealPct        string  local
        /declare HealThem       string  local   ${Spawn[${HealName} ${HealType}].ID}
        /declare HealFirst      int     local   0
        /declare WhoNumTank     int     local   0
        | Check for player hovering or corpse and skip heal if true
        /if (${Spawn[${HealName} ${HealType}].Type.NotEqual[Mercenary]} && (${Spawn[${HealName} ${HealType}].Hovering} || ${Spawn[${HealName} ${HealType}].Type.Equal[Corpse]})) /return        
        /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,|]}
            /varset HealFirst   0
            | Assign MA spells WhoNum 7 for unique timers
            /if (${Heals[${j}].Arg[3,|].Find[MA]}) {
                /varset HealFirst ${Spawn[${MainAssist} ${MainAssistType}].ID}
                /varset WhoNumTank ${WhoNum}
                /varset WhoNum 7
            }
            | Check for Main Assist heal priority
            /if (${HealFirst} && ${HealThem}!=${HealFirst}) /goto :NextHeal
            | Skip HoT on Extra MA check if MA in Group
            /if (${WhoNum}==6 && ${Spell[${HealSpell}].Duration.TotalSeconds}>0 && ${Spawn[${MainAssist} ${MainAssistType} group].ID}) /goto :NextHeal
            | Check For Life Taps 
            /if (${Heals[${j}].Arg[3,|].Find[Tap]}) { 
                /if (${CombatStart} && ${Me.PctHPs}<=${HealPct} && ${Spawn[${MyTargetID}].ID} && ${Spawn[${MyTargetID}].Distance}<=${Spell[${HealSpell}].MyRange} && ${Spell${j}GM0}==0 && ${HealPct}>=1) {
                    /call CastWhat "${HealSpell}" ${Spawn[${MyTargetID}].ID}
                    /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
                        /echo -- ${HealSpell} for  >> ${Me.CleanName} << 
                        /if (${EQBC.Connected} && ${EQBCOn}) /docommand /bc [+o+]${HealSpell} for  >> ${Me.CleanName} <<[+x+]
                        /varcalc Spell${j}GM0 (${Spell[${HealSpell}].Duration.TotalSeconds}*${DurationMod})*10
                        /if (${DebugHeal}) /echo Assign Timer:Spell${j}GM0 (${Spell[${HealSpell}].Duration.TotalSeconds}*${DurationMod}) ${Spell${j}GM0}
                        /return
                    }
                } else {
                    /goto :NextHeal
                }
            }
            | If group heal skip 
            /if (${Spell[${HealSpell}].TargetType.Find[group]} || ${Spell[${FindItem[${HealSpell}].Spell}].TargetType.Find[group]}) {
                /if (${Me.Class.Name.Equal[Shaman]} && ${Spell[${HealSpell}].Name.Find[Intervention]} || ${Me.Class.Name.Equal[Druid]} && ${Spell[${HealSpell}].Name.Find[Survival]}) {
                    /goto :ShamanHeal
                } else /goto :NextHeal
            }
            /if (${DebugHeal}) /echo DoHealStuff GM:${WhoNum} ${HealName} HealAt:${HealPct} Heal:${j} ${HealSpell} HealTimer:Spell${j}GM${WhoNum} ${Spell${j}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${j}GM${WhoNum}}==0 && ${HealPct}>=1) {
                /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 /bc [+o+]${HealSpell} on  >> ${Spawn[${HealName} ${HealType}].CleanName} <<[+x+]
                    /varcalc Spell${j}GM${WhoNum} (${Spell[${HealSpell}].Duration.TotalSeconds}*${DurationMod})*10
                    /if (${DebugHeal}) /echo  Assign Timer:Spell${j}GM${WhoNum} ${Spell[${HealSpell}].Duration.TotalSeconds}*${DurationMod} ${Spell${j}GM${WhoNum}}
                    /return
                }
            }
        :NextHeal
        /if (${WhoNum}==7) /varset WhoNum ${WhoNumTank}
        /next j
        /if (${DebugHeal}) /echo DoHealStuff: 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 (${Heals[${j}].Arg[3,|].Find[pet]} && ${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 /bc [+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 RezID int local
    /declare RezRadius int local 150
    /if (!${Select[TRUE,${Me.SpellReady[${AutoRezOn}]},${Me.AltAbilityReady[${AutoRezOn}]},${Me.CombatAbilityReady[${AutoRezOn}]}]}) /return
    /if (${AutoRezOn} && !${Me.Hovering}) {
        /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) {
                /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 /bc [+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} && ${Cast.Ready[${AutoRezWith}]}) {
            /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) {
                    /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 /bc [+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 
        | Reset mdist for ninjadvloot
        /squelch /moveto mdist 10
        /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
        /for k 1 to 10
            /if (${MobsToIgnore.Arg[${k},,].Length} && !${MobsToIgnore.Find[null]} && ${DebugPull}) /echo ... debug_pull MobsRadar ${MobsToIgnore.Arg[${k},,]}
            /if (${MobsToIgnore.Arg[${k},,].Length})  /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
        /call MobRadar ${MezRadius}
        /if (${MobCount}<2) /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 (${AddsArray[${i},1].Equal[NULL]})  /goto :SkipMez
            /if (${AddsArray[${i},1].Equal[${MyTargetID}]}) /goto :SkipMez
            /if (${Spawn[${AddsArray[${i},1]}].PctHPs}<${MezStopHPs}) /goto :SkipMez
            /if (${AddsArray[${i},2]}>${MezMaxLevel} || ${AddsArray[${i},2]}<${MezMinLevel}) /goto :SkipMez
            /if (!${Spawn[${AddsArray[${i},1]}].LineOfSight}) /goto :SkipMez 
            /if (${Spawn[${AddsArray[${i},1]}].Body.Name.Equal[Giant]}) /goto :SkipMez 
            /if (${MezImmune.Find[${AddsArray[${i},3]}]}) {
                /if (${MMTimer${i}}==0) /docommand /bc [+g+]MEZ Immune Detected -> ${AddsArray[${i},3]} <- ID:${AddsArray[${i},1]}[+x+]
                /varset MMTimer${i} 1m
                /goto :SkipMez
            }
            /if (${MobsToIgnore.Arg[${i},,].Length} && ${MobsToIgnore.Arg[${i},,].Equal[${AddsArray[${i},3]}]}) /goto :SkipMez 
            /if (${Me.CurrentMana}<${Spell[${MezSpell}].Mana}) /goto :SkipMez
            /if (${MezTimer${i}} > 0) /goto :SkipMez
            /if (${MobCount}<=1 && ${Spawn[${MainAssist}].ID} && (${Spawn[${MainAssist}].Type.Equal[Mercenary]} || ${Spawn[${MainAssist}].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}
            /if (${MezAECount}>0 && ${MobCount}>=${MezAECount} && ${MezAETimer}==0 && ${Spawn[${AddsArray[${i},1]}].ID}) {
                /if (${MyTargetID} && ${CombatStart}) {
                    /call MezMobsAE ${MyTargetID}
                } else {
                    /call MezMobsAE ${AddsArray[${i},1]}
                }
            }
            /call MezMobs ${AddsArray[${i},1]} ${i}
            :SkipMez
        /next i
        /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 (${Me.Class.Name.Equal[Bard]}) { 
        /squelch /twist once ${Me.Gem[${MezAESpell}]}
        /echo MEZZING-> AE Mezzing Now - ${MezAESpell}
        /if (${EQBC.Connected} && ${EQBCOn}) /docommand /bc [+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 4s !${Me.Casting.ID}
        /varset MezAETimer ${Spell[${MezSpell}].Duration.TotalSeconds}s
        /echo TIMER SET ${MezAETimer}
        /echo MEZZING-> AE Mezzing Now - ${MezAESpell}
        /if (${EQBC.Connected} && ${EQBCOn}) /docommand /bc [+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}
        /varset MezImmuneID ${Target.ID}
        /if (${Target.ID}==${MobID}) {
            /if (${MezCount[${TimerNum}]}<1) /echo MEZZING-> ${Spawn[${MobID}].CleanName} <- ID:${MobID}
            /if (${EQBC.Connected} && ${EQBCOn} && ${MezCount[${TimerNum}]}<1) /docommand /bc [+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 /bc [+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}
                /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 ...debug_mez MezTimer${TimerNum} ${MezTimer${TimerNum}}
                }
                /if (${Macro.Return.Equal[CAST_RESIST]} && ${MezFail}<2) {
                    /echo MEZ Resisted -> ${Spawn[${MobID}].CleanName} <- ID:${MobID}
                    /docommand /bc [+g+]MEZ Resisted -> ${Spawn[${MobID}].CleanName} <- ID:${MobID}[+x+]
                    /goto :retrymez
                }
            }
            | Bard mez code
            /if (${Me.Class.Name.Equal[Bard]}) { 
                /squelch /twist once ${Me.Gem[${MezSpell}]}
                /delay 35 
                /squelch /target clear
                /varcalc MezCount[${TimerNum}] ${MezCount[${TimerNum}]}+1
                /varset MezTimer${TimerNum} 110
            }  
            /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 /bc [+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
    /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[${MezImmuneID}].CleanName}
        } else {
            /varset ImmuneAdd ${ImmuneAdd},${Spawn[${MezImmuneID}].CleanName}
        }
        /if (!${MezImmune.Find[${Spawn[${MezImmuneID}].CleanName}]}) /ini "${InfoFileName}" "${Zone}" "MezImmune" "${ImmuneAdd}"
        /echo MEZ Immune -> ${Spawn[${MezImmuneID}].CleanName} <- ID:${MezImmuneID} Adding to MezImmune list.
        /docommand /bc [+g+]MEZ Immune -> ${Spawn[${MezImmuneID}].CleanName} <- ID:${MezImmuneID} Adding to MezImmune list.[+x+]
        | Reassign mezimmune var the new list
        /varset MezImmune ${ImmuneAdd}
    /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
        :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
            /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 (${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]}) /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
        /squelch /alert clear 1
        | Skip mobs on Ignore Mob 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
        :FindMob
        /varset PullCount ${SpawnCount[npc los radius ${MaxRadius} zradius ${MaxZRange} targetable noalert 1]}
        /for i 0 to ${PullCount}
            /doevents
            /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} NoValid ${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 /bc [+t+]PULLING-> ${Target.CleanName} <- ID:${Target.ID} at ${Int[${Target.Distance}]} feet.[+x+]
                /varset MyTargetID ${Target.ID}
                /varset MyTargetName ${Target.CleanName}
                /return
            }
        /next i
        /if (!${Target.ID}) {
            /varcalc FailCounter ${FailCounter}+1
            | /echo No Valid Target in Range ${MaxRadius} - ${FailCounter} Time(s)
            /call AlertClear
            /if (${FailCounter}>=${FailMax}) {
                /varset FailCounter 0
                /if (${PullWait}) {
                    /echo Waiting ${PullWait} seconds for mobs to respawn.
                    /if (${EQBC.Connected} && ${EQBCOn}) /docommand /bc [+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}) /sit
        :PullAgain
            /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}) {
                /moveto id ${Target.ID} mdist ${PullDist} 
                /delay 5
            }
            :WeThereYet
                /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
                    /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}) {
                    :TimedOut
                    /call PullReset
                    /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 ${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]}) {
            /varcalc PullDist ${PullDist}*.8
            /goto :PullAgain
        }
        /if (${Target.ID} && ${Target.Distance}<${PullRange}) {
                /moveto off
                | Validate target one more time before pulling
                /if (!${Select[${Role},hunter]}) {
                    /call  ValidateTarget
                    /if (${ValidTarget}==0) {
                        /squelch /alert add 1 id ${Target.ID}
                        /squelch /target clear
                        /varset Pulling 0
                        /echo Aborting Pull! Target invalid now! ${Macro.Return}
                        /call DoWeMove
                        /return
                    }
                }
                | Handle pulling with Melee setting
                /if (${PullWith.Equal[Melee]}) {
                    /if (${DebugPull}) ... debug_pull /echo PULL: Melee
                    | 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
                        | Cycle until combat off and mob is aggro'd    
                        /if (${Me.Combat} && (${AggroTargetID} || ${Target.PctHPs}<100)) /goto :StopCombat
                        /squelch /target clear
                        | 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}
                    /face fast
                    /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 (${DebugPull}) /echo ... debug_pull Done Pulling
        /if (${ReturnToCamp}) {
            /call WaitForMob
            /varset Pulled 0
        }
        /if (${DebugPull}) /echo ... debug_pull Pull leave
    /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
                    /squelch /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
        /squelch /target clear
        /call AlertClear
        /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 GMType string local
        /declare GMName string local
        /declare GMClass string local
        /declare GMStat string local        
        /if (!${Spawn[${MainAssist}].ID} && !${Select[${Role},tank,pullertank,hunter]}) {
            /echo I am not detecting Main Assist pausing.
            :WaitForMA
            /doevents
            /call CheckHealth
            /call CheckForAdds GroupWatch
            /call CheckBuffs
            /call DoPetStuff
            /if (${MercOn}) /call MercsDoWhat
            /if (${Spawn[${MainAssist}].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
            /varset GMType ${Group.Member[${i}].Type} 
            /varset GMName ${Group.Member[${i}].CleanName} 
            /varset GMClass ${Group.Member[${i}].Class.ShortName} 
            /if (${Select[${GMClass},BER,MNK,ROG,WAR]}) {
                /varset GMStat Endurance 
            } else {
                /varset GMStat Mana 
            }
             /if (${Debug}) /echo ...debug ${i} /call CheckStats 1 "${GMName}" "${GMClass}" "${GMType}" ${GMStat} 20 90            
            /call CheckStats 1 "${GMName}" ${GMClass} ${GMType} ${GMStat} 20 90
            /if (${Select[${GMClass},BST,PAL,RNG,SHD]}) /call CheckStats 1 "${GMName}" "${GMClass}" "${GMType}" 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 /bc [+t+]Waiting for >> ${charname} << to med up to ${resume}% ${stat}.[+x+]
        /varset Pulling 0
        /if (${Me.Class.Name.Equal[Bard]} && ${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
            /if (!${Me.Mount.ID} && !${Me.Sitting}) /sit
            /call CheckHealth
            /call CheckForAdds CheckStats
            /call CheckBuffs
            /call DoPetStuff
        /if (${Spawn[${ckclass} ${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 /bc [+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
        /if (${DebugPull}) /echo ... debug_pull AlertClear 
        /if (${DebugPull}) /echo ... debug_pull Clearing Alert list.
        /squelch /alert clear 1
        /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
        /echo Just zoned
        /varset JustZoned 1
        /delay 10s ${Me.ID}
        /timed 20s /varset JustZoned 0
        /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
        /varset ReturnToCamp 0
        /call CombatReset
        /call PullReset
        /varset JustZoned 1
    /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 1
         /timed 20s /varset JoinedParty 0
     /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 /bc [+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 /bc [+w+]${Me.Name} gained an AA, now has ${Me.AAPoints} unspent[+x+]
        } else /if (${Line.Find[LEVEL]}) {
            /docommand /bc [+w+]${Me.Name} gained a level, now is Level ${Me.Level}[+x+]
        } else /if (${Line.Find[GROUP LEADERSHIP]}) {
            /docommand /bc [+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 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 /bc [+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 /bc [+p+] ${FSName} tells Fellowship: ${FSText} [+x+]
    /return      
|----------------------------------------------------------------------------
| SUB: AFK Tools
|----------------------------------------------------------------------------    
    Sub AFKTools
        /if (!${AFKToolsOn} || ${CampZone}!=${Zone.ID}) /return        
        /if (${Debug}) /echo ...debug AFKTools enter
        /varset PCsDetected 0
        /declare i int local
        :PCsGoAway
        /doevents
        /call CheckForAdds AFKTools
        /delay 10
        /if (${Spawn[gm].ID}) {
            /echo GM DETECTED
            /if (${EQBC.Connected} && ${EQBCOn}) /docommand /bc [+r+]** GM DETECTED **[+x+]
            /docommand ${AFKGMAction}
        }
        /if (${Math.Distance[${CampYLoc},${CampXLoc}]} < ${CampRadius} && ${SpawnCount[PC Radius ${AFKPCRadius} zradius 100]}>${SpawnCount[PC group]} && ${Group}) {
            /if (!${PCsDetected}) {
                /echo **PCS DETECTED IN CAMP RADIUS**
                /if (${EQBC.Connected} && ${EQBCOn}) /docommand /bc [+r+]**PCS DETECTED IN CAMP RADIUS**[+x+]
                /for i 1 to ${SpawnCount[PC Radius ${AFKPCRadius} zradius 100]}
                    /if (!${Select[${NearestSpawn[${i},PC Radius ${AFKPCRadius} zradius 100].ID},${Me.ID},${Group.Member[0].ID},${Group.Member[1].ID},${Group.Member[2].ID},${Group.Member[3].ID},${Group.Member[4].ID},${Group.Member[5].ID}]}) {
                        /echo Alien PC is **${NearestSpawn[${i},PC Radius ${AFKPCRadius} zradius 100].CleanName}**
                        /if (${EQBC.Connected} && ${EQBCOn}) /docommand /bc [+r+]Alien PC is **${NearestSpawn[${i},PC Radius ${AFKPCRadius} zradius 100].CleanName}**[+x+]
                    }
                /next i
                /beep
                /delay 2
                /beep
                /delay 2
                /beep
                /varset PCsDetected 1
                /timed 3000 /varset PCsDetected 0
            }
            /delay 5s
            /goto :PCsGoAway
        }
        /if (${Debug}) /echo ...debug AFKTools leave
    /return
|----------------------------------------------------------------------------
| SUB: Burn Section
|----------------------------------------------------------------------------   
    Sub Event_Burn
        /declare i int local
        /echo BURN ACTIVATED => Autobots Transform <=
        /if (${EQBC.Connected} && ${EQBCOn}) /docommand /bc [+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 (${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}].ID}
            /if (${BurnTarget.Equal[Pet]}) /varset BurnTargetID ${Me.Pet.ID}
            /delay 30 ${Cast.Ready[${Burn[${i}]}]} 
            /if (${Burn[${i}].NotEqual[null]} && ${Target.ID}==${MyTargetID}) /call CastWhat "${BurnSpell}" ${BurnTargetID}
        /next i
    /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
|----------------------------------------------------------------------------
    Sub Event_WornOff(string Line, string wospell, string wotarget)
        /if (!${RebuffOn} || ${wotarget.Equal[${Me}]} || ${AggroTargetID}) /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 (${Spell[${wospell}].TargetType.Find[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 300m
        }
        | 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 1m
        /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
                    }
                }
               /doevents
               /delay 5
            /if (${GoMActive} || ${GoMTimer}) /goto :CastGoM
    /return
|----------------------------------------------------------------------------
| SUB: 5point pulling
|----------------------------------------------------------------------------  
    Sub 5PointPull 
        /varset 5PointPullAll ${Ini["KissAssist_Info.ini","${ZoneName}","5PointPulling"]}
    /return
    
| /fgate=/nomodkey /itemnotify ${FindItem[Fellowship Registration Insignia].InvSlot} rightmouseup
 
KissAssist 5.6 Updated 11/13/2012
~ Fixed burn section. It will no longer crash macro. I was drunk or something and didn't finish it.
~ Fixed endless pet shrink loop. I blame Dencelle it was his code.
~ Changed Linux encoding to windows encoding. Should look fine now in notepad.

New File Uploaded
 
KissAssist 5.6 Updated 11/13/2012
~ Fixed burn section. It will no longer crash macro. I was drunk or something and didn't finish it.
~ Fixed endless pet shrink loop. I blame Dencelle it was his code.
~ Changed Linux encoding to windows encoding. Should look fine now in notepad.

New File Uploaded

lol don't blame me... it was me thinking... thats always dangerous... and fairly normal for me to have issues -.- people wonder why i never release my bots.. because 1/2 of them are silly coded..
 
It was working fine until I got son of decay on my sk. Max shrink his height is 1.25 go figure.
 
Yo,the version 5.6 have one line that apparantly been mispelled=)
Line 386?
Should be /target ${Me}instead of /Ttarget ${Me}...

But besides that, Im tusing kissassist in Very Vanilla temp compile 20121112a, yet i always crash when i was in group. Run mac, then instant crash ,the mq window did not even finish the loading setting's from ini.

However, Im able to run it when I was soloing...very weird..
 
Yo,the version 5.6 have one line that apparantly been mispelled=)
Line 386?
Should be /target ${Me}instead of /Ttarget ${Me}...

But besides that, Im tusing kissassist in Very Vanilla temp compile 20121112a, yet i always crash when i was in group. Run mac, then instant crash ,the mq window did not even finish the loading setting's from ini.

However, Im able to run it when I was soloing...very weird..

Thanks for catching the typo. I will upload a new file.

You are crashing because you have a custom UI and Kiss is trying to open your HoTT Window when you are in group.

In your ini file under General change
HoTTOn=1 to HoTTOn=0
and Kiss will no longer try opening your HoTT window.

I reset the feature to default to HoTTOn=0 with new ini files.
 
Re: KissAssist 5.4 Updated 10/28/2012

Thank you very much Maskoi! This macro is incredible.

I have found one issue and have one suggestion (at this point :-) )

When range pulling with a ranger (PullerTank), the ranger makes a headshot and drops the mob on the pull shot. The ranger then just sits there not knowing what to do. It does not change target nor does it move back to camp. It would be nice if it looted and returned to camp.

A suggestion with the new tradeskill bags. If the loot.ini was specific to a PC, two PC's could loot with one only picking up tradeskills and the other picking up vendor trash. This would create a much better farming situation.

I looked into headshot. Coding Kiss to deal with head shot makes no sense really for pulling. If you kill mobs while pulling with your bow the solution is simple pull with something else. Rangers have mentioned burst of fire or cancel magic work really well.
 
Hi,
You will find attached my version.
There there is a feature that do pet toys.
It works fine on my magician lvl 85.

Config example :

[Pet]
PetOn=1
PetSpell=Aspect of Air
PetFocus=Elegant Summoner's Earring|rightear
PetShrinkOn=1
PetShrinkSpell=Tiny Companion
PetBuffsOn=1
PetBuffs1=Burnout VIII
PetBuffs2=Iceflame Efflux
PetBuffs3=Aegis of Kildrukaun
PetBuffs4=NULL
PetBuffs5=NULL
PetBuffs6=NULL
PetBuffs7=NULL
PetBuffs8=NULL
PetToysOn=1
PetToys1=Summon Ethereal Armaments
PetToys2=Summon Plate of the Prime
PetToys3=Summon Muzzle of Mowcha
PetToys4=Summon Zabella's Heirlooms
PetToys5=NULL
PetToys6=NULL
PetToys7=NULL
PetToys8=NULL
PetToys9=NULL
PetToys10=NULL
 

Attachments

Still getting issues with casters not targeting correctly after issue burn command

Try this line 754 ish Red in the example below change to new line in Blue
Line in Bold Red
Rich (BB code):
                /call CheckCasting
            :skipcast
            /if (${DebugCombat}) /echo ${DPS[${i}]} ${Macro.Return} DPSTimer${i} ${DPSTimer${i}}
            | 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}
            }
            /if (${Select[${DPSText.Arg[3,|]},Me,MA]}) /call CombatTargetCheck
        /next i
        /if (${DebugCombat}) /echo CombatCast: Leave
    /return
Change/Cut and paste in new line in Bold Blod. Note new position.
Rich (BB code):
                /call CheckCasting
            :skipcast
            /if (${DebugCombat}) /echo ${DPS[${i}]} ${Macro.Return} DPSTimer${i} ${DPSTimer${i}}
            /if (${Select[${DPSText.Arg[3,|]},Me,MA]} || ${TargetID}!=${MyTargetID}) /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
 
Re: KissAssist 5.4 Updated 10/28/2012

Hi Maskoi,

Thanks for looking at this.

There are a couple of advantages to pulling with a bow. Rangers enjoy low social activity when pulling with a bow in many animal areas. Range with a bow is much greater than a spell. It is also faster than running to the mob and back which increases kill rates. I am now pulling with melee but I keep dying when I am so far away from the healer since mq2melee locks me at the site of the pull sometimes (very intermittent).

If at some point you can readdress this, it would be appreciated but I'll try the spells.

Thanks again.


I looked into headshot. Coding Kiss to deal with head shot makes no sense really for pulling. If you kill mobs while pulling with your bow the solution is simple pull with something else. Rangers have mentioned burst of fire or cancel magic work really well.
 
Try pulling with Burst of Fire range 200. Melee is default and its really only meant for hunter mode.

Also download 5.6 the fighting mob at pull thing was fixed.
 
The casting is working but I do miss my 350 range a bit. Thanks, that tip I can work with.

I'm running 5.6 and it is still killing at the mob on occasion. It will cast then fight the mob from where it cast before returning to camp for the next mob. The mob that loots will run 300 to the corpse, loot, then sit in the middle of the mobs and try to buff itself before it runs back to the camp. Needless to say this causes a little aggro. Can the loot radius be limited to 50 anywhere? The puller also will kill and then buff before running back to camp.

For the most part this runs for hours without a hitch but the loot issue is so frequent sometimes things get dicey.
 
loot.ini has range for looting. PM me your ini file for your ranger
 
I just noticed that clickies in bags will not click even if they are on the hotbar. Is there a workaround?

Thanks

Do you have the mq2bagwindow.xml file in your eq ui folder?
Do you have MQ2BagWindow loaded?
Do you have VoA? If not you need an open top inventory slot.

Clicking items in bags are working fine.
 
Hi Maskoi,

Thanks for the response. Yes, I have mq2bagwnd in my EQ uifiles folder. MQ2BagWindow is loaded. I have VoA. I can manually click on items in the bag but they do not click in the KissAssist macro even though it reports "Clicking > Aurora, the Heartwood Blade" . Any item equipped clicks fine in the macro.
 
Is there a way to get the macro to wait for the merc to remed before pulling the next mob? It will wait for other boxes to med but not the merc. My healer merc is running out of juice on me on chain pulls.
 
It should recognize mercs as well as players for group watch. Sounds like you having a lot of Mq2 issues in general have you downloaded the latest compile?
 
Yep, 11/12. Kissassist 5.6 and I deleted the 5.4 in the ini file so it updated the ini. I am going to try a full patch verification. On one instance running a ranger at the MT,MA,Puller, it sits and meds whenever anyone is low but on the other instance running another ranger it does not stop for the merc. This is running 2 accounts on the same machine with rangers pulling,tanking at the same time in different zones. KissAssist 5.6 .
 
KissAssist Release KissAssist 5.6 Updated 11/13/2012

Users who are viewing this thread

Back
Top
Cart