Public Macros chanter macro wont stay sitting to med.
Reply
chanter macro wont stay sitting to med.
Anyone good with macros and want to look at this and see if you able to find problem chanter wont stay sitted to med. goes into sit and stand over and over routine.

More +
| AutoEnchanter.mac
| By Rusty~
| Update Jan. 27 2008 by Nils
| Update Mar. 12 2010 by TreeHuginDruid/Aborianus
| Updated Sep. 7 2010 by Botlove
| Version 1.72b


#include Spell_Routines.inc
#include QuickBeg.inc
#include Move.inc

#turbo 40

#chat tell

#event AutoStun               "[MQ2] AutoStun #1#"
#event Bewilderment           "#1# is bewildered by blinding light."
#event Camp                   "It will take#*#seconds to prepare your camp#*#"
#event CastSpell              "[#1#] cast #2#"
#event CastSpell              "[#1#] cast #2# on #3#"
#event CastSpell              "#1# tells you, 'cast #2#'"
#event CastSpell              "#1# told you, 'cast #2#'"
#event CastSpell              "#1# tells you, 'cast #2# on #3#'"
#event CastSpell              "#1# told you, 'cast #2# on #3#'"
#event ChatTell               "#1# told you, '#2#'"
#event Command                "#*#'/#1# pass#*#:#2#'"
#event Consider_Ally          "#1# regards you as an ally#*#"
#event Consider_Warmly        "#1# looks upon you warmly#*#"
#event Consider_Kindly        "#1# kindly considers you#*#"
#event Consider_Amiable       "#1# judges you amiably#*#"
#event Consider_Indifferent   "#1# regards you indifferently#*#"
#event Consider_Apprehensive  "#1# looks your way apprehensively#*#"
#event Consider_Dubious       "#1# glowers at you dubiously#*#"
#event Consider_Threatening   "#1# glares at you threateningly#*#"
#event Consider_ReadyToAttack "#1# scowls at you, ready to attack#*#"
#event DamageMelee            "|${Me.Pet.DisplayName}| #*# for #1# points of damage#*#"
#event DamageMelee            "You #*# for #1# points of damage#*#"
#event DamageNonMelee         "|${Me.Name}| hit #*# for #1# points of non-melee damage#*#"
#event Dead                   "Returning to home point, please wait..."
#event Dead                   "#*#Returning to Bind Location#*#"
#event Dispell                "[MQ2] Dispell"
#event EQBC                   "<#1#> #2#"
#event EQBC                   "[#1#(msg)] #2#"
#event ExcludeMob             "#*# excludemob #1#"
#event Exp                    "You gain #*#"
#event Gate                   "|${Target.DisplayName}| begins to cast the gate spell#*#"
#event Gate                   "|${Target.DisplayName}| begins to cast a spell. <Complete Heal>#*#"
#event GiftofAmaExqRadMana    "You have been granted a gift of amazing exquisite radiant mana#*#"
#event GiftofExqRadMana       "You have been granted a gift of exquisite radiant mana#*#"
#event GiftofMana         "You have been granted a gift of mana#*#"
#event GiftofRadMana          "You have been granted a gift of radiant mana#*#"
#event Hit                    "#*# YOU for #*#"
#event Hit                    "#*# YOU, but #*#"
#event Indoors                "You can only cast this spell in the outdoors#*#"
#event Indoors                "You can not summon a mount#*#"
#event Indoors                "You need to be in a more open area to summon a mount#*#"
#event Invis                  "[MQ2] Invis"
#event Invited                "#*#click on the 'FOLLOW' option, or 'DISBAND' to cancel#*#"
#event Invited                "#*#invites you to join a group.#*#"
#event LeviGroup              "#*# levigroup"
#event ManaRobe               "[MQ2] Mana Robe #1#"
#event Mez                    "[MQ2] mez"
#event NukeType               "[MQ2] NukeType #1#"
#event RageOff                "#*#is no longer enraged#*#"
#event RageOn                 "#*#has become ENRAGED#*#"
#event RaidBuff               "#*# raidbuff #1#"
#event RaidSay                "#1# tells the raid,  '#2#'"
#event SayZone                "#*# sayzone #1#"
#event SetAnchor              "[MQ2] SetAnchor #1#"
#event SetMA                  "[ma] [Down:/assist #1#] [Up:#*#"
#event SetSA                  "[sa] [Down:/assist #1#] [Up:#*#"
#event Summon                 "You have been summoned!"
#event ToggleVar              "[MQ2] ToggleVar #1#,#2#,#3#,#4#,#5#"
#event ToggleString           "[MQ2] ToggleString #1#,#2#,#3#,#4#,#5#"
#event UquaAE                 "Your body is surrounded by a darkened aura."
#event UquaKey                "The #1# Key must unlock the door to the next room."
#event WornOff                "#*#Your #1# spell has worn off of #2#."
#event Zone                   "You have entered #1#."
#event Zone                   "LOADING, PLEASE WAIT..."


|--------------------------------------------------------------------------------
|SUB: Main
|--------------------------------------------------------------------------------
Sub Main

  /call PluginCheck

  /declare Version string outer 1.72
  /declare iniName string outer AutoEnc_${Me.Name}.ini
  /call LoadIni "AutoEnc_${Me.Name}.ini" LOAD 
  /declare excludeIni string outer AutoEnc_${Me.Name}_Exclude.ini
  /declare mezzImmuneIni string outer AutoEnc_${Me.Name}_MezzImmune.ini
  /MemSpellSet ${spellSet}
  /if (${Version.NotEqual[${Ini[AutoEnc_${Me.Name}.ini,Misc,Version]}]}) /call LoadAliases
  /squelch /custombind add ma
  /squelch /custombind add sa
  /declare i int local
  /declare j int local
  /declare oldTarget int local
  /declare tempTimer timer local 0
  /declare tempStr string local
  /declare ConsiderReturn int outer

  /popup Loading AutoEnchanter version v${Version}.
  /echo Loading AutoEnchanter version v${Version}.
 
  /call SetAssist
 
  :check_params
  /if (${Defined[Param${i}]}) {
    /if (${Param${i}.Equal[ma]}) {
      /varcalc i ${i}+1
      /call SetIniVar mainAssist Settings "${Param${i}}"
    } else /if (${Param${i}.Equal[sa]}) {
      /varcalc i ${i}+1
      /call SetIniVar secondAssist Settings "${Param${i}}"
    } else /if (${Param${i}.Equal[radius]}) {
      /varcalc i ${i}+1
      /call SetIniVar minRadius Settings "${Param${i}}"
    } else /if (${Param${i}.Equal[minhp]}) {
      /varcalc i ${i}+1
      /call SetIniVar minHP Settings "${Param${i}}"
    } else /if (${Param${i}.Equal[buff]}) {
      /call SetIniVar autoBuff Settings 1
    } else /if (${Param${i}.Equal[nobuff]}) {
      /call SetIniVar autoBuff Settings 0
    } else /if (${Param${i}.Equal[nuke]}) {
      /call SetIniVar nukeMode Settings 1
    } else /if (${Param${i}.Equal[nonuke]}) {
      /call SetIniVar nukeMode Settings 0
    } else /if (${Param${i}.Equal[mez]}) {
      /call SetIniVar useMez Settings TRUE
    } else /if (${Param${i}.Equal[nomez]}) {
      /call SetIniVar useMez Settings FALSE
    } else /if (${Param${i}.Equal[debuff]}) {
      /call SetIniVar useDebuff Settings TRUE
    } else /if (${Param${i}.Equal[nodebuff]}) {
      /call SetIniVar useDebuff Settings FALSE
    }
    /varcalc i ${i}+1
    /goto :check_params
  }
  /if (!${Me.Gem[${mezSpell}]}) {
    /if (${Me.Gem[bliss]}) {
      /call SetIniVar mezSpell Spells Bliss
    } else /if (${Me.Gem[sleep]}) {
      /call SetIniVar mezSpell Spells Sleep
    } else /if (${Me.Gem[apathy]}) {
      /call SetIniVar mezSpell Spells Apathy
    } else /if (${Me.Gem[glamour of kintaz]}) {
      /call SetIniVar mezSpell Spells "Glamour of Kintaz"
    } else /if (${Me.Gem[felicity]}) {
      /call SetIniVar mezSpell Spells Felicity
    } else /if (${Me.Gem[euphoria]}) {
      /call SetIniVar mezSpell Spells Euphoria
    } else /if (${Me.Gem[bewilderment]}) {
      /call SetIniVar mezSpell Spells Bewilderment
    } else /if (${Me.Gem[bewilderment Rk. II]}) {
      /call SetIniVar mezSpell Spells "Bewilderment Rk. II"
    } else /if (${Me.Gem[bewilderment Rk. III]}) {
      /call SetIniVar mezSpell Spells "Bewilderment Rk. III"
    } else /if (${Me.Gem[Mystify]}) {
      /call SetIniVar mezSpell Spells Mystify
    } else /if (${Me.Gem[Mystify Rk. II]}) {
      /call SetIniVar mezSpell Spells "Mystify Rk. II"
    } else /if (${Me.Gem[Mystify Rk. III]}) {
      /call SetIniVar mezSpell Spells "Mystify Rk. III"           
    }
  }
  /if (!${InvSlot[chest].Item.Name.Equal[mana robe]}) /call SetIniVar hpRobe Items "${InvSlot[chest].Item.Name}"
  /call QuickBegDeclares
  /call SwapStatFood 1
  /squelch /alert clear 6
  /if (${autoAnnounce}) /squelch /announce on
  /echo Auto Enchanter Mode Activated v${Version}.
  /popup Auto Enchanter Mode Activated v${Version}.
  /if (${nukeMode} || ${useDebuff} || ${useMez}) {
    /echo Main Assist: ${mainAssist}
    /if (${Bool[${secondAssist}]}) /echo Secondary Assist: ${secondAssist} (if ${mainAssist} dies)
  }
  /if (${nukeMode}) /echo Nuke Mode: ${nukeMode}
  /if (${useDebuff}) /echo Auto Debuffs Enabled
  /if (${useMez}) {
    /echo Auto Mez adds within a radius of ${minRadius}
    /if (!${Me.Gem[${mezSpell}]}) /memspell ${mezGem} "${mezSpell}"
  }
  /if (${autoBuff}) /echo AutoBuff Mode: ${autoBuff}
  /if (${useMount}) /echo Mount is enabled.
  /if (${manaRobeMode}) /echo ManaRobe Mode: ${manaRobeMode}
  :wait_for_target
  /if (${Me.State.Equal[HOVER]} || ${Me.Type.Equal[DEAD]} || ${Window[RespawnWnd].Open} || ${SpawnCount[PC ${Me.Name}]}<1 || ${GameState.Equal[CHARSELECT]}) /end
  /if (${nukeMode} || ${useDebuff} || ${useMez}) /echo Waiting for target...
  /varset newAdds 0
  /varset validTarget 0
  :invis_loop
  /if (${Me.Invis}) {
     /delay 1
     /doevents
     /delay 1
     /doevents Chat
     /goto :invis_loop
  }
  :wait_for_target2
  /if (${Spawn[pc ${secondAssist}].ID} && (!${Spawn[pc ${mainAssist}].ID} || ${Spawn[Corpse ${mainAssist} radius ${minRadius}].ID})) {
    /varset mainTank ${secondAssist}
  } else {
    /varset mainTank ${mainAssist}
  }
  /if (!${Corpse.Open} && ${Spawn[${mainAssist}].NearestSpawn[npc radius ${Math.Calc[${minRadius}*2]}].ID} && (${nukeMode} || ${useDebuff} || ${useMez})) {
    /if (${Me.Casting.ID}) /call WaitCast
    /assist ${mainTank}
    /if (${useManaRobe}) /call ManaRobe
    /varset oldTarget ${Target.ID}
    /varset tempTimer 5
    /call CheckRune 100
    :wait_for_assist1
    /call CheckTarget
    /if (${tempTimer} && !${validTarget}) /goto :wait_for_assist1
  }
  /call CheckTarget
  /if (!${validTarget} || (!${nukeMode} && !${useDebuff} && !${useMez})) { 
    /doevents
    /if (!${qbTimer} && ${begForBuffs} && !${following}) {
      /call MeBegBuff
|     /call MeBegItem
      /call MeBegCure
      /call PetBegBuff
      /varset qbTimer 30s
      }
    /if (${Window[TradeWnd].Open}) /nomodkey /notify TradeWnd TRDW_Trade_Button leftmouseup
 |xxxxxx botlove doesnt want to buff while in combat
    /if (!${Me.CombatState.Equal[COMBAT]}) {
       /if (${RaidQueueCount} && ${Me.PctMana}>${doBuffMana} && ${DoRaidBuffs}) /call RaidBuffEvents
       /call CheckBuffs
       /call CheckPet
       /call CheckRune ${runeHP}
       }
    /if (${useAnchor}) /call CheckLoc
    /if (${useManaRobe}) /call ManaRobe
    /goto :wait_for_target2
  }
  /echo Target Aquired >> ${Target.DisplayName} <<
  /varset petAttacking false
  /varset engaged 0
  /varset nukeWaitTimer 0
  /varset mobID ${Target.ID}
  /varset mobHPStart ${Target.PctHPs}
  /call UpdateMobList
  /call AddToList mobList ${mobID}
  /if (${Defined[bewildermentTimer${mobID}]}) /deletevar bewildermentTimer${mobID}
  /if (${Defined[mezTimer${mobID}]}) /deletevar mezTimer${mobID}
  /declare mezTimer${mobID} int outer -1
  /varset newAdds 0
  /varset nukeWaitTimer 0
  /varset fightStartTime 0
  /varset totalNonMeleeDmg 0
  /varset totalMeleeDmg 0
  /if (${Defined[waitTimer${mobID}]}) /deletevar waitTimer${mobID}
  /declare waitTimer${mobID} int outer -1
  :check_add_loop
  /if ((${Target.PctHPs}>${minHP} && ${waitTimer${mobID}}) || !${assistWaitTimer}) {
    /if (${Spawn[pc ${secondAssist}].ID} && (!${Spawn[pc ${mainAssist}].ID} || ${Spawn[Corpse ${mainAssist} radius ${minRadius}].ID})) {
      /varset mainTank ${secondAssist}
    } else {
      /varset mainTank ${mainAssist}
    }
    /if (${Me.Casting.ID}) /call WaitCast
    /assist ${mainTank}
    /if (${useManaRobe} && (${refreshTime} || ${nukeWaiTimer} || !${nukeMode})) /call ManaRobe
    /varset tempTimer 8
    :wait_for_assist
    /call CheckForAdds
    /doevents Timer
    /if (${tempTimer} && ${Target.ID}==${mobID}) /goto :wait_for_assist
    /if (${Target.ID} && ${Target.ID}!=${mobID}) {
       /if (${Defined[bewildermentTimer${mobID}]}) /deletevar bewildermentTimer${mobID}
      /if (${Defined[mezTimer${mobID}]}) /deletevar mezTimer${mobID}
      /call DeleteFromList mobList ${mobID}
      /goto :wait_for_target
    }
    /varset assistWaitTimer 5s
  }
  /varset addIndex 1
  :check_add_loop2
  /call CheckForAdds
  /if (${addIndex}>1) /goto :check_add_loop2
  /if (${newAdds}) /call MezAdds
  /call CheckPet
  /if (!${Spawn[${mobID}].Type.Equal[NPC]} && !${Spawn[${mobID}].Type.Equal[pet]}) /goto :mob_dead
  /if (!${nukeMode} && !${useDebuff} && !${useMez}) /goto :wait_for_target
  /target id ${mobID}
  /delay 1s ${Target.ID} == ${mobID}
  /delay 1
  /if ((${Target.PctHPs}<${mobHPStart}) && ${Spawn[pc ${mainTank}].NearestSpawn[radius ${Math.Calc[${Spawn[${mobID}].MaxRangeTo}+10]} id ${mobID}].ID} && ${waitTimer${mobID}}<0  && ${Spawn[${mobID}].Distance3D}<=${minRadius}) {
    /deletevar waitTimer${mobID}
    /declare waitTimer${mobID} timer outer ${engageDelay}
  }
  /doevents
  /target id ${mobID}
  /delay 1s ${Target.ID} == ${mobID}
  /delay 1
  /if (${Target.PctHPs}>${minHP} && ${waitTimer${mobID}}) /goto :check_add_loop
  /if (${newAdds}) /call MezAdds
  /if (!${engaged}) {
    /varset engaged 1
    /echo Engaging >> ${Target.DisplayName} <<
    /face fast nolook
  }
  /if (${Me.Pet.ID} && !${petAttacking} && !${Me.PetBuff[word of worell]}) {
    /pet attack
    /varset petAttacking true
  }
  /call UpdateMobList
  /doevents Timer
  /if (${useDebuff} && !${newAdds}) /call DebuffMobs
  /if (${Spawn[${mobID}].Type.Equal[NPC]} || (!${Spawn[${mobID}].Master.Type.Equal[PC]} && ${Spawn[${mobID}].Type.Equal[pet]})) {
    /target id ${mobID}
    /delay 1s ${Target.ID} == ${mobID}
    /delay 1
  } else {
    /goto :mob_dead
  }
  /if (!${newAdds} && (${slowTimer${mobID}} != 0 || !${useDebuff} || (!${useSlow} && ${nukeMode}))) {
    |xxxxxx botlove doesnt want to buff while in combat
    |also wwant to ensure we are really medding as much as possible after buffing
    /if (!${Me.CombatState.Equal[COMBAT]}) {
       /call CheckRune 100
       /call CheckBuffs
    /call Medding
       }
    /target id ${mobID}
    /delay 1s ${Target.ID} == ${mobID}
    /delay 1
    /if (${Target.Type.Equal[npc]} && (${Target.Class.CanCast} || ${Zone.ID}>=300 )) {
      /if (${Me.SpellReady[Scryer's Trespass]}) /call Cast "Scryer's Trespass" spell 0 CheckForAdds
      /if (${Me.SpellReady[Theft of Thought]}) /call Cast "Theft of Thought" spell 0 CheckForAdds
    }
    /target id ${mobID}
    /delay 1s ${Target.ID} == ${mobID}
    /delay 1   
    /if (${DoDots} && ${Target.Distance}<=220 && ${Target.PctHPs}>${DotMinHPs} && ${Target.PctHPs}<=${DotAt} && ${Target.LineOfSight}) /call Dot       
    /if (${useStun} && ${Target.Distance}<=220 && ${Target.LineOfSight}) /call AutoStun   
    /if (${refreshTime}<20 && (${Target.PctHPs}<${mobHPStart} || ${minHP}==100) && !${newAdds} && ${Target.LineOfSight} && !${Me.TargetOfTarget.Name.Equal[${Me.Name}]} && !${nukeWaitTimer} && (${nukeMode} || ${nukeMode}==2) && (${Target.Type.Equal[NPC]} || ${Target.Type.Equal[pet]})) {
      /if (!${fightStartTime}) /varset fightStartTime ${MacroQuest.Running}
      /delay 1
      /if (${useManaFlare} && ${Me.SpellReady[${manaFlareSpell}]} && (${Me.Buff[${manaFlareSpell}].Duration} <=5)) {
         /target id ${Me}
         /delay 1s ${Target.ID} == ${Me.ID}
         /call Cast "${manaFlareSpell}" ${manaFlareGem} CheckForAdds
        /delay 1
        /target id ${mobID}
        /delay 1s ${Target.ID} == ${mobID}
      }
      |-------------------------------------
      /if (${useMindShatter} && ${Me.SpellReady[${mindShatterSpell}]} && (${Me.Buff[Mind Shatter Recourse].Duration}<=0 || ${Me.Buff[Mind Oscillate Recourse].Duration}<=0)) /call cast "${mindShatterSpell}" ${mindShatterGem} 0 CheckForAdds
      /if (${Me.PctMana}>=${nuke1minmana} && ${Target.Distance}<=${Spell[${nuke1}].MyRange} && ${Me.SpellReady[${nuke1}]} && ${Target.PctHPs}>${nuke1hpstop} && ${Target.PctHPs}<${nuke1hpstart} && (!${Defined[bewildermentTimer${mobID}]} || (${Defined[bewildermentTimer${mobID}]} && ${Spawn[${mobID}].PctHPs}<75))) {
        /if (${announce} && !${spamDelay}) /${chatChannel} ${nuke1} on >> >> ${Target.CleanName} << <<
        /varset spamDelay (${nukeDelay}-25)
        /delay 1
        /call Cast "${nuke1}" ${nuke1Gem} 0 CheckForAdds
      /goto :castednuke
      }
      |-------------------------------------
      /if (${Me.PctMana}>=${nuke2minmana} && ${Target.Distance}<=${Spell[${nuke2}].MyRange} && ${Me.SpellReady[${nuke2}]} && ${Target.PctHPs}>${nuke2hpstop} && ${Target.PctHPs}<${nuke2hpstart} && (!${Defined[bewildermentTimer${mobID}]} || (${Defined[bewildermentTimer${mobID}]} && ${Spawn[${mobID}].PctHPs}<75))) {
        /if (${announce} && !${spamDelay}) /${chatChannel} ${nuke2} on >> >> ${Target.CleanName} << <<
        /varset spamDelay (${nukeDelay}-25)
        /delay 1
        /call Cast "${nuke2}" ${nuke2Gem} 0 CheckForAdds
      /goto :castednuke
      }
      /if (${useManaRobe}) /call ManaRobe
      :castednuke
      /if (${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_RESISTED]}) {
        /if (${nukeMode}==1) {
          /varcalc nukeWaitMod 5*(90 - ${Me.PctMana})
        } else {
          /varset nukeWaitMod 0
        }
        /if (${nukeDelay}>${nukeWaitMod}) {
          /varset nukeWaitTimer ${nukeDelay}
        } else {
          /varset nukeWaitTimer ${nukeWaitMod}
        }
      }
    } else {
      /if (${useManaRobe}) /call ManaRobe
    }
  }
  /goto :check_add_loop
  :mob_dead
  /call UpdateMobList
  /echo Target Dead!
  /if (${Me.Pet.ID} && ${Me.AltAbility[Pet Discipline]}) /pet hold
  /if (${cleanUp}) /call CleanUp ${mobID}
  /doevents
  /if (${useDPS}) /call DisplayDPS
  /call DoClickies
  /memspellset ${spellSet}
  /goto :wait_for_target
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckForAdds
|--------------------------------------------------------------------------------
Sub CheckForAdds
  /if (${Me.Feigning}) /stand
  /if (${Me.Casting.ID}) {
    /doevents gate
    /doevents rageon
    /doevents rageoff
    /doevents uquakey
    /if (${castEndTime}>5) /doevents EQBC chat
  }
  /if (${Target.ID}==${mobID} && ${Me.TargetOfTarget.Type.Equal[pc]} && ${Me.TargetOfTarget.Class.Name.Equal[cleric]} && ${Me.TargetOfTarget.PctHPs}<=50 && ${Me.AltAbilityReady[Soothing Words]}) {
    /if (${Me.TargetOfTarget.ID}==${Group.Member[1].ID} || ${Me.TargetOfTarget.ID}==${Group.Member[2].ID} || ${Me.TargetOfTarget.ID}==${Group.Member[3].ID} || ${Me.TargetOfTarget.ID}==${Group.Member[4].ID} || ${Me.TargetOfTarget.ID}==${Group.Member[5].ID}) {
      /if (${Me.Casting.ID} && !${Me.Casting.Name.Equal[${mezSpell}] && !${Me.Casting.Name.Equal[${AEmezSpell}]} && !${Me.Casting.Name.Equal[${PBAEmezSpell}] && !${Spawn[${petID}].Type.Equal[NPC]}) /call Interrupt
      /call Cast "soothing words" alt
    }
  }
  /if (${useCharm}) /call CheckPet2
  :check_add_loop
  /if (!${Spawn[${mobID}].Type.Equal[NPC]} && !${Spawn[${mobID}].Master.Type.Equal[NPC]} && !${petOff} || ${ExcludeList.Find[${Spawn[${mobID}]}].Name}) {
    /varset addIndex 1
    /varset newAdds 0
    /return
  }
  /if (${petCheck}) {
    /varset addID ${NearestSpawn[${addIndex},npc radius ${minRadius}].ID}
  } else {
    /varset addID ${NearestSpawn[${addIndex},pet radius ${minRadius}].ID}
  }
  /if (${addID}) {
    /if ((${mezTimer${addID}}<=${Math.Calc[${mezDuration}-50]} || !${mezTimer${addID}}) && ${Spawn[${addID}].Distance3D}<=${minRadius} && ${addID}!=${petID} && ${Spawn[${addID}].LineOfSight} && ${aggroAnim.Find[|${Spawn[${addID}].Animation}|]} && ${mezTimer${addID}}!=-1 && ((!${Spawn[${addID}].Master.Type.Equal[PC]} && ${Spawn[${addID}].Type.Equal[pet]}) || (${Spawn[${addID}].Type.Equal[NPC]} && ${addID}!=${Spawn[${mobID}].Master.ID}))) {
      /call AddToList addList ${addID}
      /call AddToList mobList ${addID}
      /if (${Macro.Return.Equal[1]}) {
        /if (!${Defined[waitTimer${addID}]}) /declare waitTimer${addID} timer outer ${engageDelay}
        /echo Add detected! >> ${Spawn[${addID}].DisplayName} <<
        /if (${mezzImmuneList.Find[${Spawn[${addID}].DisplayName}]} && ${announce}) /${chatChannel} ${Spawn[${addID}].DisplayName} CANNOT BE MEZZED!  OFFTANK!
      }
      /varset newAdds 1
    }
    /varcalc addIndex ${addIndex}+1
  } else {
    /varcalc petCheck !${petCheck}
    /varset addIndex 1
  }

/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckPet
|--------------------------------------------------------------------------------
Sub CheckPet
  /if (!${FindItem[${normalOffhand}].ID} && ${InvSlot[offhand].Item.ID}) /varset normalOffhand ${InvSlot[offhand].Item.Name}
  /doevents rageon rageoff
  /declare i int local
  /declare tempID int local
  /call CheckPet2
  /if (${petOff}) {
    /if (${useCharm}) {
      /call Charm ${petID}
    }
  }
  /for i 1 to ${Group}
    /varset tempID ${Group.Member[${i}].Pet.ID}
    /if (${tempID}) {
      /if (!(${slowTimer${tempID}}<0)) {
        /if (${Defined[mezTimer${tempID}]}) /deletevar mezTimer${tempID}
        /if (${Defined[slowTimer${tempID}]}) /deletevar slowTimer${tempID}
        /if (${Defined[tashTimer${tempID}]}) /deletevar tashTimer${tempID}
        /if (${Defined[crippleTimer${tempID}]}) /deletevar crippleTimer${tempID}
        /if (${Defined[bewildermentTimer${tempID}]}) /deletevar bewildermentTimer${tempID}
        /declare mezTimer${tempID} int outer -1
        /declare tashTimer${tempID} int outer -1
        /declare slowTimer${tempID} int outer -1
        /declare crippleTimer${tempID} int outer -1
        /declare bewildermentTimer${tempID} int outer -1
      }
    }
  /next i
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckPet2
|--------------------------------------------------------------------------------
Sub CheckPet2
  /if (${Zone.ID}!=${currentZone}) /call Event_Zone
  /if (${petOff} && ${Me.Pet.ID}) {
    /varset petOff 0
    /if (!${addList.Find[[]}) /varset newAdds 0
  }
  /if (${Spawn[${petID}].Type.Equal[NPC]} && !${petOff} && ${useCharm} && ${petID}) {
    /echo Pet Off!
    /varset petAttacking false
    /varset newAdds 1
    /varset petOff 1
    /if (${useCharm} && ${Me.Casting.ID} && ${useMez} && ${newAdds} && !${Me.Casting.Name.Equal[${mezSpell}]} && !${Me.Casting.Name.Equal[${pbaeMezSpell}]} && !${Me.Casting.Name.Equal[${tashSpell}]} && !${Me.Casting.Name.Equal[${charmSpell}]}) /call Interrupt
    /if (${useCharm}) {
      /beep
      /timed 7 /g PET OFF!! snare/malo pls!
      /target id ${petID}
    }
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: MezAdds
|--------------------------------------------------------------------------------
Sub MezAdds
  /if (!${useMez}) {
    /varset newAdds 0
    /return
  }
  /declare tempID string local
  /declare AEmezzed int local 0
  :mez_adds_loop
  /if (${addList.Find[[]}) {
    /if (${addList.Find[[]}>1) /varset addList ${addList.Right[-${Math.Calc[${addList.Find[[]}-1]}]}
    /if (!${Spawn[${mobID}].Type.Equal[NPC]} && !${Spawn[${mobID}].Master.Type.Equal[NPC]}) /return
    /varset tempID ${addList.Arg[1,[].Left[-1]}
    /if (${mezzImmuneList.Find[${Spawn[${tempID}].DisplayName}]}) {
       /call DeleteFromList addList ${tempID}
       /goto :mez_adds_loop
     }
    /if (!${Spawn[${tempID}].Type.Equal[NPC]} && !${Spawn[${tempID}].Master.Type.Equal[NPC]}) {
      /if (${Defined[mezTimer${tempID}]}) /deletevar mezTimer${tempID}
      /if (${Defined[slowTimer${tempID}]}) /deletevar slowTimer${tempID}
      /if (${Defined[tashTimer${tempID}]}) /deletevar tashTimer${tempID}
      /if (${Defined[crippleTimer${tempID}]}) /deletevar crippleTimer${tempID}
      /if (${Defined[bewildermentTimer${tempID}]}) /deletevar bewildermentTimer${tempID}
    } else {
      /squelch /target id ${tempID}
      /delay 5 ${Target.ID} == ${tempID}
      /delay 5
      /face fast nolook
   /if (${addList.Count[[]}>1) {
      /echo Detected 2 or more adds!!
         /delay 5s !${Me.Casting.ID}
      /delay 2s (${Me.SpellReady["${pbaeMezSpell}"]} || ${Me.SpellReady["${aeMezSpell}"]})
         /if (${NearestSpawn[2,npc radius 30 range 1 ${maxPBAEMezLevel}].ID} && ${Me.SpellReady["${pbaeMezSpell}"]} ) {
            /echo Casting ${pbaeMezSpell}
         /call Cast "${pbaeMezSpell}" ${pbaeMezGem}
            }
   | xxxxxxxx botlove added next if block for mobs outside range 30
      |          also modified if block above to use pb not ae
      | yyyyyyyyy  removed aemezzed var since it seemed broken
      |            need to create method for avoiding casting docility
      |            on mobs that have non-overwritable mez already
         /if (${Target.NearestSpawn[1,npc radius 35 range 1 ${maxAEMezLevel}].ID} && ${Target.Distance3D} > 35 && ${addList.Count[[]} > 1 && ${Me.SpellReady["${aeMezSpell}"]}) {
            /echo Casting ${aeMezSpell} on >> >> ${Target.CleanName} << <<
            /call Cast "${aeMezSpell}" ${aeMezGem} AEMezSafety
            }
      }
      /echo Calling Mez on ${Target.DisplayName} with ID: ${Target.ID} from mez adds
      /call Mez
    }
    /call DeleteFromList addList ${tempID}
    /goto :mez_adds_loop
  }
  /varset newAdds 0
/return
|--------------------------------------------------------------------------------

| xxxxxxxxxx botlove had to add this sub to make sure we dont mez ourselves with ae mez
|--------------------------------------------------------------------------------
|SUB: AEMezSafety
|--------------------------------------------------------------------------------
Sub AEMezSafety
/if ${Spawn[${tempID}].Distance3D} < 33 /call Interrupt
/return
|--------------------------------------------------------------------------------

|--------------------------------------------------------------------------------
|SUB: DebuffMobs
|--------------------------------------------------------------------------------
Sub DebuffMobs
  /declare i int local
  /declare tempID string local
  /if (${mobList.Find[[]}) {
    /if (${mobList.Find[[]}>1) /varset mobList ${mobList.Right[-${Math.Calc[${mobList.Find[[]}-1]}]}
    /for i 1 to ${mobList.Count[[]}
      /varset tempID ${mobList.Arg[${i},[].Left[-1]}
      /if (!${Defined[slowTimer${tempID}]}) {
        /if (!${Spawn[${tempID}].Type.Equal[npc]}) {
          /declare slowTimer${tempID} int outer 0
        } else /if (((!${waitTimer${tempID}} || ${mezTimer${tempID}}>0) && (${slowTimer${mobID}} || ${waitTimer${mobID}})) || ${tempID}==${mobID}) {
          /call UpdateMobList
          /doevents Timer
          /target id ${tempID}
          /delay 1s ${Target.ID}==${tempID}
          /delay 1
          /if (!${tashTimer${tempID}} && ${useTash}) /call Tash
          /if (${newAdds}) /return
          /if (${useSlow}) /call Slow
          /if (!${useSlow}) {
             /if (!${Defined[slowTimer${tempID}]}) /declare slowTimer${tempID} timer outer
             /varset slowTimer${tempID} ${slowDuration}
             /call CheckForAdds
          }
          /if (${newAdds} && ${useCripple}) /return
          /if (${useCripple}) /call Synapsis
          /if (${addList.Find[[]}) /varset newAdds 1
          /if (${newAdds}) /return
          /if (${Macro.Return.Equal[CAST_CANCELLED]}) /return
          /if (${newAdds}) /return
        }
      }
      /if (!${Spawn[${mobID}].Type.Equal[NPC]} && !${Spawn[${mobID}].Master.Type.Equal[NPC]}) /return
    /next i
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Charm
|--------------------------------------------------------------------------------
Sub Charm(int tempID)
  /target id ${tempID}
  /if (${Spawn[${tempID}].Distance} > 80 && ${Me.SpellReady["${mezSpell}"]} && ${Me.CurrentMana} >= ${Spell["${mezSpell}"].Mana} && ${Spawn[${tempID}].LineOfSight}) {
    /fast fast nolook
    /if (${announce}) /${chatChannel} Mezzing  >> >> ${Target.CleanName} << <<
    /call cast "${mezSpell}" ${mezGem} 6s CheckForAdds
  } else /if (${Spawn[${tempID}].Distance} > 60 && ${Me.Gem["${rootSpell}"]} && ${Me.SpellReady["${rootSpell}"]} && ${Me.CurrentMana} >= ${Spell["${rootSpell}"].Mana} && ${Spawn[${tempID}].LineOfSight}) {
    /fast fast nolook
    /if (${announce}) /${chatChannel} ${rootSpell} on >> >> ${Target.CleanName} << <<
    /call cast "${rootSpell}" ${rootSpellGem} 6s CheckForAdds
  } else /if (${Me.Gem[${pbaeMezSpell}]} && ${Spawn[${tempID}].Level} <= ${maxPBAEMezLevel}) {
    :MoveLoop
    /if (${Target.Distance} > 45) {
      /face fast nolook
      /keypress forward hold
      /delay 1
      /goto :MoveLoop
    }
    /keypress forward
    /keypress back
    /delay 1
    :WaitLoop
    /if (${Target.Distance3D}<=35) {
      /if (${announce}) /${chatChannel} Casting ${pbaeMezSpell} on >> >> ${Target.CleanName} << <<
      /call Cast "${pbaeMezSpell}" ${pbaeMezGem} 6s CheckForAdds
    } else {
      /delay 1
      /goto :WaitLoop
    }
  } else {
    /if (${announce}) /${chatChannel} Mezzing  >> >> ${Target.CleanName} << <<
    /call cast "${mezSpell}" ${mezGem} 6s CheckForAdds
  }
  /target id ${tempID}
  /delay 1
  /if (${tashTimer${tempID}}<5500) /call Tash
  /if (${announce}) /${chatChannel} Charming  >> >> ${Target.CleanName} << <<
  /call Cast "${charmSpell}" ${charmGem}
  /if (${Me.Pet.ID}) /target id ${Me.Pet.ID}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Tash
|--------------------------------------------------------------------------------
Sub Tash
  :spell_loop
  /if (!${Me.SpellReady[${Me.Gem[1]}]} && !${Me.SpellReady[${Me.Gem[2]}]} && !${Me.SpellReady[${Me.Gem[3]}]} && !${Me.SpellReady[${Me.Gem[4]}]}) {
    /delay 2
    /goto :spell_loop
  }
  /declare tempID int local ${Target.ID}
  /if (${ExcludeList.Find[${Target.DisplayName}]}) {
     /if (!${Defined[tashTimer${tempID}]}) /declare tashTimer${tempID} int outer -1
     /return
  }
  /if (${useTashFocus}) /call SwapItem "${tashFocusItem}" ${FindItem[${tashFocusItem}].WornSlot[1]}
  /if (${Target.Distance}<=${Spell[${tashSpell}].MyRange} && ${Me.CurrentMana}>${Spell[${tashSpell}].Mana} && ${Target.LineOfSight}) {
    /if (${announce}) /${chatChannel} ${tashSpell} on >> >> ${Target.CleanName} << <<
    /call Cast "${tashSpell}" ${tashGem} 1s CheckForAdds
    /if (!${Defined[tashTimer${tempID}]}) /declare tashTimer${tempID} timer outer
    /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
      /varset tashTimer${tempID} ${tashDuration}
    } else /if (${newAdds} || ${Select[${castReturn},CAST_OUTOFMANA,CAST_OUTOFRANGE,CAST_CANNOTSEE]}) {
      /varset tashTimer${tempID} 50
    } else {
      /varset tashTimer${tempID} 1
    }
  }
|  /if (${useTashFocus}) /call SwapItem "${normalMainhand}" mainhand
  /delay 2
/return ${Macro.Return}
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Slow
|--------------------------------------------------------------------------------
Sub Slow
  /declare slowResistCounter int local
  /declare tempID int local ${Target.ID}
  /if (${ExcludeList.Find[${Target.DisplayName}]}) {
     /if (!${Defined[slowTimer${tempID}]}) /declare slowTimer${tempID} int outer -1
     /return
  }
  :recastslow
  /doevents Hit
  /if (${Me.TargetOfTarget.ID}==${Me.ID} && ${useMitigate}) /call cast "${mitigateSpell}" ${mitigateSpellGem}
  /if (${Target.ID} && ${Target.LineOfSight} && ((${Spawn[${tempID}].Distance}<=${Spell[${slowSpell}].MyRange} && ${Me.CurrentMana}>${Spell[${slowSpell}].Mana}) || (${Select[${slowType},item,alt]} && ${Spawn[${tempID}].Distance}<=200))) {
    /if (${announce}) /${chatChannel} ${slowSpell} on >> >> ${Target.CleanName} << <<
    /call Cast "${slowSpell}" ${slowType} 6s CheckForAdds
    /if (!${Defined[slowTimer${tempID}]}) /declare slowTimer${tempID} timer outer
    /if (${Macro.Return.Equal[CAST_IMMUNE]} || ${spellNotHold}) {
      /deletevar slowTimer${tempID}
      /declare slowTimer${tempID} int outer -1
    } else /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
      /varset slowTimer${tempID} ${slowDuration}
    } else /if (${castReturn.Equal[CAST_RESISTED]}) {
      /varcalc slowResistCounter ${slowResistCounter}+1
      /if (${slowResistCounter}>=4) {
         /if (${announce}) /${chatChannel} >> >> ${Target.CleanName} << << resisted ${slowSpell} ${slowResistCounter} times, giving up!
         /varset slowTimer${tempID} 10000s
         /goto :slowdone
      } else {
         /delay 5
         /goto :recastslow
      }
    } else /if (${newAdds} || ${Select[${castReturn},CAST_OUTOFMANA,CAST_OUTOFRANGE,CAST_CANNOTSEE]}) {
      /varset slowTimer${tempID} 50
    } else {
      /varset slowTimer${tempID} 1
    }
  }
  :slowdone
  /delay 2
/return ${Macro.Return}
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Synapsis
|--------------------------------------------------------------------------------
Sub Synapsis
  /declare crippleResistCounter int local
  /declare tempID int local ${Target.ID}
  /if (${ExcludeList.Find[${Target.DisplayName}]}) {
     /if (!${Defined[crippleTimer${tempID}]}) /declare crippleTimer${tempID} int outer -1
     /return
  }
  :recastcripple
  /if (${Me.TargetOfTarget.ID}==${Me.ID} && ${useMitigate}) /call cast "${mitigateSpell}" ${mitigateSpellGem}
  /if (${Target.Distance}<=${Spell[${crippleSpell}].MyRange} && ${Me.CurrentMana}>${Spell[${crippleSpell}].Mana} && ${Target.LineOfSight}) {
    /if (${announce}) /${chatChannel} ${crippleSpell} on >> >> ${Target.CleanName} << <<
    /call Cast "${crippleSpell}" ${crippleGem} 6s CheckForAdds
    /if (!${Defined[crippleTimer${tempID}]}) /declare crippleTimer${tempID} timer outer
    /if (${Macro.Return.Equal[CAST_IMMUNE]} || ${spellNotHold}) {
      /deletevar crippleTimer${tempID}
      /declare crippleTimer${tempID} int outer -1
    } else /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
      /varset crippleTimer${tempID} ${crippleDuration}
    } else /if (${castReturn.Equal[CAST_RESISTED]}) {
      /varcalc crippleResistCounter ${crippleResistCounter}+1
      /if (${crippleResistCounter}>=3) {
         /if (${announce}) /${chatChannel} >> >> ${Target.CleanName} << << resisted ${crippleSpell} ${crippleResistCounter} times, giving up!
         /varset crippleTimer${tempID} 10000s
         /goto :crippledone
      } else {
         /delay 5
         /goto :recastcripple
      }
    } else /if (${newAdds} || ${Select[${castReturn},CAST_OUTOFMANA,CAST_OUTOFRANGE,CAST_CANNOTSEE]}) {
      /varset crippleTimer${tempID} 50
    } else {
      /varset crippleTimer${tempID} 1
    }
  }
  :crippledone
  /delay 2
/return ${Macro.Return}
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Mez
|--------------------------------------------------------------------------------
Sub Mez
  /declare tempID int local ${Target.ID}
  /declare resistCount int local 0
  /if (${Defined[mezTimer${tempID}]} && ${mezTimer${tempID}} > ${Math.Calc[${mezDuration}-20]}) /return
  :mez_loop
  /if (!${Me.SpellReady[${Me.Gem[1]}]} && !${Me.SpellReady[${Me.Gem[2]}]} && !${Me.SpellReady[${Me.Gem[3]}]} && !${Me.SpellReady[${Me.Gem[4]}]}) {
    /delay 2
    /goto :mez_loop
  }
  /if (${Spawn[${tempID}].Type.Equal[PC]}) {
    /call UpdateMobList
    /squelch /target clear
    /return
  }
  /if (${Target.PctHPs} < 85 && ${mezTimer${tempID}} != -1) {
    /if (${Defined[mezTimer${tempID}]}) {
      /varset mezTimer${tempID} int outer -1
    } else {
      /declare mezTimer${tempID} int outer -1
    }
    /if (${announce}) /${chatChannel} >> >> ${Target.CleanName} << << is being killed, no mezz 4 u!
    /return
  }
  /if (!${Defined[mezTimer${tempID}]}) {
    /declare mezTimer${tempID} timer outer
  }
  /doevents Hit
  /if (${mezzImmuneList.Find[${Target.DisplayName}]}) {
    /varset mezTimer${tempID} -1
    /if (${announce}) /${chatChannel} >> >> ${Target.CleanName} << << CANNOT BE MEZZED!  OFFTANK!
    /return
  }
  /if (${Target.Distance}<=${Spell[${mezSpell}].MyRange} && ${Me.CurrentMana}>${Spell[${mezSpell}].Mana} && ${Spawn[${tempID}].Level}<=${maxMezLevel} && !${mezzImmuneList.Find[${Target.DisplayName}]} && ${Target.LineOfSight}) {
    /delay 5 (${Target.ID}==${tempID})
    /if (${announce}) /${chatChannel} Mezzing  >> >> ${Target.CleanName} << <<
    /call Cast "${mezSpell}" ${mezGem} 3s CheckForAdds
    /if (${Macro.Return.Equal[CAST_IMMUNE]}) {
      /varset mezTimer${tempID} int outer 10000
      /if (${announce}) /${chatChannel} >> ${Target.CleanName} << Is IMMUNE TO MEZZ!  OFFTANK!
      /if (${Spawn[${tempID}].Level}<=${maxMezLevel} && !${mezzImmuneList.Find[${Target.DisplayName}]}) {
         /ini "${mezzImmuneIni}" "Excludes.${Zone.ShortName}" "MezzImmune" "${mezzImmuneList}>> ${Target.CleanName} <<|"
        /varset mezzImmuneList ${Ini[${mezzImmuneIni},"Excludes.${Zone.ShortName}","MezzImmune"]}
        /echo MezzImmuneList: ${mezzImmuneList}
      }
    } else /if (${Macro.Return.Equal[CAST_CANCELLED]}) {
       /varset mezTimer${tempID} int outer 10000
       /if (${announce}) /${chatChannel} ${mezSpell} was cancelled on >> ${Target.CleanName} <<!
    } else /if (${Macro.Return.Equal[CAST_SUCCESS]}) {
      /varset mezTimer${tempID} ${mezDuration}
    } else /if (${Macro.Return.Equal[CAST_OUTOFMANA]} || ${Macro.Return.Equal[CAST_OUTOFRANGE]} || ${Macro.Return.Equal[CAST_CANNOTSEE]}) {
      /varset mezTimer${tempID} 50
    } else {
      /if (${Macro.Return.Equal[CAST_INTERRUPTED]}) {
        /if (${Me.SpellReady[${stunSpell}]}) {
          /if (${announce}) /${chatChannel} Stunning  >> ${Target.CleanName} <<
          /call Cast "${stunSpell}" gem6 2s
        } else /if (${Me.SpellReady[${pbaeMezSpell}]} && ${Spawn[${tempID}].Level} <= ${maxPBAEMezLevel} && ${Target.Distance}<=30 ) {
          /if (${announce}) /${chatChannel} Casting ${pbaeMezSpell} on >> ${Target.CleanName} <<
          /call Cast "${pbaeMezSpell}" ${pbaeMezGem} 3s
        }
      }
      /if (${Macro.Return.Equal[CAST_RESISTED]}) {
        /varcalc resistCount ${resistCount}+1
        /if (${resistCount}==2 && !${tashTimer${addID}}) /call Tash
      }
      /if (!${Spawn[${mobID}].Type.Equal[NPC]} && !${Spawn[${mobID}].Master.Type.Equal[NPC]} && ${useMez}) /return
      /goto :mez_loop
    }
  }
/return ${Macro.Return}
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: ClickOffIllusion
|--------------------------------------------------------------------------------
Sub ClickOffIllusion
  /declare i int local
  /for i 1 to 20
    /if (${Me.Buff[${i}].Name.Find[illusion:]}) /nomodkey /notify BuffWindow buff${Math.Calc[${i}-1].Int} leftmouseup
  /next i
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckBuffs
|--------------------------------------------------------------------------------
Sub CheckBuffs
  /if (${Zone.ID}!=${currentZone}) /call Event_Zone
  /varset deathFlag ${Me.Buff[Revival Sickness].ID}
  /if (${deathFlag} || ${Me.State.Equal[Hover]} || ${Me.State.Equal[Dead]} || ${Window[RespawnWnd].Open}) /goto :dead
  /if (${Me.Invis} || ${following}) /return
  /declare a int local
  /declare i int local
  /declare oldTarget int local ${Target.ID}
  /declare oldItemName string local
  /declare foodName string local
  /declare oldSlotID int local
  /declare spellName string local
  /declare buffText string local
  /declare targetName string local
  /declare spellName2 string local
  /declare spellType string local
  /declare spellRange int local 118
  /declare tempID int local
  /declare focusList string local Wunshi's Focusing,Focus of Alladnu,Focus of Soul,Talisman of Kragg,Focus of the Seventh,Talisman of Wunshi,Dire Focusing,Dire Focusing Rk. II,Dire Focusing Rk. III,Talisman of the Dire,Talisman of the Dire Rk. II,Talisman of the Dire Rk. III
  /declare shaman bool local false
  /declare targetType string local
  /doevents Indoors
  /if (!${Me.Pet.ID} && !${Me.CombatState.Equal[COMBAT]} && ${usePet} && !${petOff} && ${Me.CurrentMana}>=${Spell[${petSpell}].Mana}) /call SumPet
  /if (${Me.Pet.ID} && ${petID}!=${Me.Pet.ID}) {
    /varset petID ${Me.Pet.ID}
    /if (${Defined[mezTimer${petID}]}) /deletvar mezTimer${petID}
    /if (${Defined[slowTimer${petID}]}) /deletvar slowTimer${petID}
    /if (${Defined[crippleTimer${petID}]}) /deletvar crippleTimer${petID}
    /if (${Defined[bewildermentTimer${petID}]}) /deletvar bewildermentTimer${petID}
    /declare mezTimer${petID} int outer -1
    /declare slowTimer${petID} int outer -1
    /declare crippleTimer${petID} int outer -1
    /declare bewildermentTimer${petID} int outer -1
  }
| xxxxxxxxx botlove disabled due to broken swapitem

|  /if (!${Me.Casting.ID}) {
|    /if (${Me.Combat}) {
|      /call SwapItem "${meleeWep}" mainhand
|    } else {
|      /call SwapItem "${normalMainhand}" mainhand
|    }
|  }

  /if (${Cursor.Name.Equal[Wand of Elemental Transvergance]} || ${Cursor.Name.Equal[Rod of Mystical Transvergance]} || ${Cursor.Name.Equal[Summoned: Modulating Rod]}) /autoinventory
  /if ((!${FindItem[Wand of Elemental Transvergance].ID} || !${FindItem[Rod of Mystical Transvergance].ID} || !${FindItem[Summoned: Modulating Rod].ID}) && ${Spawn[pc ${rodBitch} radius 200].ID} && !${askedForRodTimer}) {
    /tell ${rodBitch} rod pls!
    /varset askedForRodTimer 5m
  }
  /if (!${modRodTimer} && ${Me.PctHPs}>50 && ${Me.PctMana}<=85 && (${FindItem[Wand of Elemental Transvergance].ID} || ${FindItem[Rod of Mystical Transvergance].ID} || ${FindItem[Summoned: Modulating Rod].ID})) {
     /if (${FindItem[Wand of Elemental Transvergance].InvSlot}) {
      /call Cast "Wand of Elemental Transvergance" item
     } else /if (${FindItem[Rod of Mystical Transvergance].InvSlot}) {
      /call Cast "Rod of Mystical Transvergance" item
     } else /if (${FindItem[Summoned: Modulating Rod].InvSlot}) {
      /call Cast "Summoned: Modulating Rod" item
    }
    /varset modRodTimer 3100
  }
  /if (${checkNamed}) /call CheckNamed
  /if (${Me.Hunger}<5000 && ${useFood}) {
    /call GetFoodName
    /varset foodName ${Macro.Return}
    /if (${Bool[${foodName}]}) {
      /varset oldSlotID ${FindItem[${foodName}].InvSlot.ID}
      /call SwapItem "${foodName}" "${foodPack}"
      /nomodkey /itemnotify ${foodPack} rightmouseup
      /call SwapItem "${foodName}" "${oldSlotID}"
    }
  }

  /if (!${autoBuff}) /goto :skip_buffs
  /if ((${autoBuff}==2 || ${autoBuff}==4) && ${Target.ID}) /return
  /if (!${selfBuffTimer}) /call CheckIniBuffs
  /if (${autoC7} && (${Me.Buff[${singleC7}].Duration}<=5 || ${Me.Buff[${groupC7}].Duration}<=5)) {
    /if (!${Me.Buff[${singleC7}].ID} && !${Me.Buff[${groupC7}].ID} && !${Me.Buff[Tranquility].ID}) {
      /if (${Me.PctMana}<20 && ${FindItem[Silken Augmenter's Pantaloons].ID} && !${Me.Buff[${singleC7}].ID} && !${Me.Buff[${groupC7}].ID} && ${Spell[Tranquility].Stacks[0]}) {
        /call AddToQueue "c4,${Me.Name}"
      } else {
        /call AddToQueue "mindCandy,${Me.Name}"
      }
    } else /if (${Me.PctMana}>=80 && ((${Spell[${singleC7}].Stacks[0]}  ${Spell[${groupC7}].Stacks[0]}) && (${Me.Book[${singleC7}]} || ${Me.Book[${groupC7}]}))) {
      /call AddToQueue "mindCandy,${Me.Name}"
    }
  }
  /if (${Me.Buff[Tranquility].ID} && ${Me.PctMana}>=80 && ${Me.Level}>=65) {
     /call AddToQueue "mindCandy,${Me.Name}"
  }
  /if (${hasteGroup}) {
    /for i 1 to ${Group}
      /varset tempID ${Group.Member[${i}].ID}
      /if (${tempID}) {
        /if (!${Defined[hasteTimer${tempID}]}) /declare hasteTimer${tempID} timer outer
        /if (${Spawn[${tempID}].Type.Equal[pc]}) {
          /if (!${hasteTimer${tempID}}) {
            /if (${Group.Member[${i}].Class.PureCaster}) {
              /deletevar hasteTimer${tempID}
              /declare hasteTimer${tempID} int outer -1
            } else {
              /call AddToQueue "sos,${Group.Member[${i}].Name}"
              /varset hasteTimer${tempID} 62m
            }
          }
        } else /if (${Spawn[${tempID}].Type.Equal[Corpse]}) {
          /varset hasteTimer${tempID} 0
        }
      } else /if (${Defined[hasteTimer${tempID}]}) {
        /deletevar hasteTimer${tempID}
      }
    /next i
  }
  /if (${Spawn[pc class shaman].ID}) {
    /if (${Raid.Members}) {
      /if (${Spawn[pc guild "${Me.Guild}" shm].ID}) /varset shaman true
    } else {
      /for i 1 to ${Group}
        /if (${Group.Member[${i}].Class.Name.Equal[shaman]}) /varset shaman true
      /next i
    }
  }
  /if (${shaman}) {
    /if (${Me.Buff[${shielding}].ID}) /call ClickOffBuff "${shielding}"
  } else {
    /for i 1 to ${focusList.Length}
      /if (${Me.Buff[${focusList.Arg[${i},,]}].ID}) /goto :skip_buffs
    /next i
    /if (!${Me.Buff[${shielding}].ID} && ${Spell[${shielding}].Stacks[10]}) /call AddToQueue "${shielding},${Me.Name}"
  }
  :skip_buffs
  /if (!${Me.Mount.ID} && ${useMount}) /call Cast "${InvSlot[ammo].Item.Name}" item 2s
  /if (!${useMount} && ${Me.Mount.ID}) /dismount
  /if (${buffQueue.Find[[]}) {
    /if (${useExtEnhanceFocus}) {
       /varset focusSlotName ${FindItem[${extEnhanceItem}].WornSlot[1].Name}
       /call EquipItem "${extEnhanceItem}" ${FindItem[${extEnhanceItem}].WornSlot[1].Name}
       /varset oldItem ${Macro.Return}
    }
    /if (${buffQueue.Find[[]}>1) /varset buffQueue ${buffQueue.Right[-${Math.Calc[${buffQueue.Find[[]}-1]}]}
   |----------------------------------------------------------------
   /for i 1 to ${buffQueue.Count[[]}
      /varset buffText [${buffQueue.Arg[${i},[]}     
      /varset spellName ${buffText.Arg[1,,].Right[-1]}     
      /if (${spellName.Right[1].Equal["]"]}) /varset spellName ${spellName.Left[-1]}
      /varset targetName ${buffText.Arg[2,,].Left[-1]}
      /call GetBuffName "${spellName}"     
      /varset spellName ${Macro.Return.Arg[1,,]}     
      /varset spellType ${Macro.Return.Arg[2,,]}
      /if (${spellType.Equal[item]}) {
        /varset spellName2 ${FindItem[${spellName}].Spell.Name}
      } else {
        /varset spellName2 ${spellName}
      }
      /if (${Spell[${spellName2}].TargetType.Equal[Group v2]}) {
        /varcalc spellRange 1.18*${Spell[${spellName2}].AERange}
      } else {
        /varcalc spellRange 1.18*${Spell[${spellName2}].Range}
      }
      /if (${Bool[${spellName}]} && ${Spawn[${targetName}].Type.Equal[NPC]}) {
         /if (${announce}) /${chatChannel} Casting ${spellName} on ${targetName}
     | xxxxxxxxxxxx added  CheckForAdds - botlove changed
        /call Cast "${spellName}" ${spellType} 4s CheckForAdds
        /if (${Spawn[${oldTarget}].ID}) {
          /if (${Target.Name.Equal[${targetName}]}) /target id ${oldTarget}
        } else {
          /squelch /target clear
        }
        /call DeleteFromQueue "${buffText}"
        /varcalc i ${i}-1
        /return
      }
      /varset targetType pc
      /if (!${Spawn[pc ${targetName}].ID}) /varset targetType pet
      /if (${Bool[${spellName}]}) {
        /if (${spellName.Find[Illusion]} && ${Me.AltAbilityReady[Project Illusion]}) /call cast "Project Illusion" alt 1s
        /if (${Me.CurrentMana}>=${Math.Calc[${Spell[${spellName}].Mana}+${Me.ManaRegen}]} || ${spellType.Equal[item]} || ${spellType.Equal[alt]}) {
          /if (!${Bool[${targetName}]} && ${Target.Distance}<=${Spell[${spellName}].MyRange}) {
            /if (${announce}) /${chatChannel} Casting ${spellName} on >> ${Target.CleanName} <<
         | xxxxxxxxxxxx added check for adds - botlove changed
            /call Cast "${spellName}" ${spellType} 4s CheckForAdds
          } else /if (${Spawn[${targetType} ${targetName}].ID} && (${Spawn[pc ${targetName}].Distance3D}<=${Spell[${spellName}].MyRange} || !${spellRange})) {
            /target ${targetType} ${targetName}
            /delay 1s (${Target.ID}==${Spawn[pc ${targetName}].ID})
            /if (${announce}) /${chatChannel} Casting ${spellName} on >> ${Target.CleanName} <<
            /call Cast "${spellName}" ${spellType} 4s CheckForAdds
          }
          /if (${Macro.Return.Equal[CAST_SUCCESS]} || ${spellNotHold} || ${Macro.Return.Equal[CAST_UNKNOWNSPELL]} || ${Macro.Return.Equal[CAST_NOTARGET]} || (${Macro.Return.Equal[CAST_CANCELLED]} && (!${newAdds} || !${useMez}))) {
            /call DeleteFromQueue "${buffText}"
            /varcalc i ${i}-1
          }
        } else {
          /call DeleteFromQueue "${buffText}"
          /varcalc i ${i}-1
        }
      }
    /next i
    |----------------------------------------------------------------
    /if (${Spawn[${oldTarget}].ID}) {
      /if (${Target.Name.Equal[${targetName}]}) /target id ${oldTarget}
    } else {
      /squelch /target clear
    }
    /if (${useExtEnhanceFocus}) /call EquipItem ${oldItem}
  /return
  }
  /if (${QueueCount} && ${Me.PctMana}>${doBuffMana} && ${doBuffs}) {
    /for a 1 to 25
       /if (!${PreviousSpell} || (${PreviousSpell}!=${Spell[${doBuffID[${doBuffQueue[${a},2]}]}].ID})) /goto :SetCheck
       /if (${PreviousSpell}==${Spell[${doBuffID[${doBuffQueue[${a},2]}]}].ID}) {
          /call RemoveFromQueue ${doBuffQueue[${a},1]} ${doBuffQueue[${a},2]}
          /timed 300 /varset PreviousSpell 0
          /goto :NextdoBuff
       }
       :SetCheck
      /if ((${Spawn[${doBuffQueue[${a},1]}].Distance}>${Spell[${doBuffID[${doBuffQueue[${a},2]}]}].MyRange} && ${Spawn[${doBuffQueue[${a},1]}].Distance}>${Spell[${doBuffID[${doBuffQueue[${a},2]}]}].AERange}) || !${Spawn[${doBuffQueue[${a},1]}].ID} || ((!${Me.SpellReady[${doBuff${doBuffQueue[${a},2]}}]} && ${Me.Gem[${doBuff${doBuffQueue[${a},2]}}]}) && ${doBuffGem${doBuffQueue[${a},2]}.NotEqual[item]} && ${doBuffGem${doBuffQueue[${a},2]}.NotEqual[alt]})) /goto :NextdoBuff
      /squelch /target id ${doBuffQueue[${a},1]}
      /delay 1s ${Target.ID}==${doBuffQueue[${a},1]}
      /if (${Target.ID}==${doBuffQueue[${a},1]}) {
        /varset spellName ${doBuffIcon${doBuffQueue[${a},2]}}
        /if (${doBuffTells} && !${SpamTimer}) /tt ${doBuffIcon${doBuffQueue[${a},2]}} inc
        /if (${useExtEnhanceFocus}) {
           /varset focusSlotName ${FindItem[${extEnhanceItem}].WornSlot[1].Name}
           /call EquipItem "${extEnhanceItem}" ${FindItem[${extEnhanceItem}].WornSlot[1].Name}
           /varset oldItem ${Macro.Return}
        }
        /if (${Target.ID} && ${Target.Distance}<=${Spell[${doBuffID[${doBuffQueue[${a},2]}]}].MyRange}) /call Cast "${doBuff${doBuffQueue[${a},2]}}" ${doBuffGem${doBuffQueue[${a},2]}} 10s
        /if (${Select[${Spell[${doBuffID[${doBuffQueue[${a},2]}]}].TargetType},"Group v2","AE PC v2","Group v1","AE PC v1"]}) /varset PreviousSpell ${Spell[${doBuffID[${doBuffQueue[${a},2]}]}].ID}
        /if (${castReturn.Equal[CAST_SUCCESS]} || ${spellNotHold}) /call RemoveFromQueue ${doBuffQueue[${a},1]} ${doBuffQueue[${a},2]}
          /if (${Spawn[${oldTarget}].ID}) {
            /if (${Target.ID}==${doBuffQueue[${a},1]}) /target id ${oldTarget}
          } else {
            /squelch /target clear
          }
          /if (${useExtEnhanceFocus}) /call EquipItem ${oldItem}
        /return
      }
      :NextdoBuff
    /next a
  }
  /if (${autoSit} && ${Me.PctMana}<=${minMana} && !${Me.Mount.ID} && !${Me.Casting.ID}) {
    /if (${Me.State.Equal[STAND]} && ${NearestSpawn[Targetable NPC].Distance3D}>=${distanceToSit} && ${Me.PctHPs}>90 && !${following}) /sit
  }
  /if (${autoSit} && ${Me.State.Equal[SIT]}) {
    /if (${Me.PctMana}>${minMana} && !${Window[SpellBookWnd].Open}) /stand
    /if (!${Window[SpellBookWnd].Open} && ${NearestSpawn[Targetable NPC].Distance3D}<=${distanceToSit}) /stand
    /if (${following}) /stand
  }
  /return
  :dead
  /varset mobList
  /varset addList
  /varset buffQueue
  /varset mobID 0
  /varset petID 0
  /varset useAnchor 0
  /squelch /alert clear 6
  /call ClearMobList
  /delay 2s
  :wait_for_loot
  /varset deathFlag ${Me.Buff[Revival Sickness].ID}
  /if (${Spawn[Corpse radius 100 ${Me.Name}].ID} && ${deathFlag}) {
    /target mycorpse
    /call LootCorpse
    /delay 5
    /goto :wait_for_loot
  }
  /if (${deathFlag}) {
    /memspellset ${spellSet}
    /delay 30s
    /echo You're dead! Consenting and waiting for rez...
    /consent guild
    /delay 25
    /consent raid
    /delay 25
    /consent group
    :wait_for_rez
    /if (${Window[TradeWnd].Open}) /nomodkey /notify TradeWnd TRDW_Trade_Button leftmouseup
    /doevents
    /delay 1s
    /if (!${Window[ConfirmationDialogBox].Open}) /goto :wait_for_rez
    /delay 18s !${Window[SpellBookWnd].Open}
    /echo Yay a rez!
    /call TakeRez
    /delay 5s ${Spawn[Corpse radius 100 ${Me.Name}].ID}
    /goto :wait_for_loot
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: TakeRez
|--------------------------------------------------------------------------------
Sub TakeRez
  :wait_for_it
  /if (${Window[ConfirmationDialogBox].Open}) {
    /delay 1
    /notify ConfirmationDialogBox Yes_Button leftmouseup
    /goto :wait_for_it
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: GetBuffName
|--------------------------------------------------------------------------------
Sub GetBuffName(string spellName)
  /declare i int local
  /declare buffText string local
  /declare spellType string local
  /varset spellType ${buffGem}
  /if (${spellName.Equal[c4]}) {
    /if (${FindItem[Silken Augmenter's Pantaloons].ID}) {
      /varset spellName Silken Augmenter's Pantaloons
      /varset spellType item
    } else {
      /varset spellName Tranquility
    }
  }
  /if (${spellName.Equal[mindCandy]}) {
    /if (${Group} && ${Me.Book[${groupC7}]} && (${Me.Buff[${singleC7}].Duration}<=5 || ${Me.Buff[${groupC7}].Duration}<=5)) {
      /varset spellName ${groupC7}
    } else {
      /varset spellName ${singleC7}
    }
  }
  /if (${Me.Book[illusion: ${spellName}]}) /varset spellName illusion: ${spellName}
  /if (${spellName.Equal[sos]}) {
    /varset spellName ${singleHasteSpell}
    /varset spellType ${hasteSpellGem}
  }
  /if (${spellName.Equal[pacifytarget]}) {
     /varset spellName ${pacifySpell}
     /varset spellType ${pacifyGem}
  }
  /if (${spellName.Equal[tashtarget]}) {
    /varset spellName ${tashSpell}
    /varset spellType ${tashGem}
  }
  /if (${spellName.Equal[slowtarget]}) {
    /varset spellName ${slowSpell}
    /varset spellType ${slowType}
  }
  /if (${spellName.Equal[mezztarget]}) {
    /varset spellName ${mezSpell}
    /varset spellType ${mezGem}
  }
  /if (${spellName.Equal[dispelltarget]}) {
    /varset spellName ${dispellSpell}
    /varset spellType ${dispellGem}
  }
  /if (${spellName.Equal[roottarget]}) {
    /varset spellName ${rootSpell}
    /varset spellType ${rootSpellGem}
  }
  /if ((${spellType.Find[gem]} || ${spellType.Equal[spell]}) && !${Me.Book[${spellName}]}) {
|    /if (${FindItem[${spellName}].ID}) {
|      /varset spellType item
    /if (${Me.AltAbility[${spellName}]} || ${spellName.Equal[${spellName}]}) {
      /varset spellType alt
    } else {
      /return
    }
  }
/return ${spellName},${spellType}
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckRune & Epic Rune
|--------------------------------------------------------------------------------
Sub CheckRune(int tempHP) 
  /if (!${Me.Buff[${selfRune}].ID} && !${selfRuneTimer} && ${autoBuff} && (${Me.PctHPs}<=${tempHP} || ${Me.PctMana}>=50)) {
    /if (${Spell[${selfRune}].Stacks[20]} && (${Debuff.HPDrain}<50)) {
       /call AddToQueue "${selfRune},${Me.Name}"
       /varset selfRuneTimer 20s
    }
  }
  /if (${useEpic} && !${epicTimer}) {
    /if (${FindItem[Staff of Eternal Eloquence].ID} && !${Me.Buff[Aegis of Abstraction].ID}) {       
       /call EquipItem "Staff of Eternal Eloquence"
   /call Cast "Staff of Eternal Eloquence" item
       /call EquipItem ${normalMainhand}       
        /varset epicTimer 3m
    } else /if (${FindItem[Oculus of Persuasion].ID} && !${Me.Buff|[Protection of the Eye].ID}) {
       /call EquipItem "Oculus of Persuasion"
       /call Cast "Oculus of Persuasion" item
       /call EquipItem ${normalMainhand}
        /varset epicTimer 10m
    }
  }
  /doevents
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: SumPet
|--------------------------------------------------------------------------------
Sub SumPet
  /declare i int local
  /if (${Me.AltAbilityReady[Suspended Minion]}) /alt activate 176
  /delay 10s !${Me.Casting.ID}
  /delay 5s ${Me.Pet.ID}
  /if (!${Me.Pet.ID}) {
    /call cast "${petSpell}" ${petSpellGem} 5s
    /delay 5s ${Me.Pet.ID}
  }
  /if (${Me.Pet.ID} && ${Me.AltAbility[Pet Discipline]}) /pet ghold
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Medding
|--------------------------------------------------------------------------------
Sub Medding
  /if (${autoSit} && ${Me.PctMana}<=85 && !${Me.Mount.ID} && !${Me.Casting.ID}) {
    /if (${Me.State.Equal[STAND]} && ${NearestSpawn[NPC].Distance3D}>=${distanceToSit} && ${Me.PctHPs}>90 && !${following}) /sit
    /if (${announce} && !${spamDelay}) /${chatChannel} Medding, ${Me.PctMana}m
    /varset spamDelay 200
  }
  /if (${autoSit} && ${Me.State.Equal[SIT]}) {
    /if (${Me.PctMana}>95 && !${Window[SpellBookWnd].Open}) /stand
    /if (!${Window[SpellBookWnd].Open} && ${NearestSpawn[NPC].Distance3D}<=${distanceToSit}) /stand
    /if (${following}) /stand
  }
  /if ((${Me.PctMana}<=5) && ${Me.AltAbility[Gather Mana]} && ${Me.AltAbilityReady[Gather Mana]}) /call Cast "gather mana" alt
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: ClickOffBuff
|--------------------------------------------------------------------------------
Sub ClickOffBuff(string buffName)
  /declare i int local
  /for i 1 to 20
    /if (${Me.Buff[${i}].Name.Equal[${buffName}]}) /notify BuffWindow buff${Math.Calc[${i}-1].Int} leftmouseup
  /next i
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckTarget
|--------------------------------------------------------------------------------
Sub CheckTarget
  /declare tempID int local ${Target.ID}
  /if (${UseConsider} && ${Target.ID} && ${Target.Type.Equal[NPC]} && ${Target.Type.NotEqual[Corpse]} && !${ConsiderTarget${tempID}}) /call Consider >> ${Target.CleanName} <<
  /if (${ExcludeList.Find[${Spawn[${tempID}].CleanName}]} || (${UseConsider} && !${Select[${ConsiderReturn},8,9]})) /return
  /if ((${Spawn[${tempID}].Type.Equal[npc]} || (${Spawn[${tempID}].Type.Equal[pet]} && !${Spawn[${tempID}].Master.Type.Equal[pc]})) && ((${Spawn[pc ${mainTank}].NearestSpawn[radius ${Math.Calc[${minRadius}*2]} id ${tempID}].ID} && ${Spawn[pc ${mainTank}].Distance3D}<=${minRadius}) || !${Spawn[pc ${mainTank}].ID} || ${Spawn[pc ${mainTank}].Distance3D}>200) && ${tempID}!=${petID} && (${aggroAnim.Find[|${Spawn[${tempID}].Animation}|]} || ${Spawn[${tempID}].PctHPs}<100 || ${Me.TargetOfTarget.Type.Equal[pc]} || ${Me.TargetOfTarget.Master.Type.Equal[pc]})) {
    /varset validTarget 1
  } else {
    /varset validTarget 0
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckNamed
|--------------------------------------------------------------------------------
Sub CheckNamed
  /if (${checkNamed}) {
  /declare tempID int local
  /declare beeped bool local false
  :check_named
    /varset tempID ${Spawn[npc named noalert 6].ID}
    /if (${tempID}) {
      /squelch /alert add 6 id ${tempID}
      /if (!${Spawn[${tempID}].CleanName.Find[eye of]} && ${SpawnCount[npc "${Spawn[${tempID}].CleanName}"]}==1 && !${Spawn[${tempID}].Race.Find[/high elf/wood elf/ogre/troll/human/gnome/halfling/dark elf/half elf/barbarian/vah shir/iksar/erudite/dwarf/]}) {
        /echo Named Detected: ${Spawn[${tempID}].DisplayName}
        /if (${autoAnnounce}) /${chatChannel} ${Spawn[${tempID}].DisplayName} popped, ${Spawn[${tempID}].Distance3D} feet ${Spawn[${tempID}].HeadingTo} of here.
        /if (!${beeped}) /beep
        /varset beeped true
      }
      /goto :check_named
    }
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckLoc
|--------------------------------------------------------------------------------
Sub CheckLoc
  /if (!${useAnchor}) /return
  /declare myDistance float local ${Math.Distance[${Me.Y},${Me.X}:${anchorY},${anchorX}]}
  /if (${myDistance}>${leashLength}) {
    /if (${myDistance}>300) {
      /varset useAnchor 0
      /return
    }
    /if (${Me.Mount.ID}) /dismount
    /call MoveToLoc ${anchorY} ${anchorX}
    /squelch /face fast nolook heading ${anchorHeading}
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CleanUp
|--------------------------------------------------------------------------------
Sub CleanUp(int tempID)
  /if (!${Spawn[${tempID}].Type.Equal[Corpse]}) /return
  /declare tempX ${Me.X}
  /declare tempY ${Me.Y}
  /declare tempHeading ${Me.Heading.DegreesCCW}
  /if (${Me.Mount.ID}) /dismount
  /tar id ${tempID}
  /call MoveToSpawn ${tempID} 10
  /call LootCorpse
| 0 nodrop
  /call MoveToLoc ${tempY} ${tempX}
  /face fast heading ${tempHeading}
  /delay 15 !${Me.Moving}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: AddToQueue
|--------------------------------------------------------------------------------
Sub AddToQueue(string buffText)
  /varset buffText [${buffText}]
  /if (!${buffQueue.Find[${buffText}]}) /varset buffQueue ${buffQueue}${buffText}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: DeleteFromQueue
|--------------------------------------------------------------------------------
Sub DeleteFromQueue(string buffText)
  /declare a int local
  /declare b int local
  /declare strLeft string local
  /declare strRight string local
  /varcalc a ${buffQueue.Find[${buffText}]}-1
  /varcalc b ${buffQueue.Length}-${buffText.Length}-${a}
  /if (${a}>0) /varset strLeft ${buffQueue.Left[${a}]}
  /if (${b}>0) /varset strRight ${buffQueue.Right[${b}]}
  /varset buffQueue ${strLeft}${strRight}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: AddToList
|--------------------------------------------------------------------------------
Sub AddToList(string listName,string tempID)
  /varset tempID [${tempID}]
  /if (!${${listName}.Find[${tempID}]}) {
    /varset ${listName} ${${listName}}${tempID}
    /return 1
  }
/return 0
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: DeleteFromList
|--------------------------------------------------------------------------------
Sub DeleteFromList(string listName,string tempID)
  /varset tempID [${tempID}]
  /declare a int local
  /declare b int local
  /declare strLeft string local
  /declare strRight string local
  /varcalc a ${${listName}.Find[${tempID}]}-1
  /varcalc b ${${listName}.Length}-${tempID.Length}-${a}
  /if (${a}>0) /varset strLeft ${${listName}.Left[${a}]}
  /if (${b}>0) /varset strRight ${${listName}.Right[${b}]}
  /varset ${listName} ${strLeft}${strRight}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: UpdateMobList
|--------------------------------------------------------------------------------
Sub UpdateMobList
  /declare i int local
  /declare mobListID string local
  /if (${mobList.Find[[]}) {
    /if (${mobList.Find[[]}>1) /varset mobList ${mobList.Right[-${Math.Calc[${mobList.Find[[]}-1]}]}
    /for i 1 to ${mobList.Count[[]}
      /varset mobListID ${mobList.Arg[${i},[].Left[-1]}
      /if ((!${Spawn[${mobListID}].Type.Equal[NPC]} && !${Spawn[${mobListID}].Master.Type.Equal[NPC]}) || ${Spawn[${mobListID}].Type.Equal[Corpse]}) {
        /if (${Defined[mezTimer${mobListID}]}) /deletevar mezTimer${mobListID}
        /if (${Defined[slowTimer${mobListID}]}) /deletevar slowTimer${mobListID}
        /if (${Defined[tashTimer${mobListID}]}) /deletevar tashTimer${mobListID}
        /if (${Defined[crippleTimer${mobListID}]}) /deletevar crippleTimer${mobListID}
        /if (${Defined[bewildermentTimer${mobListID}]}) /deletevar bewildermentTimer${mobListID}
|        /if (${Defined[waitTimer${mobListID}]}) /echo deleting timer |for mob ID waitTimer${mobListID} from update mob List
        /if (${Defined[waitTimer${mobListID}]}) /deletevar waitTimer${mobListID}
        /call DeleteFromList mobList ${mobListID}
        /call DeleteFromList addList ${mobListID}
      }
    /next i
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: ClearMobList
|--------------------------------------------------------------------------------
Sub ClearMobList
  /declare i int local
  /declare mobListID string local
  /if (${mobList.Find[[]}) {
    /if (${mobList.Find[[]}>1) /varset mobList ${mobList.Right[-${Math.Calc[${mobList.Find[[]}-1]}]}
    /for i 1 to ${mobList.Count[[]}
      /varset mobListID ${mobList.Arg[${i},[].Left[-1]}
      /if (${Defined[mezTimer${mobListID}]}) /deletevar mezTimer${mobListID}
      /if (${Defined[slowTimer${mobListID}]}) /deletevar slowTimer${mobListID}
      /if (${Defined[tashTimer${mobListID}]}) /deletevar tashTimer${mobListID}
      /if (${Defined[crippleTimer${mobListID}]}) /deletevar crippleTimer${mobListID}
      /if (${Defined[bewildermentTimer${mobListID}]}) /deletevar bewildermentTimer${mobListID}
|      /if (${Defined[waitTimer${mobListID}]}) /echo deleting timer for |mob ID waitTimer${mobListID} from clear mob List
      /if (${Defined[waitTimer${mobListID}]}) /deletevar waitTimer${mobListID}
      /call DeleteFromList mobList ${mobListID}
      /call DeleteFromList addList ${mobListID}
    /next i
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: SwapStatFood
|--------------------------------------------------------------------------------
Sub SwapStatFood(int toggle)
  /declare foodSlot1 int local
  /declare foodSlot2 int local
  /declare tempSlot1 float local
  /declare tempSlot2 float local
  /declare foodName string local
  /call GetFoodName
  /varset foodName ${Macro.Return}
  /varset foodSlot1 ${FindItem[${statFood}].InvSlot.ID}
  /varset foodSlot2 ${FindItem[${foodName}].InvSlot.ID}
  /varcalc tempSlot1 ${foodSlot1}${If[${foodSlot1}>29,/10-3,]}
  /varcalc tempSlot2 ${foodSlot2}${If[${foodSlot2}>29,/10-3,]}
  /if (${toggle}) {
    /if (${tempSlot1}>${tempSlot2}) /call SwapItem "${statFood}" ${foodSlot2}
  } else {
    /if (${tempSlot1}<${tempSlot2}) /call SwapItem "${statFood}" ${foodSlot2}
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: GetFoodName
|--------------------------------------------------------------------------------
Sub GetFoodName
  /declare foodName string local
  /declare i int local 1
  :check_food
  /if (${FindItem[${food${i}}].ID}) {
    /varset foodName ${food${i}}
  } else /if (${i}<=5) {
    /varcalc i ${i}+1
    /goto :check_food
  }
/return ${foodName}
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: ManaRobe
|--------------------------------------------------------------------------------
Sub ManaRobe
  /if (${useManaStone} && ${useManaRobe}) {
    /call ManaStone ${manaRobeMaxMana}
    /return
  }
  /if (!${FindItem[mana robe].ID}) /return
  /declare pctMana int local ${Me.PctMana}
  /if (${manaRobeMode}==1 || (${manaRobeMode}==2 && ${pctMana}<${manaRobeMinMana})) /varset useManaRobe TRUE
  /if (((${manaRobeMode}==2 && ${pctMana}>=${manaRobeMaxMana}) || !${manaRobeMode})&& ${useManaRobe}) /varset useManaRobe FALSE
  /if (${Me.Inventory[chest].Name.Equal[mana robe]}) /varcalc pctMana ${pctMana}-3
  /if (${pctMana}<${manaRobeMaxMana} && ${useManaRobe}) {
    /if (!${InvSlot[chest].Item.Name.Equal[mana robe]}) /call SwapItem "Mana Robe" "chest"
    /if (!${Me.Invis} && !${Me.Speed} ) /cast item "mana robe"
  } else {
    /if (!${Me.Inventory[chest].Name.Equal[${hpRobe}]}) /call SwapItem "${hpRobe}" chest
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: ManaStone
|--------------------------------------------------------------------------------
Sub ManaStone(int manaStart)
  /if (!${Defined[manaStart]}) /declare manaStart int local 90
  /if (${Me.PctMana} < ${manaStart}) {
    /call Cast "manastone" item
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: LoadVar
|--------------------------------------------------------------------------------
Sub LoadVar(IniSection,IniVar,IniValue,MacroVar,iniName,Function,VarType)
  /declare IniString string local
  /if (!${Defined[${MacroVar}]} && ${Defined[VarType]}) /declare ${MacroVar} ${VarType} outer
  /if (${Function.Equal[LOAD]}) {
    /varset IniString ${Ini[${iniName},${IniSection},${IniVar},NOTFOUND]}
    /varset ${MacroVar} ${IniString}
  }
  /if (${IniString.Equal["NOTFOUND"]} || ${Function.Equal[SAVE]}) {
    /if (${IniString.Equal["NOTFOUND"]} && ${Function.Equal[LOAD]}) /varset ${MacroVar} ${IniValue}
    /ini ${iniName} ${IniSection} ${IniVar} "${${MacroVar}}"
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: SetIniVar
|--------------------------------------------------------------------------------
Sub SetIniVar(string name,string section,string value)
  /varset ${name} ${value}
  /ini "${iniName}" "${section}" "${name.Left[1].Upper}${name.Right[-1]}" "${${name}}"
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: LootCorpse
|--------------------------------------------------------------------------------
Sub LootCorpse(int leaveLast,string noDrop)
  :auto_inv
  /if (${Cursor.ID}) {
    /autoinventory
    /delay 5 ${Cursor.ID}
    /goto :auto_inv
  }
  /if (!${Defined[leaveLast]}) {
    /declare leaveLast int local
    /varset leaveLast 0
  }
  /if (!${Defined[noDrop]}) {
    /declare noDrop string local
    /varset noDrop no
  }
  /declare lootNoDrop bool local
  /if (${Target.Name.Find[${Me.Name}]} || ${noDrop.Equal[nodrop]}) {
    /varset lootNoDrop true
  } else {
    /varset lootNoDrop false
  }
  /if (${leaveLast}!=0) /varset leaveLast 1
  /declare i int local
  /loot
  /delay 10s ${Corpse.Open}
  /if (${Corpse.Open}) {
    /varset i 0
|    /delay 3s ${Corpse.Item[1].ID}
    :wait_for_loot
    /varcalc i ${i}+1
|    /if (!${Corpse.Item[${Math.Calc[${i}+${leaveLast}]}].ID}) /goto :wait_for_done
    :wait_for_loot2
    /nomodkey /shift /itemnotify loot${i} rightmouseup
    /delay 1
    /if (${Window[ConfirmationDialogBox].Open}) {
      /if (${lootNoDrop}) {
        /notify ConfirmationDialogBox Yes_Button leftmouseup
      } else {
        /notify ConfirmationDialogBox No_Button leftmouseup
        /varcalc i ${i}+1
      }
    }
    /if (${Corpse.Item[${Math.Calc[${i}+${leaveLast}]}].ID}) /goto :wait_for_loot2
    /goto :wait_for_loot
  }
  :wait_for_done
  /if (${Corpse.Items}>0) {
    /echo Nodrop items on Corpse, linking to default channel.
    /notify LootWND LW_BroadcastButton leftmouseup
    /keypress enter chat
  }
  /keypress esc
  /delay 1s !${Corpse.Open}
  /if (${Corpse.Open}) /goto :wait_for_done
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: DisplayDPS
|--------------------------------------------------------------------------------
Sub DisplayDPS
  /varcalc fightTotalTime (${MacroQuest.Running}-${fightStartTime})/1000
  /varcalc totalMeleeDmg ${totalMeleeDmg}
  /varcalc totalNonMeleeDmg ${totalNonMeleeDmg}/2
  /echo Fight Duration: ${fightTotalTime} seconds
  /echo Melee Damage: ${totalMeleeDmg}
  /echo NonMelee Damage: ${totalNonMeleeDmg}
  /echo --------------------------------------------
  /echo Total Damage: ${Math.Calc[${totalMeleeDmg}+${totalNonMeleeDmg}]}
  /echo DPS: ${Math.Calc[(${totalMeleeDmg}+${totalNonMeleeDmg})/${fightTotalTime}]}
  /echo --------------------------------------------
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckIniBuffs
|--------------------------------------------------------------------------------
Sub CheckIniBuffs
  /declare i int local
  /declare a int local
  /declare oldTarget int local ${Target.ID}
  /if (!${usePet} && ${Me.Pet.ID} && ${Me.AltAbility[Suspended Minion]} && ${Me.AltAbilityReady[Suspended Minion]}) /call Cast "Suspended Minion" alt
  |------------------------------------------------------------------
  /for i 1 to ${selfBuffTotal}
    /if (${Me.State.NotEqual[FEIGN]} && ${Spell[${selfBuffID[${i}]}].Stacks[25]} && ${Me.CountBuffs}<=${selfBuffCount${i}} && (!${SitTimer} || ${Me.Gem[${selfBuff${i}}]} || ${Me.Mount.ID} || ${selfBuffGem${i}.Equal[item]} || (${selfBuffGem${i}.Equal[alt]} && ${Me.AltAbilityReady[${selfBuff${i}}]})) && (${outdoors} || ${selfBuffIndoors${i}})) {
      /if (${Me.CurrentMana}<${Spell[${selfBuff${i}}].Mana} && !${Select[${selfBuffGem${i}},alt,item]}) /return
      /if (${Select[${Spell[${selfBuffID[${i}]}].TargetType},pc,Single]}) {
        /squelch /target id ${Me.ID}
        /delay 1s ${Target.ID}==${Me.ID}
      }
      /if (${useExtEnhanceFocus}) {
         /varset focusSlotName ${FindItem[${extEnhanceItem}].WornSlot[1].Name}
         /call EquipItem "${extEnhanceItem}" ${FindItem[${extEnhanceItem}].WornSlot[1].Name}
         /varset oldItem ${Macro.Return}
      }
   | xxxxxxxxxxxx added  CheckForAdds - botlove changed
      /call Cast "${selfBuff${i}}" ${selfBuffGem${i}} 5s  CheckForAdds
      /if (${Spawn[${oldTarget}].ID}) {
        /if (${Target.ID}==${Me.ID}) /target id ${oldTarget}
      } else {
        /squelch /target clear
      }
      /if (${useExtEnhanceFocus}) /call EquipItem ${oldItem}
    /return
    }
  /next i
  |------------------------------------------------------------------
  /varset selfBuffTimer ${selfBuffRecheck}
  /if (${doPetBuffs} && ${Me.Pet.ID} && !${petBuffTimer}) {
    /for i 1 to ${petBuffTotal}
      /if (${Spell[${petBuffID[${i}]}].StacksPet[20]} && ((!${SitTimer} || ${Me.Gem[${petBuff${i}}]} || ${Me.Mount.ID}) && (!${Me.Gem[${petBuff${i}}]} || ${Me.SpellReady[${petBuff${i}}]}) || ${petBuffGem${i}.Equal[item]} || (${petBuffGem${i}.Equal[alt]} && ${Me.AltAbilityReady[${petBuff${i}}]})) && (${outdoors} || ${petBuffIndoors${i}})) {
        /if (${Me.PctMana}<${doBuffMana} && !${Select[${petBuffGem${i}},alt,item]}) /return
        /squelch /target id ${Me.Pet.ID}
        /delay 1s ${Target.ID}==${Me.Pet.ID}
        /if (${useExtEnhanceFocus}) {
           /varset focusSlotName ${FindItem[${extEnhanceItem}].WornSlot[1].Name}
           /call EquipItem "${extEnhanceItem}" ${FindItem[${extEnhanceItem}].WornSlot[1].Name}
           /varset oldItem ${Macro.Return}
        }       
     | xxxxxxxxxxxx added CheckForAdds - botlove changed
        /call Cast "${petBuff${i}}" ${petBuffGem${i}} 5s  CheckForAdds
        /if (${Spawn[${oldTarget}].ID}) {
          /if (${Target.ID}==${Me.Pet.ID}) /target id ${oldTarget}
        } else {
          /squelch /target clear
        }
        /if (${useExtEnhanceFocus}) /call EquipItem ${oldItem}
      /return
      }
    /next i
    /varset petBuffTimer ${petBuffRecheck}
  }
  |---------------------------------------------
  /for i 1 to ${auraBuffTotal}
  /if ((${useAura}) && (${Me.Aura[${auraBuffEffect${i}}].ID}==NULL) && (${Spell[${auraBuff${i}}].Stacks[25]})) {   
    /if ((!${SitTimer} || ${Me.Gem[${auraBuff${i}}]} || ${Me.Mount.ID}) && ${Me.State.NotEqual[FEIGN]})  {
      /squelch /target id ${Me.ID}
      /delay 1s ${Target.ID}==${Me.ID}
      /if (${Me.CurrentMana}>${Spell[${auraBuff${i}}].Mana}) {
     | xxxxxxxxxxxx added  CheckForAdds - botlove changed
        /call Cast "${auraBuff${i}}" ${auraBuffGem${i}} 10s CheckForAdds
      }
    }
    /if (${Spawn[${oldTarget}].ID}) {
      /if (${Target.ID}==${Me.ID}) /target id ${oldTarget}
    } else {
      /squelch /target clear
    }
  }
  /next i
  |---------------------------------------------
|zzzzzzzzzz ini need new variable for this, some people have different AA runes
  /if (${useAARune} && (${Me.Buff[${selfAARune}].ID}==NULL) && ${Me.AltAbilityReady[${selfAARune}]}) {
    /if ((!${SitTimer} || ${Me.Mount.ID}) && ${Me.State.NotEqual[FEIGN]})  {
        /call Cast "${selfAARune}" alt
    }
  }
  |--------------------------------------------- 
  /if (${ShrinkPet} && !${useCharm} && ${Me.Pet.ID} && (${Me.Pet.Height}-.25>1)) {
     /if (${Target.ID}!=${Me.Pet.ID}) /target id ${Me.Pet.ID}
     /delay 1s ${Target.ID}==${Me.Pet.ID}
     | added CheckForAdds - botlove changed
     /call Cast "${ShrinkPetSpell}" ${ShrinkPetSpellGem} 3s CheckForAdds
    /if (${Spawn[${OldTarget}].ID}) {
      /if (${Target.ID}!=${Spawn[${OldTarget}].ID}) /target id ${OldTarget}
    } else {
      /squelch /target clear
    }
   }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Dot
|--------------------------------------------------------------------------------
Sub Dot
  /if ((${Target.ID} && ${ExcludeList.Find[${Target.DisplayName}]}) || (${Target.ID}==${mobID} && ${bewildermentTimer[${mobID}]})) /return
  /declare DotResistCounter int local
  /declare i int local
  /if (${DotTotal}) {
    /for i 1 to ${DotTotal}
      /if ((${Me.PctMana}>${DotMinMana} || ${Select[${DotGem${i}},item,alt]}) && !${Me.Moving} && !${Me.Casting.ID}) {
        /if ((${WhichDot}==${DotSpellSet${i}} || !${DotSpellSet${i}}) && !${DotTimer${i}}) {
          /varset DotResistCounter 0
          :RecastDot
          /call CheckForAdds
          /if (${newAdds}) /return
          /doevents
          /target id ${mobID}
          /delay 5 ${Target.ID}==${mobID}
          /if (!${Me.Gem[${Dot${i}}]} && ${Select[${DotGem${i}},item,alt]}) /goto :RecastDot
          /if (${Target.Type.Equal[NPC]} && ${Target.ID}==${mobID} && ${Target.LineOfSight} && ${Target.Distance}<${Spell[${DotID[${i}]}].MyRange}) {
            /call Cast "${Dot${i}}" ${DotGem${i}} 10s
          } else {
            /return
          }
          /if (${castReturn.Equal[CAST_RESISTED]}) {
            /varcalc DotResistCounter ${DotResistCounter}+1
            /if (${DotResistCounter}>=${DotRecasts}) {
              /if (${announce}) /${chatChannel} >> ${Target.CleanName} << resisted ${Dot${i}} ${DotRecasts} times, giving up
              /varset DotTimer${i} 10000s
              /goto :NextDot
            } else {
              /goto :RecastDot
            }
          } else /if (${castReturn.Equal[CAST_INTERRUPTED]} || ${castReturn.Equal[CAST_CANCELLED]}) {
            /goto :RecastDot
          } else /if (${castReturn.Equal[CAST_SUCCESS]}) {
            /if (${announce}) /${chatChannel} >> ${Target.CleanName} << Dotted with ${Dot${i}}
            /varset DotTimer${i} ${Math.Calc[${Spell[${DotID[${i}]}].Duration.TotalSeconds}-6]}s
          } else /if (${castReturn.Equal[CAST_IMMUNE]} || ${spellNotHold}) {
            /varset DotTimer${i} 1000s
            /goto :NextDot
          }
        }
      }
    :NextDot
    /next i
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: AutoStun
|--------------------------------------------------------------------------------
Sub AutoStun
/declare i int local
/for i 1 to ${autoStunTotal}
    /if (${refreshTime} && ${useManaRobe}) /call ManaRobe
    /if (${useStun}) /call Cast "${autoStunSpell${i}}" ${autoStunGem${i}} 2s
    /call CheckRune 90
/next i
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: AddToRaidQueue
|--------------------------------------------------------------------------------
Sub AddToRaidQueue(int Buffee,int BuffNumber)
  /declare a int local
  /declare Compare int local
  /if (${RaidQueueCount}<72&&${Spawn[${Buffee}].Type.NotEqual[Corpse]}&&${Spawn[${Buffee}].ID}) {
    /varset Compare 0
    /for a 1 to 72
      /if ((${Buffee}==${RaidBuffQueue[${a},1]}||(${Select[${Spell[${RaidBuffID[${RaidBuffQueue[${a},2]}]}].TargetType},"Group v2","AE PC v2","Group v1","AE PC v1"]}&&${Group.Member[${Spawn[${Buffee}].CleanName}]}&&${Group.Member[${Spawn[${RaidBuffQueue[${a},1]}].CleanName}]}))&&${BuffNumber}==${RaidBuffQueue[${a},2]}) /varset Compare 1
    /next a
    /if (!${Compare}) {
      /for a 1 to 72
        /if (!${RaidBuffQueue[${a},1]}) {
          /varset RaidBuffQueue[${a},1] ${Buffee}
          /varset RaidBuffQueue[${a},2] ${BuffNumber}
          /varcalc RaidQueueCount ${RaidQueueCount}+1
          /return
        }
      /next a
    }
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: RemoveFromRaidQueue
|--------------------------------------------------------------------------------
Sub RemoveFromRaidQueue(int Buffee,int BuffNumber)
  /declare a int local
  /for a 1 to 72
    /if (((${Spawn[${RaidBuffQueue[${a},1]}].State.Equal["DEAD"]}||!${Spawn[${RaidBuffQueue[${a},1]}].ID})||(${RaidBuffQueue[${a},1]}==${Buffee}&&${RaidBuffQueue[${a},2]}==${BuffNumber}))&&${RaidBuffQueue[${a},1]}) {
      /varset RaidBuffQueue[${a},1] 0
      /varset RaidBuffQueue[${a},2] 0
      /varcalc RaidQueueCount ${RaidQueueCount}-1
      /return
    }
  /next a
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: RaidBuffEvents
|--------------------------------------------------------------------------------
Sub RaidBuffEvents
  /declare a int local
  /if (${Target.ID}) /declare OldTarget int local ${Target.ID}
  /for a 1 to 72
    /if ((${Spawn[${RaidBuffQueue[${a},1]}].Distance}>${Spell[${RaidBuffID[${RaidBuffQueue[${a},2]}]}].MyRange}&&${Spawn[${RaidBuffQueue[${a},1]}].Distance}>${Spell[${RaidBuffID[${RaidBuffQueue[${a},2]}]}].AERange})||!${Spawn[${RaidBuffQueue[${a},1]}].ID}||((!${Me.SpellReady[${RaidBuff${RaidBuffQueue[${a},2]}}]}&&${Me.Gem[${RaidBuff${RaidBuffQueue[${a},2]}}]})&&${RaidBuffGem${RaidBuffQueue[${a},2]}.NotEqual[item]}&&${RaidBuffGem${RaidBuffQueue[${a},2]}.NotEqual[alt]})) /goto :NextRaidBuff
    /squelch /target id ${RaidBuffQueue[${a},1]}
    /delay 1s ${Target.ID}==${RaidBuffQueue[${a},1]}
    /if (${Target.ID}==${RaidBuffQueue[${a},1]}&&${Target.Distance}<=${Spell[${RaidBuffID[${RaidBuffQueue[${a},2]}]}].MyRange}) {
      /if (${DoBuffTells}&&!${SpamTimer}&&${Target.ID}!=${Me.ID}) /tt ${RaidBuffIcon${RaidBuffQueue[${a},2]}} inc
      /call Cast "${RaidBuff${RaidBuffQueue[${a},2]}}" ${RaidBuffGem${RaidBuffQueue[${a},2]}} 3s
      /if (${castReturn.Equal[CAST_SUCCESS]} || ${spellNotHold}) /call RemoveFromRaidQueue ${RaidBuffQueue[${a},1]} ${RaidBuffQueue[${a},2]}
      /if (${Spawn[${OldTarget}].ID}) {
        /if (${Target.ID}!=${Spawn[${OldTarget}].ID}) /target id ${OldTarget}
      } else {
        /squelch /target clear
      }
      /return
    }
  :NextRaidBuff
  /next a
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Consider
|--------------------------------------------------------------------------------
Sub Consider
  /declare tempID int local
  /if (!${Defined[ConsiderReturn]}) /declare ConsiderReturn int outer
  /varset ConsiderReturn 0
  /if (${Target.ID}) {
     /varset tempID ${Target.ID}
     /if (!${Defined[ConsiderTarget${tempID}]}) /declare ConsiderTarget${tempID} int outer 1
     /consider
    /delay 2
    /doevents
  }
  /if (${ConsiderReturn}) /return ${ConsiderReturn}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: LoadIni
|--------------------------------------------------------------------------------
Sub LoadIni(iniName,Function)
  /declare i int local
  /if (!${Defined[homeX]}) /declare homeX int outer ${Me.X}
  /if (!${Defined[homeY]}) /declare homeY int outer ${Me.Y}
  /if (!${Defined[tetheredToHome]}) /declare tetheredToHome outer TRUE
  /if (!${Defined[ExcludeList]}) /declare ExcludeList string outer
  /if (!${Defined[followName]}) /declare followName string outer null
  /if (!${Defined[totalKills]}) /declare totalKills int outer 0
  /if (!${Defined[mezzImmuneList]}) /declare mezzImmuneList string outer
  /if (!${Defined[currentZone]}) /declare currentZone int outer
  /if (!${Defined[normalOffhand]}) /declare normalOffhand string outer ${InvSlot[offhand].Item.Name}
  /if (!${Defined[totalMeleeDmg]}) /declare totalMeleeDmg int outer
  /if (!${Defined[totalNonMeleeDmg]}) /declare totalNonMeleeDmg int outer
  /if (!${Defined[fightStartTime]}) /declare fightStartTime float outer
  /if (!${Defined[fightTotalTime]}) /declare fightTotalTime float outer
  /if (!${Defined[deathFlag]}) /declare deathFlag bool outer ${Me.Buff[Revival Sickness].ID}
  /if (!${Defined[mobID]}) /declare mobID int outer 0
  /if (!${Defined[addID]}) /declare addID int outer 0
  /if (!${Defined[petAttacking]}) /declare petAttacking bool outer false
  /if (!${Defined[addIndex]}) /declare addIndex int outer
  /if (!${Defined[mobList]}) /declare mobList string outer
  /if (!${Defined[addList]}) /declare addList string outer
  /if (!${Defined[newAdds]}) /declare newAdds int outer 0
  /if (!${Defined[assistWaitTimer]}) /declare assistWaitTimer timer outer 0
  /if (!${Defined[aggroAnim]}) /declare aggroAnim string outer |5|8|12|17|18|42|44|80|106|129|144|
  /if (!${Defined[petCheck]}) /declare petCheck bool outer false
  /if (!${Defined[petID]}) /declare petID int outer 0
  /if (!${Defined[petOff]}) /declare petOff int outer 0
  /if (!${Defined[useAnchor]}) /declare useAnchor int outer
  /if (!${Defined[anchorX]}) /declare anchorX float outer
  /if (!${Defined[anchorY]}) /declare anchorY float outer
  /if (!${Defined[anchorHeading]}) /declare anchorHeading float outer
  /if (!${Defined[leashLength]}) /declare leashLength int outer
  /if (!${Defined[modRodTimer]}) /declare modRodTimer timer outer
  /if (!${Defined[nukeWaitTimer]}) /declare nukeWaitTimer timer outer 0
  /if (!${Defined[nukeWaitMod]}) /declare nukeWaitMod int outer 0
  /if (!${Defined[mainTank]}) /declare mainTank string outer
  /if (!${Defined[validTarget]}) /declare validTarget int outer
  /if (!${Defined[engaged]}) /declare engaged int outer
  /if (!${Defined[mobHPStart]}) /declare mobHPStart int outer
  /if (!${Defined[askedForRodTimer]}) /declare askedForRodTimer timer outer 0
  /if (!${Defined[spamDelay]}) /declare spamDelay timer outer 0
  /if (!${Defined[qbTimer]}) /declare qbTimer timer outer 0
  /if (!${Defined[epicTimer]}) /declare epicTimer timer outer 0
  /if (!${Defined[following]}) /declare following bool outer false
  /if (!${Defined[outdoors]}) /declare outdoors bool outer true
  /if (!${Defined[PreviousSpell]}) /declare PreviousSpell int outer 0
  /if (!${Defined[buffQueue]}) /declare buffQueue string outer
  /if (!${Defined[selfRuneTimer]}) /declare selfRuneTimer timer outer
  /if (!${Defined[oldItem]}) /declare oldItem string outer
  /if (!${Defined[focusSlotName]}) /declare focusSlotName string outer
  /call LoadVar Misc LoadDate "${MacroQuest.BuildDate}" LoadDate "${iniName}" ${Function} string
  /call LoadVar Settings UseConsider FALSE UseConsider "${iniName}" ${Function} bool
  /call LoadVar Settings ZoneDelay 10 ZoneDelay "${iniName}" ${Function} int
  /call LoadVar Settings announce TRUE announce "${iniName}" ${Function} bool
  /call LoadVar Settings announceTells FALSE announceTells "${iniName}" ${Function} bool
  /call LoadVar Settings autoAnchor FALSE autoAnchor "${iniName}" ${Function} bool
  /call LoadVar Settings autoAnnounce FALSE autoAnnounce "${iniName}" ${Function} bool
  /call LoadVar Settings autoBuff 1 autoBuff "${iniName}" ${Function} int
  /call LoadVar Settings autoC7 TRUE autoC7 "${iniName}" ${Function} bool
  /call LoadVar Settings autoSit TRUE autoSit "${iniName}" ${Function} bool
  /call LoadVar Settings begForBuffs TRUE begForBuffs "${iniName}" ${Function} bool
  /call LoadVar Settings chatChannel "Put your chat channel here" chatChannel "${iniName}" ${Function} string
  /call LoadVar Settings checkNamed FALSE checkNamed "${iniName}" ${Function} bool
  /call LoadVar Settings cleanUp FALSE cleanUp "${iniName}" ${Function} bool
  /call LoadVar Settings distanceToSit 40 distanceToSit "${iniName}" ${Function} int   
  /call LoadVar Settings defaultAssist "Put your default assist here" defaultAssist "${iniName}" ${Function} string
  /call LoadVar Settings engageDelay 55 engageDelay "${iniName}" ${Function} int
  /call LoadVar Settings hasteGroup TRUE hasteGroup "${iniName}" ${Function} bool
  /call LoadVar Settings ignoreList "Put your ignoreList here" ignoreList "${iniName}" ${Function} string
  /call LoadVar Settings mainAssist "Put your main assist here" mainAssist "${iniName}" ${Function} string
  /call LoadVar Settings manaRobeMaxMana 90 manaRobeMaxMana "${iniName}" ${Function} int
  /call LoadVar Settings manaRobeMinMana 70 manaRobeMinMana "${iniName}" ${Function} int
  /call LoadVar Settings manaRobeMode 1 manaRobeMode "${iniName}" ${Function} int
  /call LoadVar Settings maxAEMezLevel 75 maxAEMezLevel "${iniName}" ${Function} int
  /call LoadVar Settings maxMezLevel 78 maxMezLevel "${iniName}" ${Function} int
  /call LoadVar Settings maxPBAEMezLevel 75 maxPBAEMezLevel "${iniName}" ${Function} int
  /call LoadVar Settings minHP 85 minHP "${iniName}" ${Function} int
  /call LoadVar Settings minMana 90 minMana "${iniName}" ${Function} int
  /call LoadVar Settings minRadius 150 minRadius "${iniName}" ${Function} int
  /call LoadVar Settings noInterrupt 1 noInterrupt "${iniName}" ${Function} int
  /call LoadVar Settings noInvis 1 noInvis "${iniName}" ${Function} int
  /call LoadVar Settings nukeDelay 0 nukeDelay "${iniName}" ${Function} int
  /call LoadVar Settings nukeMana 50 nukeMana "${iniName}" ${Function} int
  /call LoadVar Settings nukeMode 1 nukeMode "${iniName}" ${Function} int
  /call LoadVar Settings rodBitch "Put the name of your rod bitch here" rodBitch "${iniName}" ${Function} string
  /call LoadVar Settings runeHP 70 runeHP "${iniName}" ${Function} int
  /call LoadVar Settings secondAssist "Put your second assist here" secondAssist "${iniName}" ${Function} string
  /call LoadVar Settings spellSet "Put your spell set here" spellSet "${iniName}" ${Function} string
  /call LoadVar Settings useAARune FALSE useAARune "${iniName}" ${Function} bool 
  /call LoadVar Settings useCharm FALSE useCharm "${iniName}" ${Function} bool
  /call LoadVar Settings useCripple FALSE useCripple "${iniName}" ${Function} bool
  /call LoadVar Settings useDPS FALSE useDPS "${iniName}" ${Function} bool
  /call LoadVar Settings useDebuff TRUE useDebuff "${iniName}" ${Function} bool
  /call LoadVar Settings useEpic FALSE useEpic "${iniName}" ${Function} bool
  /call LoadVar Settings useManaFlare FALSE useManaFlare "${iniName}" ${Function} bool
  /call LoadVar Settings useManaRobe FALSE useManaRobe "${iniName}" ${Function} bool
  /call LoadVar Settings useManaStone FALSE useManaStone "${iniName}" ${Function} bool
  /call LoadVar Settings useMez TRUE useMez "${iniName}" ${Function} bool
  /call LoadVar Settings useMindShatter FALSE useMindShatter "${iniName}" ${Function} bool
  /call LoadVar Settings useMitigate FALSE useMitigate "${iniName}" ${Function} bool
  /call LoadVar Settings useMount FALSE useMount "${iniName}" ${Function} bool
  /call LoadVar Settings useSlow TRUE useSlow "${iniName}" ${Function} bool
  /call LoadVar Settings useStun TRUE useStun "${iniName}" ${Function} bool
  /call LoadVar Settings useTash TRUE useTash "${iniName}" ${Function} bool
  /call LoadVar Settings useTashFocus FALSE useTashFocus "${iniName}" ${Function} bool
  /call LoadVar Spells aeMezGem "gem4" aeMezGem "${iniName}" ${Function} string
  /call LoadVar Spells aeMezSpell "Wake of Subdual" aeMezSpell "${iniName}" ${Function} string
  /call LoadVar Spells charmGem "gem6" charmGem "${iniName}" ${Function} string
  /call LoadVar Spells charmSpell "Coax" charmSpell "${iniName}" ${Function} string
  /call LoadVar Spells crippleDuration 2100 crippleDuration "${iniName}" ${Function} string
  /call LoadVar Spells crippleGem "gem6" crippleGem "${iniName}" ${Function} string
  /call LoadVar Spells crippleSpell "Fractured Conciousness" crippleSpell "${iniName}" ${Function} string
  /call LoadVar Spells dispellGem "gem4" dispellGem "${iniName}" ${Function} string
  /call LoadVar Spells dispellSpell "Recant Magic" dispellSpell "${iniName}" ${Function} string
  /call LoadVar Spells groupC7 "Voice of Intuition" groupC7 "${iniName}" ${Function} string
  /call LoadVar Spells groupHasteSpell "Hastening of Ellowind" groupHasteSpell "${iniName}" ${Function} string
  /call LoadVar Spells hasteSpellGem "gem2" hasteSpellGem "${iniName}" ${Function} string
  /call LoadVar Spells invisSpell "Cloud of Indifference" invisSpell "${iniName}" ${Function} string
  /call LoadVar Spells invisSpellGem "gem4" invisSpellGem "${iniName}" ${Function} string
  /call LoadVar Spells manaFlareGem "gem2" manaFlareGem "${iniName}" ${Function} string
  /call LoadVar Spells manaFlareSpell "Mana Flare" manaFlareSpell "${iniName}" ${Function} string
  /call LoadVar Spells mezDuration 500 mezDuration "${iniName}" ${Function} string
  /call LoadVar Spells mezGem "gem8" mezGem "${iniName}" ${Function} string
  /call LoadVar Spells mezSpell "Bewilderment" mezSpell "${iniName}" ${Function} string
  /call LoadVar Spells mindShatterGem "gem2" mindShatterGem "${iniName}" ${Function} string
  /call LoadVar Spells mindShatterSpell "Mind Shatter" mindShatterSpell "${iniName}" ${Function} string
  /call LoadVar Spells mitigateSpell "Boggle" mitigateSpell "${iniName}" ${Function} string
  /call LoadVar Spells mitigateSpellGem "gem4" mitigateSpellGem "${iniName}" ${Function} string
  /call LoadVar Spells nuke1hpstart "98" nuke1hpstart "${iniName}" ${Function} string
  /call LoadVar Spells nuke1hpstop "0" nuke1hpstop "${iniName}" ${Function} string
  /call LoadVar Spells nuke1minmana "40" nuke1minmana "${iniName}" ${Function} string
  /call LoadVar Spells nuke1 "Polychaotic Assault Rk. II" nuke1 "${iniName}" ${Function} string
  /call LoadVar Spells nuke1Gem "gem1" nuke1Gem "${iniName}" ${Function} string
  /call LoadVar Spells nuke2hpstart "98" nuke2hpstart "${iniName}" ${Function} string
  /call LoadVar Spells nuke2hpstop "0" nuke2hpstop "${iniName}" ${Function} string
  /call LoadVar Spells nuke2minmana "40" nuke2minmana "${iniName}" ${Function} string
  /call LoadVar Spells nuke2 "Psychosis" nuke2 "${iniName}" ${Function} string
  /call LoadVar Spells nuke2Gem "gem9" nuke2Gem "${iniName}" ${Function} string
  /call LoadVar Spells pacifyGem "gem4" pacifyGem "${iniName}" ${Function} string
  /call LoadVar Spells pacifySpell "Quiet Mind" pacifySpell "${iniName}" ${Function} string
  /call LoadVar Spells pbaeMezGem "gem4" pbaeMezGem "${iniName}" ${Function} string
  /call LoadVar Spells pbaeMezSpell "Dreams of Veldyn" pbaeMezSpell "${iniName}" ${Function} string
  /call LoadVar Spells rootSpell "Greater Fetter" rootSpell "${iniName}" ${Function} string
  /call LoadVar Spells rootSpellGem "gem6" rootSpellGem "${iniName}" ${Function} string
  /call LoadVar Spells runeSpell "Rune of Ellowind" runeSpell "${iniName}" ${Function} string
  /call LoadVar Spells runeSpellGem "gem4" runeSpellGem "${iniName}" ${Function} string
  /call LoadVar Spells selfAARune "Eldritch Rune" selfAARune "${iniName}" ${Function} string
  /call LoadVar Spells selfRune "Draconic Rune" selfRune "${iniName}" ${Function} string
  /call LoadVar Spells shielding "Sorcerous Shield" shielding "${iniName}" ${Function} string
  /call LoadVar Spells singleC7 "Seer's Intuition" singleC7 "${iniName}" ${Function} string
  /call LoadVar Spells singleHasteSpell "Speed of Ellowind" singleHasteSpell "${iniName}" ${Function} string
  /call LoadVar Spells slowDuration 2100 slowDuration "${iniName}" ${Function} string
  /call LoadVar Spells slowSpell "Forlorn Deeds" slowSpell "${iniName}" ${Function} string
  /call LoadVar Spells slowType "gem5" slowType "${iniName}" ${Function} string
  /call LoadVar Spells stunSpell "Color Collapse" stunSpell "${iniName}" ${Function} string
  /call LoadVar Spells stunSpellGem "gem7" stunSpellGem "${iniName}" ${Function} string
  /call LoadVar Spells tashDuration 14m tashDuration "${iniName}" ${Function} string
  /call LoadVar Spells tashGem "gem2" tashGem "${iniName}" ${Function} string
  /call LoadVar Spells tashSpell "Echo of Tashan" tashSpell "${iniName}" ${Function} string
  /call LoadVar Items hpRobe "${InvSlot[chest].Item.Name}" hpRobe "${iniName}" ${Function} string
  /call LoadVar Items useFood FALSE useFood "${iniName}" ${Function} bool
  /call LoadVar Items foodPack "pack8" foodPack "${iniName}" ${Function} string
  /call LoadVar Items statFood "Misty Thicket Picnic" statFood "${iniName}" ${Function} string
  /call LoadVar Items food1 " " food1 "${iniName}" ${Function} string
  /call LoadVar Items food2 " " food2 "${iniName}" ${Function} string
  /call LoadVar Items food3 " " food3 "${iniName}" ${Function} string
  /call LoadVar Items food4 " " food4 "${iniName}" ${Function} string
  /call LoadVar Items food5 " " food5 "${iniName}" ${Function} string
  /call LoadVar Items meleeWep " " meleeWep "${iniName}" ${Function} string
  /call LoadVar Items tashFocusItem " " tashFocusItem "${iniName}" ${Function} string
  /call LoadVar Items normalMainhand "${InvSlot[mainhand].Item.Name}" normalMainhand "${iniName}" ${Function} string
  /call LoadVar Items extEnhanceItem "Put the name of your extended enhancement item here" extEnhanceItem "${iniName}" ${Function} string
  /call LoadVar Items useExtEnhanceFocus FALSE useExtEnhanceFocus "${iniName}" ${Function} bool
  /call LoadVar SelfBuffStuff selfBuffTotal 1 selfBuffTotal "${iniName}" ${Function} int
  /if (${selfBuffTotal}) {
    /if (!${Defined[selfBuffID]}) /declare selfBuffID[${selfBuffTotal}] int outer
    /if (!${Defined[selfBuffTimer]}) /declare selfBuffTimer timer outer
    /call LoadVar SelfBuffStuff selfBuffs TRUE selfBuffs "${iniName}" ${Function} bool
    /call LoadVar SelfBuffStuff selfBuffRecheck 10s selfBuffRecheck "${iniName}" ${Function} string
    /call LoadVar SelfBuffStuff useAura FALSE useAura "${iniName}" ${Function} bool
    /call LoadVar SelfBuffStuff auraBuffTotal 1 auraBuffTotal "${iniName}" ${Function} int
    /for i 1 to ${auraBuffTotal}
      /call LoadVar SelfBuffStuff auraBuff${i} "Self Aura Spell or Combat Ability full name" auraBuff${i} "${iniName}" ${Function} string
      /call LoadVar SelfBuffStuff auraBuffEffect${i} "Self Aura Effect or Combat Ability Effect full name" auraBuffEffect${i} "${iniName}" ${Function} string
      /call LoadVar SelfBuffStuff auraBuffGem${i} "gem# for spell, comb for combat ability" auraBuffGem${i} "${iniName}" ${Function} string
    /next i
    /for i 1 to ${selfBuffTotal}
      /call LoadVar SelfBuffStuff selfBuff${i} "Self Buff item/Spell #${i}" selfBuff${i} "${iniName}" ${Function} string
      /call LoadVar SelfBuffStuff selfBuffIcon${i} "Self Buff #${i} Buff Icon" selfBuffIcon${i} "${iniName}" ${Function} string
      /call LoadVar SelfBuffStuff selfBuffGem${i} "Self Buff #${i} Gem or put item if an item" selfBuffGem${i} "${iniName}" ${Function} string
      /call LoadVar SelfBuffStuff selfBuffCount${i} 15 selfBuffCount${i} "${iniName}" ${Function} int
      /call LoadVar SelfBuffStuff selfBuffIndoors${i} 0 selfBuffIndoors${i} "${iniName}" ${Function} int
      /if (${Select[${selfBuffGem${i}},item,alt]}) {
        /varset selfBuffID[${i}] ${Spell[${selfBuffIcon${i}}].ID}
      } else {
        /varset selfBuffID[${i}] ${Me.Book[${Me.Book[${selfBuffIcon${i}}]}].ID}
      }
    /next i
  }
  /call LoadVar DoBuffStuff doBuffTotal 1 doBuffTotal "${iniName}" ${Function} int
  /if (${doBuffTotal}) {
    /if (!${Defined[doBuffID]}) /declare doBuffID[${doBuffTotal}] int outer
    /if (!${Defined[doBuffQueue]}) /declare doBuffQueue[25,2] int outer
    /if (!${Defined[QueueCount]}) /declare QueueCount int outer
    /call LoadVar DoBuffStuff doBuffs TRUE doBuffs "${iniName}" ${Function} bool
    /call LoadVar DoBuffStuff doBuffTells TRUE doBuffTells "${iniName}" ${Function} bool
    /call LoadVar DoBuffStuff refreshBuffs FALSE refreshBuffs "${iniName}" ${Function} bool
    /call LoadVar DoBuffStuff doBuffMana 0 doBuffMana "${iniName}" ${Function} int
    /call LoadVar DoBuffStuff buffGem "gem4" buffGem "${iniName}" ${Function} string
    /for i 1 to ${doBuffTotal}
      /call LoadVar DoBuffStuff doBuff${i} "Do Buff item/Spell #${i}" doBuff${i} "${iniName}" ${Function} string
      /call LoadVar DoBuffStuff doBuffIcon${i} "Do Buff #${i} Buff Icon" doBuffIcon${i} "${iniName}" ${Function} string
      /call LoadVar DoBuffStuff doBuffGem${i} "Do Buff #${i} Gem or put item if an item" doBuffGem${i} "${iniName}" ${Function} string
      /call LoadVar DoBuffStuff doBuffAliases${i} "Put the keywords you want to respond to for this buff" doBuffAliases${i} "${iniName}" ${Function} string
      /call LoadVar DoBuffStuff doBuffIndoors${i} 0 doBuffIndoors${i} "${iniName}" ${Function} int
      /call LoadVar DoBuffStuff doBuffRefresh${i} 0 doBuffRefresh${i} "${iniName}" ${Function} int
      /if (${Select[${doBuffGem${i}},item,alt]}) {
        /varset doBuffID[${i}] ${Spell[${doBuffIcon${i}}].ID}
      } else {
        /varset doBuffID[${i}] ${Me.Book[${Me.Book[${doBuffIcon${i}}]}].ID}
      }
    /next i
  }
  /call LoadVar RaidBuffs RaidBuffTotal 1 RaidBuffTotal "${iniName}" ${Function} int
  /if (${RaidBuffTotal}) {
    /if (!${Defined[RaidBuffQueue]}) /declare RaidBuffQueue[72,2] int outer
    /if (!${Defined[RaidQueueCount]}) /declare RaidQueueCount int outer
    /if (!${Defined[RaidBuffID]}) /declare RaidBuffID[${RaidBuffTotal}] int outer
    /call LoadVar RaidBuffs DoRaidBuffs TRUE DoRaidBuffs "${iniName}" ${Function} bool
    /for i 1 to ${RaidBuffTotal}
      /call LoadVar RaidBuffs RaidBuff${i} "Raid Buff item/Spell #${i}" RaidBuff${i} ${iniName} ${Function} string
      /call LoadVar RaidBuffs RaidBuffIcon${i} "Raid Buff #${i} Buff Icon" RaidBuffIcon${i} ${iniName} ${Function} string
      /call LoadVar RaidBuffs RaidBuffGem${i} "Raid Buff #${i} Gem or put item if an item" RaidBuffGem${i} ${iniName} ${Function} string
      /call LoadVar RaidBuffs RaidBuffIndoors${i} 0 RaidBuffIndoors${i} ${iniName} ${Function} int
      /if (${Select[${RaidBuffGem${i}},item,alt]}) {
        /varset RaidBuffID[${i}] ${Spell[${RaidBuffIcon${i}}].ID}
      } else {
        /varset RaidBuffID[${i}] ${Me.Book[${Me.Book[${RaidBuffIcon${i}}]}].ID}
      }
    /next i
  }
  /call LoadVar DotStuff DotTotal 1 DotTotal "${IniFile}" ${Function} int
  /if (${DotTotal}) {
    /if (!${Defined[DotID]}) /declare DotID[${DotTotal}] int outer
    /if (!${Defined[DotTimer1]}) /declare DotTimer1 timer outer
    /if (!${Defined[DotTimer2]}) /declare DotTimer2 timer outer
    /if (!${Defined[DotTimer3]}) /declare DotTimer3 timer outer
    /if (!${Defined[DotTimer4]}) /declare DotTimer4 timer outer
    /if (!${Defined[DotTimer5]}) /declare DotTimer5 timer outer
    /call LoadVar DotStuff DoDots FALSE DoDots "${IniFile}" ${Function} bool
    /call LoadVar DotStuff DotAt 90 DotAt "${IniFile}" ${Function} int
    /call LoadVar DotStuff DotMinHPs 40 DotMinHPs "${IniFile}" ${Function} int
    /call LoadVar DotStuff DotMinMana 60 DotMinMana "${IniFile}" ${Function} int
    /call LoadVar DotStuff DotRecasts 2 DotRecasts ${IniFile} ${Function} int
    /call LoadVar DotStuff WhichDot 1 WhichDot "${IniFile}" ${Function} int
    /for i 1 to ${DotTotal}
      /call LoadVar DotStuff Dot${i} "Put the name of Dot #${i} here" Dot${i} "${IniFile}" ${Function} string
      /call LoadVar DotStuff DotGem${i} "Put the spell gem you want to cast Dot #${i} from here" DotGem${i} "${IniFile}" ${Function} string
      /call LoadVar DotStuff DotSpellSet${i} 1 DotSpellSet${i} "${IniFile}" ${Function} int
      /if (${Select[${DotGem${i}},item,alt]}) {
        /varset DotID[${i}] ${Spell[${Dot${i}}].ID}
      } else {
        /varset DotID[${i}] ${Me.Book[${Me.Book[${Dot${i}}]}].ID}
      }
    /next i
  }
  /call LoadVar PetStuff petBuffTotal 1 petBuffTotal "${iniName}" ${Function} int
  /if (${petBuffTotal}) {
    /if (!${Defined[petBuffID]}) /declare petBuffID[${petBuffTotal}] int outer
    /if (!${Defined[petBuffTimer]}) /declare petBuffTimer timer outer
    /call LoadVar PetStuff usePet TRUE usePet "${iniName}" ${Function} bool
    /call LoadVar PetStuff petSpell "Ellowind's Animation" petSpell "${iniName}" ${Function} string
    /call LoadVar PetStuff petSpellGem "gem4" petSpellGem "${iniName}" ${Function} string
    /call LoadVar PetStuff doPetBuffs TRUE doPetBuffs "${iniName}" ${Function} bool
    /call LoadVar PetStuff petBuffRecheck 10s petBuffRecheck ${iniName} ${Function} string
    /call LoadVar PetStuff ShrinkPet TRUE ShrinkPet "${iniName}" ${Function} bool
    /call LoadVar PetStuff ShrinkPetSpell "Tiny Companion" ShrinkPetSpell "${iniName}" ${Function} string
    /call LoadVar PetStuff ShrinkPetSpellGem "gem4" ShrinkPetSpellGem "${iniName}" ${Function} string
    /for i 1 to ${petBuffTotal}
      /call LoadVar PetStuff petBuff${i} "pet Buff item/Spell #${i}" petBuff${i} ${iniName} ${Function} string
      /call LoadVar PetStuff petBuffIcon${i} "pet Buff #${i} Buff Icon" petBuffIcon${i} ${iniName} ${Function} string
      /call LoadVar PetStuff petBuffGem${i} "pet Buff #${i} Gem or put item if an item" petBuffGem${i} ${iniName} ${Function} string
      /call LoadVar PetStuff petBuffIndoors${i} 0 petBuffIndoors${i} ${iniName} ${Function} int
      /if (${Select[${petBuffGem${i}},item,alt]}) {
        /varset petBuffID[${i}] ${Spell[${petBuffIcon${i}}].ID}
      } else {
        /varset petBuffID[${i}] ${Me.Book[${Me.Book[${petBuffIcon${i}}]}].ID}
      }
    /next i
  }
  /call LoadVar AutoStun autoStunTotal 1 autoStunTotal "${iniName}" ${Function} int
  /call LoadVar AutoStun autoStunDelay 2s autoStunDelay "${iniName}" ${Function} int
  /if (${autoStunTotal}) {
     /for i 1 to ${autoStunTotal}
        /call LoadVar AutoStun autoStunSpell${i} "Stun item/spell/alt #${i}" autoStunSpell${i} "${iniName}" ${Function} string
        /call LoadVar AutoStun autoStunGem${i} "Stun #${i} Gem number item or alt" autoStunGem${i} "${iniName}" ${Function} string
     /next i
  }
 
  /call LoadVar Misc Version "1.70c" Version "${iniName}" ${Function} string
 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: LoadAliases
|--------------------------------------------------------------------------------
Sub LoadAliases
  /ini AutoEnc_${Me.Name}.ini Misc LoadDate ${MacroQuest.BuildDate}
  /ini AutoEnc_${Me.Name}.ini Misc Version ${Version}
  /echo Version Mismatch Detected, Loading Aliases
  /squelch /alias /loadini /echo LoadIni
  /squelch /alias /saveini /echo SaveIni
  /squelch /alias /anchor /echo SetAnchor
  /squelch /alias /manarobe /echo Mana Robe
  /squelch /alias /setma /custombind set ma /assist
  /squelch /alias /setsa /custombind set sa /assist
  /squelch /alias /announce /echo ToggleVar Setting announcements to,announce,Settings,announce,
  /squelch /alias /announcetells /echo ToggleVar Setting announce tells to,announceTells,Settings,announceTells,
  /squelch /alias /autoAnnounce /echo ToggleVar Setting auto annouce for EQ chat channels to,autoAnnounce,Settings,autoAnnounce,
  /squelch /alias /autoc7 /echo ToggleVar Setting auto mind candy to,autoC7,Settings,autoC7,
  /squelch /alias /autoloot /echo ToggleVar Setting auto looting to,cleanUp,Settings,cleanUp,
  /squelch /alias /autosit /echo ToggleVar Setting auto medding to,autoSit,Settings,autoSit,
  /squelch /alias /begForBuffs /echo ToggleVar Setting buff begging to,begForBuffs,Settings,begForBuffs,
  /squelch /alias /chatChannel /echo ToggleString Setting chat channel to,chatChannel,Settings,chatChannel,
  /squelch /alias /checknamed /echo ToggleVar Setting checking for named to,checkNamed,Settings,checkNamed,
  /squelch /alias /distancetosit /echo ToggleString Setting distance to sit at,distanceToSit,Settings,distanceToSit,
  /squelch /alias /dobuffmana /echo ToggleString Setting do buff mana to,doBuffMana,DoBuffStuff,doBuffMana,
  /squelch /alias /dobuff /echo ToggleVar Setting do buffs to,doBuffs,DoBuffStuff,doBuffs,
  /squelch /alias /dobufftells /echo ToggleVar Setting do buff tells to,doBuffTells,DoBuffStuff,doBuffTells,
  /squelch /alias /dodots /echo ToggleVar Using Dots,DoDots,DotStuff,DoDots,
  /squelch /alias /dopetbuffs /echo ToggleVar Setting pet buffing to,doPetBuffs,PetStuff,doPetBuffs,
  /squelch /alias /doraidbuffs /echo ToggleVar Setting Raid Buffing,DoRaidBuffs,RaidBuffs,DoRaidBuffs,
  /squelch /alias /dotat /echo ToggleString Setting Dot At,DotAt,DotStuff,DotAt,
  /squelch /alias /engagedelay /echo ToggleString Setting engage delay to,engageDelay,Settings,engageDelay,
  /squelch /alias /hastegroup /echo ToggleVar Setting auto haste to,hasteGroup,Settings,hasteGroup,
  /squelch /alias /minhps /echo ToggleString Setting minimum HPs to,minHP,Settings,minHP,
  /squelch /alias /minmana /echo ToggleString Setting minimum Mana to,minMana,Settings,minMana,
  /squelch /alias /mount /echo ToggleVar Setting use mount to,useMount,Settings,useMount,
  /squelch /alias /nukedelay /echo ToggleString Setting nuke delay to,nukeDelay,Settings,nukeDelay,
  /squelch /alias /nukemana /echo ToggleString Setting nuke mana to,nukeMana,Settings,nukeMana,
  /squelch /alias /nukemode /echo ToggleString Setting nuke mode to,nukeMode,Settings,nukeMode,
  /squelch /alias /useaura /echo ToggleVar Setting use aura to,useAura,SelfBuffStuff,useAura,
  /squelch /alias /usecharm /echo ToggleVar Setting use charm to,useCharm,Settings,useCharm,
  /squelch /alias /useconsider /echo ToggleVar Using Consider,UseConsider,Settings,UseConsider,
  /squelch /alias /usecripple /echo ToggleVar Setting use cripple to,useCripple,Settings,useCripple,
  /squelch /alias /usedebuff /echo ToggleVar Setting use debuffs to,useDebuff,Settings,useDebuff,
  /squelch /alias /usedps /echo ToggleVar Setting use Dps to,useDPS,Settings,useDPS,
  /squelch /alias /useepic /echo ToggleVar Setting use epic to,useEpic,Settings,useEpic,
  /squelch /alias /usefood /echo ToggleVar Setting use food to,useFood,Items,useFood,
  /squelch /alias /usemanaflare /echo ToggleVar Setting use mana flare to,useManaFlare,Settings,useManaFlare,
  /squelch /alias /usemanarobe /echo ToggleVar Setting use mana robe to,useManaRobe,Settings,useManaRobe,
  /squelch /alias /usemanastone /echo ToggleVar Setting use mana stone to,useManaStone,Settings,useManaStone,
  /squelch /alias /usemez /echo ToggleVar Setting use mez to,useMez,Settings,useMez,
  /squelch /alias /usemindshatter /echo ToggleVar Setting use mind shatter to,useMindShatter,Settings,useMindShatter,
  /squelch /alias /usemitigate /echo ToggleVar Setting use mitigate to,useMitigate,Settings,useMitigate,
  /squelch /alias /usepet /echo ToggleVar Setting summon pet to,usePet,PetStuff,usePet,
  /squelch /alias /useslow /echo ToggleVar Setting use slow to,useSlow,Settings,useSlow,
  /squelch /alias /usetash /echo ToggleVar Setting use tash to,useTash,Settings,useTash,
  /squelch /alias /usetashfocus /echo ToggleVar Setting use tash focus to,useTashFocus,Settings,useTashFocus,
  /squelch /alias /radius /echo ToggleString Setting minimum radius,minRadius,Settings,minRadius,
  /squelch /alias /refreshbuffs /echo ToggleVar Setting refresh buffs to,refreshBuffs,DoBuffStuff,refreshBuffs,
  /squelch /alias /runehps /echo ToggleString Setting rune HPs to,runeHP,Settings,runeHP,
  /squelch /alias /rodbitch /echo ToggleString Setting rod bitch to,rodBitch,Settings,rodBitch,
  /squelch /alias /selfbuff /echo ToggleVar Setting self buffing to,selfBuffs,SelfBuffStuff,selfBuffs,
  /squelch /alias /shrinkpet /echo ToggleVar Setting shrink pet to,ShrinkPet,PetStuff,ShrinkPet,
  /squelch /alias /spellset /echo ToggleString Setting spell set to,spellSet,Settings,spellSet,
  /squelch /alias /whichdot /echo ToggleString Setting Dot Spell Set,WhichDot,DotStuff,WhichDot,
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: AddToQueue2
|--------------------------------------------------------------------------------
Sub AddToQueue2(int Buffee,int BuffNumber)
  /declare a int local
  /declare Compare int local
  /if (${QueueCount}<25 && ${Spawn[${Buffee}].Type.NotEqual[Corpse]} && ${Spawn[${Buffee}].ID}) {
    /varset Compare 0
    /for a 1 to 25
      /if ((${Buffee}==${doBuffQueue[${a},1]} || (${Select[${Spell[${doBuffID[${doBuffQueue[${a},2]}]}].TargetType},"Group v2","AE PC v2","Group v1","AE PC v1"]} && ${Group.Member[${Spawn[${Buffee}].CleanName}]} && ${Group.Member[${Spawn[${doBuffQueue[${a},1]}].CleanName}]})) && ${BuffNumber}==${doBuffQueue[${a},2]}) /varset Compare 1
    /next a
    /if (!${Compare}) {
      /for a 1 to 25
        /if (!${doBuffQueue[${a},1]}) {
          /varset doBuffQueue[${a},1] ${Buffee}
          /varset doBuffQueue[${a},2] ${BuffNumber}
          /varcalc QueueCount ${QueueCount}+1
          /return
        }
      /next a
    }
  }
  :DoneQueueing
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: RemoveFromQueue
|--------------------------------------------------------------------------------
Sub RemoveFromQueue(int Buffee,int BuffNumber)
  /declare a int local
  /for a 1 to 25
    /if (((${Spawn[${doBuffQueue[${a},1]}].State.Equal["DEAD"]} || !${Spawn[${doBuffQueue[${a},1]}].ID}) || (${doBuffQueue[${a},1]}==${Buffee} && ${doBuffQueue[${a},2]}==${BuffNumber})) && ${doBuffQueue[${a},1]}) {
      /varset doBuffQueue[${a},1] 0
      /varset doBuffQueue[${a},2] 0
      /varcalc QueueCount ${QueueCount}-1
      /return
    }
  /next a
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: CheckAttacking
|--------------------------------------------------------------------------------
Sub CheckAttacking(int mob)
  /declare animation int local
  /varset animation ${Spawn[${mob}].Animation}
|  /echo Animation #${animation}, by mob ID: ${mob} (${Spawn[${mob}].Name}).
  /if (${animation} == 5) /return 1
  /if (${animation} == 7) /return 1
  /if (${animation} == 8) /return 1
  /if (${animation} == 12) /return 1
  /if (${animation} == 13) /return 1
  /if (${animation} == 16) /return 0
  /if (${animation} == 17) /return 0
  /if (${animation} == 18) /return 2
  /if (${animation} == 26) /return 0
  /if (${animation} == 32) /return 0
  /if (${animation} == 33) /return 0
  /if (${animation} == 34) /return 0
  /if (${animation} == 37) /return 0
  /if (${animation} == 38) /return 0
  /if (${animation} == 42) /return 1
  /if (${animation} == 43) /return 0
  /if (${animation} == 44) /return 1
  /if (${animation} == 71) /return 0
  /if (${animation} == 72) /return 0
  /if (${animation} == 73) /return 0
  /if (${animation} == 80) /return 1
  /if (${animation} == 106) /return 1
  /if (${animation} == 110) /return 1
  /if (${animation} == 111) /return 0
  /if (${animation} == 129) /return 1
  /if (${animation} == 144) /return 1
  /if (${animation} == 146) /return 0
  /echo Unknown Animation #${animation}, by mob ID: ${mob} (${Spawn[${mob}].Name}).
/return 0
|--------------------------------------------------------------------------------


| ======================== EVENTS ========================


|--------------------------------------------------------------------------------
|SUB: Event_Timer
|--------------------------------------------------------------------------------
Sub Event_Timer(string timerName,int timerValue)
  /if (!${Defined[${timerName}]}) /return
  /declare tempID int local 0
  /declare oldTargetID int local ${Target.ID}
  /if (${timerName.Left[9].Equal[tashTimer]}) {
    /varset tempID ${timerName.Right[-9]}
    /if (${Spawn[${tempID}].Type.Equal[NPC]} || ${Spawn[${tempID}].Master.Type.Equal[NPC]}) {
      /target id ${tempID}
      /call Tash
    } else {
      /deletevar ${timerName}
    }
  } else /if (${timerName.Left[9].Equal[slowTimer]}) {
    /varset tempID ${timerName.Right[-9]}
    /if (${Spawn[${tempID}].Type.Equal[NPC]} || ${Spawn[${tempID}].Master.Type.Equal[NPC]}) {
      /target id ${tempID}
      /if (${useSlow}) /call Slow
    } else {
      /deletevar ${timerName}
    }
  } else /if (${timerName.Left[12].Equal[crippleTimer]}) {
    /varset tempID ${timerName.Right[-12]}
    /if (${Spawn[${tempID}].Type.Equal[NPC]} || ${Spawn[${tempID}].Master.Type.Equal[NPC]}) {
      /target id ${tempID}
      /call Synapsis
    } else {
      /deletevar ${timerName}
    }
  } else /if (${timerName.Left[8].Equal[mezTimer]}) {
    /varset tempID ${timerName.Right[-8]}
    /if (${Spawn[${tempID}].Type.Equal[NPC]} || ${Spawn[${tempID}].Master.Type.Equal[NPC]}) {
      /target id ${tempID}
      /delay 1s ${Target.ID}==${tempID}
      /delay 1
      /call Mez
    } else {
      /deletevar ${timerName}
    }
  } else /if (${timerName.Left[17].Equal[bewildermentTimer]}) {
     /varset tempID ${timerName.Right[-17]}
     /if (${timerValue}<20 || ${Spawn[${tempID}].PctHPs}<75) /deletevar ${timerName}     
  } else {
    /return ${Macro.Return}
  }
  /if (${Target.ID}==${tempID}) {
    /if (${Spawn[${oldTargetID}].ID}) {
      /target id ${oldTargetID}
    } else {
      /squelch /target clear
    }
  }
/return ${Macro.Return}
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_AutoStun
|--------------------------------------------------------------------------------
Sub Event_AutoStun(string line,string toggle)
  /if (!${Defined[useStun]}) /declare useStun int outer 0
  /if (${toggle.Equal[on]}) {
    /varset useStun 1
  } else {
    /varset useStun 0
  }
  :stun_loop
  /if (${useStun}) {
     /for i 1 to ${autoStunTotal}
        /if (${SpawnCount[npc radius 30 zradius 30]}>2) {
        /if (${refreshTime} && ${useManaRobe}) /call ManaRobe
        /if (${useStun}) /call Cast "${autoStunSpell${i}}" ${autoStunGem${i}} 2s
        /call CheckRune 90
        /doevents chat
        /doevents EQBC
        /doevents AutoStun
        /delay ${autoStunDelay}
      }
    /next i
    /if (${useStun}) /goto :stun_loop
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_RageOn
|--------------------------------------------------------------------------------
Sub Event_RageOn(string line)
  /if ((${line.Find[${Spawn[${mobID}].DisplayName}]} || ${line.Find[${Target.DisplayName}]}) && ${Me.Pet.ID}) {
    /echo calling off pet...
    /pet back off
    /if (${Me.AltAbility[Pet Discipline]}) /pet hold
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_RageOff
|--------------------------------------------------------------------------------
Sub Event_RageOff(string line)
  /if ((${line.Find[${Spawn[${mobID}].DisplayName}]} || ${line.Find[${Target.DisplayName}]}) && ${Me.Pet.ID}) {
    /target id ${mobID}
    /pet attack
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Mez
|--------------------------------------------------------------------------------
Sub Event_Mez
  /if (${Defined[mezTimer${Target.ID}]}) /deletevar mezTimer${Target.ID}
  /if (${useMez}) /call Mez
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Gate
|--------------------------------------------------------------------------------
Sub Event_Gate(string line,string mobName)
  /if (${Target.ID} && ${Target.ID}==${mobID} && ${Spawn[${mobID}].Level}<=${maxMezLevel} && !${mezzImmuneList.Find[${Target.DisplayName}]}) {
    /if (!${Me.Casting.Name.Equal[${mezSpell}]}) /call Interrupt
    /if (${announce}) /${chatChannel} Interrupting  >> ${Target.CleanName} <<
    /call Cast "${mezSpell}" ${mezGem} 3s
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_DamageMelee
|--------------------------------------------------------------------------------
Sub Event_DamageMelee(string line,int damage)
  /varcalc totalMeleeDmg ${totalMeleeDmg}+${damage}
  /if (!${fightStartTime}) /varset fightStartTime ${MacroQuest.Running}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_DamageNonMelee
|--------------------------------------------------------------------------------
Sub Event_DamageNonMelee(string line,int damage)
  /if (${useDPS}) /varcalc totalNonMeleeDmg ${totalNonMeleeDmg}+${damage}
  /if (!${fightStartTime}) /varset fightStartTime ${MacroQuest.Running}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_SetAnchor
|--------------------------------------------------------------------------------
Sub Event_SetAnchor(string line,string leash)
  /if (${leash.Find[clear]}) {
    /varset useAnchor 0
  } else {
    /varset useAnchor 1
    /varset anchorX ${Me.X}
    /varset anchorY ${Me.Y}
    /varset anchorHeading ${Me.Heading.DegreesCCW}
    /varset leashLength ${leash}
    /echo New anchor: ${Me.Y} ${Me.X}
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Camp
|--------------------------------------------------------------------------------
Sub Event_Camp
  /call SwapStatFood 0
  /if (${Me.Pet.ID}) {
    /stand
    /call Cast "suspended minion" alt 3s
    /camp desktop
  }
  /endmacro
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Command
|--------------------------------------------------------------------------------
Sub Event_Command(string line,string command,string password)
  /if (${line.Left[3].Equal[you]}) /return
  /varset password ${password.Arg[1]}
  /if (${password.Equal[pass]}) /docommand /${command}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_RaidSay
|--------------------------------------------------------------------------------
Sub Event_RaidSay(string line,string chatSender,string chatText)
  /if (${Bool[${chatSender}]}) /call Event_Chat "raid" "${chatSender}" "${chatText}"
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_ChatTell
|--------------------------------------------------------------------------------
Sub Event_ChatTell(string line,string chatSender,string chatText)
  /if (${Bool[${chatSender}]}) /call Event_Chat "tell" "${chatSender}" "${chatText}"
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_EQBC
|--------------------------------------------------------------------------------
Sub Event_EQBC(EQBCSay,EQBCSender,EQBCCommand)
  /if (${EQBCCommand.Left[1].Equal[/]}) {
    /docommand ${EQBCCommand}
  } else {
    /call Event_Chat "EQBC" "${EQBCSender}" "${EQBCCommand}"
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Summon
|--------------------------------------------------------------------------------
Sub Event_Summon
  /call Event_Hit
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_SpellDamage
|--------------------------------------------------------------------------------
Sub Event_SpellDamage(string line,string damage)
  /if (${Int[${damage}]}>60) /call Event_Hit
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Hit
|--------------------------------------------------------------------------------
Sub Event_Hit
  /doevents Dead
  /if (${deathFlag}) /return
  /declare q int local 0
  /declare r int local 0
  /declare tempID int local
  /varset r ${SpawnCount[npc radius 15]}
  /if (${r}) {
     /for q 1 to ${r}
      /varset tempID ${NearestSpawn[${q},npc radius 15].ID}
      /if (!${NearestSpawn[${q},npc radius 15].ID}) /next q
      /squelch /target id ${tempID}
      /delay 5 ${Target.ID}==${tempID}
      /delay 1
      /if (${Me.TargetOfTarget.ID}==${Me.ID} && ${Target.ID} && ${Target.ID}!=${Me.ID} && (!${mezzImmuneList.Find[>> ${Target.CleanName} <<]} || ${mezTimer${Target.ID}} > 0)) {
        /call CheckAttacking ${NearestSpawn[${q},npc radius 15].ID}
        /if (${Macro.Return}) {
           /if (${Me.SpellReady[${stunSpell}]}) /call Cast "${stunSpell}" ${stunSpellGem} 2s
          /if (${Me.PctHPs}<=90 && ${Me.AltAbilityReady[${autoStunSpell1}]} && ${SpawnCount[npc radius 20 zradius 20]}<2) /call Cast "${autoStunSpell1}" alt
          /if (${Me.PctHPs}<=90 && ${Me.AltAbilityReady[${autoStunSpell2}]} && ${SpawnCount[npc radius 20 zradius 20]}>1) /call Cast "${autoStunSpell2}" alt
          /if (${Me.PctHPs}<=85 && !${Me.Buff[${selfRune}].ID} && !${Me.Buff[${selfAARune}].ID} && ${Me.AltAbilityReady[${selfAARune}]}) /call Cast "${selfAARune}" alt
          /if (${Me.PctHPs}<=75 && ${Me.SpellReady[${runeSpell}]} && ${Spell[${runeSpell}].Stacks[0]}) /call AddToQueue "${runeSpell},${Me.Name}"
          /if (${Me.PctHPs}<=65 && ${Me.AltAbilityReady[Doppelganger]})        {
        /if (${Me.Casting.ID} && !${Me.Casting.Name.Equal[${mezSpell}]} && !${Me.Casting.Name.Equal[${AEmezSpell}]} && !${Me.Casting.Name.Equal[${PBAEmezSpell}]}) /call Interrupt
        /call Cast "Doppelganger" alt
        /goto :DefenseAttempted
        }
|xxxxxxxxzzzzzz - Some times you want to punt sometimes you dont - need to add flag to ini file and macro to turn punting on and off.
|          /if (${Me.PctHPs}<=55 && ${Me.AltAbilityReady[Beguiler's Banishment]} && ${SpawnCount[npc radius 20 zradius 20]}>2) /call Cast "Beguiler's Banishment" alt
|          /if (${Me.PctHPs}<=53 && ${Me.AltAbilityReady[Beguiler's Directed Banishment]}) /call Cast "Beguiler's Directed Banishment" alt
           /if (${Me.PctHPs}<=50 && ${Me.AltAbilityReady[Mind Over Matter]})     {
        /if (${Me.Casting.ID} && !${Me.Casting.Name.Equal[${mezSpell}]} && !${Me.Casting.Name.Equal[${AEmezSpell}]} && !${Me.Casting.Name.Equal[${PBAEmezSpell}]}) /call Interrupt
        /call Cast "Mind Over Matter" alt
        /goto :DefenseAttempted
        }
          /if (${Me.PctHPs}<=45 && ${Me.AltAbilityReady[Nightmare Stasis]} && ${Target.Level}<76) /call Cast "Nightmare Stasis" alt
          /if (${Me.PctHPs}<=30 && ${Me.AltAbilityReady[Dimensional Shield]})     {
        /if (${Me.Casting.ID} && !${Me.Casting.Name.Equal[${mezSpell}]} && !${Me.Casting.Name.Equal[${AEmezSpell}]} && !${Me.Casting.Name.Equal[${PBAEmezSpell}]}) /call Interrupt
        /call Cast "Dimensional Shield" alt
        /goto :DefenseAttempted
        }
          /if (${Me.PctHPs}<=27 && ${Me.AltAbilityReady[Dimensional Instability]}) {
        /if (${Me.Casting.ID} && !${Me.Casting.Name.Equal[${mezSpell}]} && !${Me.Casting.Name.Equal[${AEmezSpell}]} && !${Me.Casting.Name.Equal[${PBAEmezSpell}]}) /call Interrupt
        /call Cast "Dimensional Instability" alt
        /goto :DefenseAttempted
        }
          /if (${Me.PctHPs}<=20 && ${Me.AltAbilityReady[Self Stasis]})         {
        /if (${Me.Casting.ID} && !${Me.Casting.Name.Equal[${mezSpell}]} && !${Me.Casting.Name.Equal[${AEmezSpell}]} && !${Me.Casting.Name.Equal[${PBAEmezSpell}]}) /call Interrupt
        /call Cast "Self Stasis" alt
        /goto :DefenseAttempted
        }


:DefenseAttempted
          /if (${Defined[mezTimer${Target.ID}]} && ${mezTimer${Target.ID}} != -1) {
             /varset mezTimer${Target.ID} 20
          } else /if (!${Defined[mezTimer${Target.ID}]}) {
             /declare mezTimer${Target.ID} 20
          }
        }
      }
    /next q
  }
  /doevents flush
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Dead
|--------------------------------------------------------------------------------
Sub Event_Dead
  /if (!${Defined[deathFlag]}) /declare deathFlag bool outer
  /varset deathFlag true
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Zone
|--------------------------------------------------------------------------------
Sub Event_Zone
  /varset currentZone ${Zone.ID}
  /varset outdoors TRUE
  /varset ExcludeList ${Ini[${excludeIni},"ExcludeMobs.${Zone.ShortName}","Exclude"]}
  /if (${ExcludeList.Equal[NULL]}) {
    /ini "${excludeIni}" "ExcludeMobs.${Zone.ShortName}" "Exclude" "|"
    /varset ExcludeList ${Ini[${excludeIni},"ExcludeMobs.${Zone.ShortName}","Exclude"]}
    /echo ExcludeList: ${ExcludeList}
  } else {
    /varset ExcludeList ${Ini[${excludeIni},"ExcludeMobs.${Zone.ShortName}","Exclude"]}
    /echo ExcludeList: ${ExcludeList}
  }
  /varset mezzImmuneList ${Ini[${mezzImmuneIni},"Excludes.${Zone.ShortName}","MezzImmune"]}
  /nomodkey /keypress home
  /if (${mezzImmuneList.Equal[NULL]}) {
     /ini "${mezzImmuneIni}" "Excludes.${Zone.ShortName}" "MezzImmune" "|"
    /varset mezzImmuneList ${Ini[${mezzImmuneIni},"Excludes.${Zone.ShortName}","MezzImmune"]}
    /echo MezzImmuneList: ${mezzImmuneList}
  } else {
     /varset mezzImmuneList ${Ini[${mezzImmuneIni},"Excludes.${Zone.ShortName}","MezzImmune"]}
     /echo MezzImmuneList: ${mezzImmuneList}
  }
  /if (${Defined[mobList]}) /call ClearMobList
  /if (${Defined[addList]}) /varset addList
  /if (${Defined[buffQueue]}) /varset buffQueue
  /if (${Defined[mobID]}) /varset mobID 0
  /if (${Defined[petID]}) /varset petID 0
  /if (${Defined[petID2]}) /varset petID2 0
  /if (${Defined[useAnchor]}) /varset useAnchor 0
  /if (${following}) {
     :WaitForFollowGuy
     /delay 10
     /doevents
     /squelch /target pc ${followName}
     /if (!${Target.ID} || ${Target.ID}!=${Spawn[pc ${followName}].ID}) /goto :WaitForFollowGuy
    /if (${Me.Underwater} || ${Me.Levitating}) {
      /squelch /stick hold 10 uw
    } else {
      /squelch /stick hold 10
    }
     /if (${announce}) /${chatChannel} following ${followName} GTG!
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_CastSpell
|--------------------------------------------------------------------------------
Sub Event_CastSpell(string line,string chatSender,string spellName,string targetName)
  /if (${Defined[targetName]}) {
    /call AddToQueue "${spellName},${targetName}"
  } else /if (!${line.Find[ on ]}) {
    /call AddToQueue "${spellName}"
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Indoors
|--------------------------------------------------------------------------------
Sub Event_Indoors
  /varset useMount FALSE
  /varset outdoors FALSE
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Invited
|--------------------------------------------------------------------------------
Sub Event_Invited
  /delay 5
  /if (!${Me.Grouped}) /keypress invite_follow
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_ManaRobe
|--------------------------------------------------------------------------------
Sub Event_ManaRobe(string line,string settings)
  /declare i int local 1
  :set_robe_loop
  /if (${settings.Arg[${i}].Equal[min]}) {
    /varcalc i ${i}+1
    /varset manaRobeMinMana ${settings.Arg[${i}]}
  } else /if (${settings.Arg[${i}].Equal[max]}) {
    /varcalc i ${i}+1
    /varset manaRobeMaxMana ${settings.Arg[${i}]}
  } else /if (${settings.Arg[${i}].Equal[mode]}) {
    /varcalc i ${i}+1
    /varset manaRobeMode ${settings.Arg[${i}]}
  } else /if (${settings.Arg[${i}].Equal[on]}) {
    /varset manaRobeMode 1
  } else /if (${settings.Arg[${i}].Equal[off]}) {
    /varset manaRobeMode 0
  }
  /varcalc i ${i}+1
  /if (${settings.Arg[${i}].Length}) /goto :set_robe_loop
  /if (${manaRobeMode}==2 && ${Me.PctMana}>${manaRobeMinMana}) /varset useManaRobe FALSE
  /if (${manaRobeMode}==1) /varset useManaRobe TRUE
  /ini "${iniName}" Settings ManaRobeMode ${manaRobeMode}
  /ini "${iniName}" Settings ManaRobeMinMana ${manaRobeMinMana}
  /ini "${iniName}" Settings ManaRobeMaxMana ${manaRobeMaxMana}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_WornOff
|--------------------------------------------------------------------------------
Sub Event_WornOff(Line,SpellName,ToonName)
  /declare i int local
  /if (${doBuffTotal}&&${refreshBuffs}) {
    /for i 1 to ${doBuffTotal}
      /if (${SpellName.Equal[${doBuffIcon${i}}]} && ${doBuffRefresh${i}}) {
        /call AddToQueue2 ${Spawn[pc ${ToonName}].ID} ${i}
      }
    /next i
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_SetMA
|--------------------------------------------------------------------------------
Sub Event_SetMA(string line,string name)
  /if (!${Defined[mainAssist]}) /declare mainAssist string outer
  /varset mainAssist ${name}
  /ini "${iniName}" Settings mainAssist ${name}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_SetSA
|--------------------------------------------------------------------------------
Sub Event_SetSA(string line,string name)
  /if (!${Defined[secondAssist]}) /declare secondAssist string outer
  /varset secondAssist ${name}
  /ini "${iniName}" Settings secondAssist ${name}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Invis
|--------------------------------------------------------------------------------
Sub Event_Invis
  /if (${Me.Book[${invisSpell}]} || ${invisSpellGem.Equal[alt]} && ${Me.AltAbilityReady[${invisSpell}]} || ${invisSpellGem.Equal[item]} && !${FindItem[${invisSpell}].Timer}) {
     /squelch /target myself
     /delay 3s ${Target.ID}==${Me.ID}
     /if (${Target.ID}==${Me.ID}) {
       /call Cast "${invisSpell}" ${invisSpellGem} 5s
       /delay 5
     }
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Dispell
|--------------------------------------------------------------------------------
Sub Event_Dispell
  /if (${Me.Book[${dispellSpell}]} || ${dispellGem.Equal[alt]} && ${Me.AltAbilityReady[${dispellSpell}]} || ${dispellGem.Equal[item]} && !${FindItem[${dispellSpell}].Timer}) /call Cast "${dispellSpell}" ${dispellGem} 5s
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_UquaAE
|--------------------------------------------------------------------------------
Sub Event_UquaAE
  /if (!${Me.Class.PureCaster}) {
    /call EquipItem "${normalOffhand}|offhand"
  } else {
    /call EquipItem "${normalRanged}|ranged"
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_UquaKey
|--------------------------------------------------------------------------------
Sub Event_UquaKey(string line,string key)
  /rs ${key}
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_NukeType
|--------------------------------------------------------------------------------
Sub Event_NukeType(string line,string nukeName)
  /declare nukeType string local ${nukeName.Arg[1]}
  /if (!${Defined[${nukeType}Nuke]}) /return
  /varset nukeName ${nukeName.Right[-${Math.Calc[${nukeType.Length}+1]}]}
  /if (${Me.Book[${nukeName}]}) {
    /varset ${nukeType}Nuke ${nukeName}
    /ini "${iniName}" Spells "${nukeType.Left[1].Upper}${nukeType.Right[-1]}Nuke" "${nukeName}"
  }
  /varset nuke1 ${${nukeType}Nuke}
  /ini "${iniName}" Spells Nuke1 "${nuke1}"
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Exp
|--------------------------------------------------------------------------------
Sub Event_Exp
  /varcalc totalKills ${totalKills}+1
|  /echo ${totalKills} mobs dead
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Chat
|--------------------------------------------------------------------------------
Sub Event_Chat(string chatType,string chatSender,string chatText)
  /declare spellName string local
|  /if (${chatType.Equal[tell]} && ${announceTells}) /beep
  /if (${chatText.Equal[slowcamp]} && (${chatType.Equal[tell]} || ${chatType.Equal[chatChannel]} || ${chatType.Equal[EQBC]})) {
    /if (${Me.Mount.ID}) /dismount
    /if (${Stick.Status.Length}) /stick off
    /camp desktop
  }
  /if (${chatText.Equal[invisoff]}) {
     /if (${Me.Buff[Shared Camouflage].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Shared Camouflage].ID}-1].Int} leftmouseup
    /if (${Me.Buff[Sun Cloak].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Sun Cloak].ID}-1].Int} leftmouseup
    /if (${Me.Buff[Sunskin].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Sunskin].ID}-1].Int} leftmouseup
    /if (${Me.Buff[Fool the Fallen].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Fool the Fallen].ID}-1].Int} leftmouseup
    /if (${Me.Buff[Cloud of Indifference].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Cloud of Indifference].ID}-1].Int} leftmouseup
    /if (${Me.Buff[Perfected Invisibility].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Perfected Invisibility].ID}-1].Int} leftmouseup
  }
  /if (${chatText.Equal[levoff]}) {
     /if (${Me.Buff[Flight of Eagles].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Flight of Eagles].ID}-1].Int} leftmouseup
     /if (${Me.Buff[Spirit of Eagle].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Spirit of Eagle].ID}-1].Int} leftmouseup
     /if (${Me.Buff[Levitation].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Levitation].ID}-1].Int} leftmouseup
     /if (${Me.Buff[Dead Man Floating].ID}) /nomodkey /notify BuffWindow Buff${Math.Calc[${Me.Buff[Dead Man Floating].ID}-1].Int} leftmouseup
  }
  /if (${ignoreList.Find[|${chatSender}|]} || ${chatText.Left[4].Equal[cast]} || !${autoBuff} || ${autoBuff}>2 || ${Spawn[${chatSender}].Type.Equal[NPC]}) /return
  /if (!${Defined[chatTimer]}) /declare chatTimer float outer
  /declare chatTime float local ${MacroQuest.Running}
  /declare oldTarget int local ${Target.ID}
  /declare a int local
  /declare i int local
  /if (${chatText.Equal[mana check]}) /${chatChannel} Chanter Mana ${Me.PctMana}%
  /if (!${Spawn[pc ${chatSender}].ID}) /return
  /if (${chatText.Arg[1].Equal[invite]} && ${GroupLeader.ID}==${Me.ID}) {
    /tar pc ${chatSender}
    /if (${Me.Casting.ID}) /call WaitCast
    /invite
  }
  /if (${doBuffTotal} && ${doBuffs} && ${chatSender.NotEqual[${Me.CleanName}]} && ${Spawn[pc ${chatSender}].ID}) {
    /for i 1 to ${doBuffTotal}
      /if ((!${outdoors} && !${doBuffIndoors${i}})) /goto :SkipBuff
      /for a 1 to ${doBuffAliases${i}.Count[|]}
        /if (${chatText.Find["${doBuffAliases${i}.Arg[${a},|]}"]}) {
          /if (${chatText.Find[" pet "]} || ${chatText.Find[${Spawn[pc ${chatSender}].Pet.CleanName}]}) {
            /call AddToQueue2 ${Spawn[pc ${chatSender}].Pet.ID} ${i}
          } else {
            /call AddToQueue2 ${Spawn[pc ${chatSender}].ID} ${i}
          }
        }
      /next a
      :SkipBuff
    /next i
  }
  /if (${chatText.Find[Illusion:]}) {
    /varset spellName ${chatText}
    /call AddToQueue "${spellName},${chatSender}"
    /return
  }
  /if (${chatText.Equal[pacifytarget]}) {
    /squelch /assist ${chatSender}
    /delay 5s ${Target.Type.Equal[NPC]}
    /if (${Target.ID} && ${Target.Type.Equal[NPC]}) {
      /call AddToQueue "${pacifySpell},${Target.DisplayName}"
      /return
    }
  }
  /if (${chatText.Equal[mezztarget]}) {
    /squelch /assist ${chatSender}
    /delay 5s ${Target.Type.Equal[NPC]}
    /if (${Target.ID} && ${Target.Type.Equal[NPC]}) {
      /call AddToQueue "${mezSpell},${Target.DisplayName}"
      /return
    }
  }
  /if (${chatText.Equal[tashtarget]}) {
    /squelch /assist ${chatSender}
    /delay 5s ${Target.Type.Equal[NPC]}
    /if (${Target.ID} && ${Target.Type.Equal[NPC]}) {
      /call AddToQueue "${tashSpell},${Target.DisplayName}"
      /return
    }
  }
  /if (${chatText.Equal[slowtarget]}) {
    /squelch /assist ${chatSender}
    /delay 5s ${Target.Type.Equal[NPC]}
    /if (${Target.ID} && ${Target.Type.Equal[NPC]}) {
      /call AddToQueue "${slowSpell},${Target.DisplayName}"
      /return
    }
  }
  /if (${chatText.Equal[dispelltarget]}) {
    /squelch /assist ${chatSender}
    /delay 5s ${Target.Type.Equal[NPC]}
    /if (${Target.ID} && ${Target.Type.Equal[NPC]}) {
      /call AddToQueue "${dispellSpell},${Target.DisplayName}"
      /return
    }
  }
  /if (${chatText.Equal[roottarget]}) {
    /squelch /assist ${chatSender}
    /delay 5s ${Target.Type.Equal[NPC]}
    /if (${Target.ID} && ${Target.Type.Equal[NPC]}) {
      /call AddToQueue "${rootSpell},${Target.DisplayName}"
      /return
    }
  }
  /if (${chatText.Equal[follow]} && ${chatSender.NotEqual[${Me.CleanName}]}) {
    /delay 5
    /if (!${Spawn[${chatSender}].ID}) {
      /echo ${chatSender}  is not in zone for me to follow!
      /return
    }
    /varset followName ${chatSender}
    /if (${announce}) /${chatChannel} I am following ${followName}!!!
    /if (${Me.Mount.ID}) /dismount
    /if (${useAnchor}) /varset useAnchor 0
    /if (${autoAnchor}) /anchor clear
    /target pc ${followName}
    /delay 1s ${Target.Name.Equal[${followName}]}
    /if ((${following}==0) && (${Target.Name.Equal[${followName}]})) {
      /stand
      /face fast nolook
      /if (${Me.Underwater} || ${Me.Levitating}) {
         /squelch /stick hold 10 uw
      } else {
        /squelch /stick hold 10
      }
      /varset following TRUE
      /if (!${Target.ID}) /varset following FALSE
      /delay 1
      /doevents
      /return
    }
  }
  /if (${chatText.Equal[follow stop]} && ${chatSender.NotEqual[${Me.CleanName}]}) {
    /if (!${Spawn[${chatSender}].ID}) {
      /return
    }
    :StillMoving
    /delay 1s
    /if (${Spawn[${followName}].Distance}>30) /goto :StillMoving
    /varset following FALSE
    /squelch /stick off
    /keypress forward
    /keypress back
    /keypress home
    /if (${autoAnchor}) /anchor 30
    /if (${announce}) /${chatChannel} I Stopped following ${followName}!!!
    /return
  }
  /if (${chatText.Equal[clickzone]}) {
     /declare OldZoneID int local ${Zone.ID}
     /if (${Stick.Status.Equal[ON]}) /squelch /stick off
     :MoveToDoor
     /if (${OldZoneID}!=${Zone.ID}) /return
     /if (${Target.ID}) /squelch /target clear
     /squelch /doortarget
     /squelch /face fast door
     /if (${DoorTarget.Distance}>12) {
         /nomodkey /keypress forward hold
        /delay 3
        /nomodkey /keypress forward
        :goto :MoveToDoor
     } else /if (${DoorTarget.Distance}<7) {
        /nomodkey /keypress back hold
        /delay 1
        /nomodkey /keypress back
     }
     /delay 2
     /nomodkey /keypress u hold
     /delay 2
     /nomodkey /keypress u
     /delay 2
     /nomodkey /keypress home
     /delay 2
     /nomodkey /keypress u hold
     /delay 2
     /nomodkey /keypress u
    /delay 1s
     /if (${OldZoneID}==${Zone.ID}) /goto :MoveToDoor
  }
  /if (${chatText.Equal[clickdoor]}) {
     /if (${Stick.Status.Equal[ON]}) /squelch /stick off
     :MoveToClick
     /if (${Target.ID}) /squelch /target clear
     /squelch /doortarget
     /squelch /face fast door
     /if (${DoorTarget.Distance}>12) {
         /nomodkey /keypress forward hold
        /delay 3
        /nomodkey /keypress forward
        :goto :MoveToClick
     } else /if (${DoorTarget.Distance}<7) {
        /nomodkey /keypress back hold
        /delay 1
        /nomodkey /keypress back
     }
     /delay ${ZoneDelay}
     /nomodkey /keypress u hold
     /delay 2
     /nomodkey /keypress u
     /delay 2
     /nomodkey /keypress home
     /delay 2s
     /doevents Zone
  }
  /if (${chatText.Equal[leaveraid]} && ${Raid.Member[${Me.CleanName}].ID}) /raiddisband
  /if (${chatText.Equal[pop infusion]} && ${Me.AltAbility[Infusion of the Faithful].ID} && ${Me.AltAbilityReady[Infusion of the Faithful]}) /call Cast "Infusion of the Faithful" alt
  /varcalc chatTimer (${MacroQuest.Running}-${chatTime})/1000
|  /echo ${chatTimer} secs to parse chat
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_ToggleString
|--------------------------------------------------------------------------------
Sub Event_ToggleString(Stuff,TempMessage,TempVar,IniSection,IniEntry,Line)
  /if (${Defined[${TempVar}]}) {
    /if (${Line.Length}) {
      /varset ${TempVar} ${Line}
      /ini "AutoEnc_${Me.Name}.ini" ${IniSection} ${IniEntry} "${${TempVar}}"
    }
    /echo ${TempMessage}: ${${TempVar}}
    /varset ${IniEntry} ${${TempVar}}
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_ToggleVar
|--------------------------------------------------------------------------------
Sub Event_ToggleVar(Stuff,TempMessage,TempVar,IniSection,IniEntry,Line)
  /if (${Defined[${TempVar}]}) {
     /if (!${Line.Length}) {
        /if (${${TempVar}}) {
           /varset ${TempVar} FALSE
        } else {
           /varset ${TempVar} TRUE
        }
     }
     /if (${Line.Arg[1].Equal[ON]} || ${Line.Arg[1].Equal[TRUE]} || ${Line.Arg[1].Equal[1]}) /varset ${TempVar} TRUE
     /if (${Line.Arg[1].Equal[OFF]} || ${Line.Arg[1].Equal[FALSE]} || ${Line.Arg[1].Equal[0]}) /varset ${TempVar} FALSE
     /if (${${TempVar}}) /echo ${TempMessage} ON!
     /if (!${${TempVar}}) /echo ${TempMessage} OFF!
     /if (${IniSection.NotEqual[NULL]} && ${IniEntry.NotEqual[NULL]}) /ini "AutoEnc_${Me.Name}.ini" ${IniSection} ${IniEntry} ${${TempVar}}
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_RaidBuff
|--------------------------------------------------------------------------------
Sub Event_RaidBuff(string line,string BuffCommand)
  /declare j int local
  /if (${BuffCommand.NotEqual[all]} && ${Spawn[pc ${BuffCommand}].ID}) {
     /for j 1 to ${RaidBuffTotal}
        /if (${RaidBuffTotal}) {
          /call AddToQueue2 ${Spawn[pc ${BuffCommand}].ID} ${j}
        }
    /next j
    /return
  }
  /declare a int local
  /declare i int local
  /if (${RaidBuffTotal}&&${DoRaidBuffs}&&${BuffCommand.Equal[all]}) {
    /for i 1 to ${RaidBuffTotal}
      /if (!${Outdoors}&&!${RaidBuffIndoors${i}}) /goto :SkipRaidBuff
      /for a 1 to ${Raid.Members}
         /if (${Select[${Spell[${RaidBuffID[${i}]}].TargetType},"Group v2","AE PC v2","Group v1","AE PC v1"]}&&${Raid.Member[${a}].GroupLeader}) {
            /call AddToRaidQueue ${Spawn[pc ${Raid.Member[${a}]}].ID} ${i}
         } else /if (${Select[${Spell[${RaidBuffID[${i}]}].TargetType},pc,Single]}) {
          /call AddToRaidQueue ${Spawn[pc ${Raid.Member[${a}]}].ID} ${i}
        }
      /next a
    :SkipRaidBuff
    /next i
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_SayZone
|--------------------------------------------------------------------------------
Sub Event_SayZone(string Sender,string ZoneText)
  /if (${Stick.Status.Equal[ON]}) /squelch /stick off
  /squelch /assist ${Sender}
  /squelch /face fast nolook
  /if (${Target.ID}) /squelch /stick 10
  /delay ${ZoneDelay}
  /if (${ZoneText.Equal[hail]}) {
     /h
  } else {
    /say ${ZoneText}
  }
/return
|--------------------------------------------------------------------------------
 

|--------------------------------------------------------------------------------
|SUB: Event_ExcludeMob
|--------------------------------------------------------------------------------
Sub Event_ExcludeMob(string line,string MobName)
  /if (!${ExcludeList.Find[${MobName}]}) {
     /ini "${excludeIni}" "ExcludeMobs.${Zone.ShortName}" "Exclude" "${MobName}|"
  } else }
    /ini "${excludeIni}" "ExcludeMobs.${Zone.ShortName}" "Exclude" "${ExcludeList}${MobName}|"
  }
  /varset ExcludeList ${Ini[${excludeIni},"ExcludeMobs.${Zone.ShortName}","Exclude"]}
  /echo ExcludeList: ${ExcludeList}
/return
|--------------------------------------------------------------------------------
 

|--------------------------------------------------------------------------------
|SUB: Event_Bewilderment
|--------------------------------------------------------------------------------
Sub Event_Bewilderment(string line,string MobName)
  /declare tempID int local
  /if (${Spawn[${MobName}].ID}) {
     /varset tempID ${Spawn[${MobName}].ID}
     /if (!${Defined[bewildermentTimer${tempID}]}) {
        /declare bewildermentTimer${tempID} timer outer
     } else {
       /varset bewildermentTimer${tempID} ${mezDuration}
     }
  }
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_LeviGroup
|--------------------------------------------------------------------------------
Sub Event_LeviGroup
  /declare i int local
  /for i 0 to ${Group}
     /if (${Group.Member[${i}].ID} && ${Group.Member[${i}].Distance}<200) {
       /squelch /target id ${Group.Member[${i}].ID}
       /delay 2s ${Target.ID}==${Group.Member[${i}].ID}
       /if (${Target.ID}==${Group.Member[${i}].ID} && ${Target.Type.NotEqual[Corpse]}) {
          /call Cast "Levitation" gem4 2s
          /delay 5s ${Me.SpellReady[Levitation]}
        }
     }
  /next i
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_Ally
|--------------------------------------------------------------------------------
Sub Event_Consider_Ally
  /varset ConsiderReturn 1 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_Warmly
|--------------------------------------------------------------------------------
Sub Event_Consider_Warmly 
  /varset ConsiderReturn 2 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_Kindly
|--------------------------------------------------------------------------------
Sub Event_Consider_Kindly 
  /varset ConsiderReturn 3 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_Amiable
|--------------------------------------------------------------------------------
Sub Event_Consider_Amiable 
  /varset ConsiderReturn 4 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_Indifferent
|--------------------------------------------------------------------------------
Sub Event_Consider_Indifferent 
  /varset ConsiderReturn 5 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_Apprehensive
|--------------------------------------------------------------------------------
Sub Event_Consider_Apprehensive 
  /varset ConsiderReturn 6 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_Dubious
|--------------------------------------------------------------------------------
Sub Event_Consider_Dubious 
  /varset ConsiderReturn 7 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_Threatening
|--------------------------------------------------------------------------------
Sub Event_Consider_Threatening 
  /varset ConsiderReturn 8 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_Consider_ReadyToAttack
|--------------------------------------------------------------------------------
Sub Event_Consider_ReadyToAttack 
  /varset ConsiderReturn 9 
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_GiftofMana
|--------------------------------------------------------------------------------
Sub Event_GiftofMana

   /echo  *** Gift of Mana Triggered!
   /popup *** Gift of Mana Triggered!
   
:castgom

      /if (${Me.PctMana}>=${nuke1minmana} && ${Target.Distance}<=${Spell[${nuke1}].MyRange} && ${Me.SpellReady[${nuke1}]} && ${Target.PctHPs}>${nuke1hpstop} && ${Target.PctHPs}<${nuke1hpstart} && (!${Defined[bewildermentTimer${mobID}]} || (${Defined[bewildermentTimer${mobID}]} && ${Spawn[${mobID}].PctHPs}<75))) {
       /if (${useMindShatter} && ${Me.SpellReady[${mindShatterSpell}]} && (${Me.Buff[Mind Shatter Recourse].Duration}<=0 || ${Me.Buff[Mind Oscillate Recourse].Duration}<=0)) /call cast "${mindShatterSpell}" ${mindShatterGem} 0 CheckForAdds
       /if (${announce} && !${spamDelay}) /${chatChannel} ${nuke1} on >> >> ${Target.CleanName} << <<
       /varset spamDelay (${nukeDelay}-25)
       /delay 1
       /call Cast "${nuke1}" ${nuke1Gem} 0 checkforadds     
       /if (${Macro.Return.Equal[CAST_NOTREADY]}) /goto :castgom
   }
   
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_GiftofRadMana
|--------------------------------------------------------------------------------
Sub Event_GiftofRadMana

   /echo  *** Gift of Radiant Mana Triggered!
   /popup *** Gift of Radiant Mana Triggered!
   
:castgorm
   /if (${Me.PctMana}>=${nuke1minmana} && ${Target.Distance}<=${Spell[${nuke1}].MyRange} && ${Me.SpellReady[${nuke1}]} && ${Target.PctHPs}>${nuke1hpstop} && ${Target.PctHPs}<${nuke1hpstart} && (!${Defined[bewildermentTimer${mobID}]} || (${Defined[bewildermentTimer${mobID}]} && ${Spawn[${mobID}].PctHPs}<75))) {
       /if (${useMindShatter} && ${Me.SpellReady[${mindShatterSpell}]} && (${Me.Buff[Mind Shatter Recourse].Duration}<=0 || ${Me.Buff[Mind Oscillate Recourse].Duration}<=0)) /call cast "${mindShatterSpell}" ${mindShatterGem} 0 CheckForAdds
       /if (${announce} && !${spamDelay}) /${chatChannel} ${nuke1} on >> >> ${Target.CleanName} << <<
       /varset spamDelay (${nukeDelay}-25)
       /delay 1
       /call Cast "${nuke1}" ${nuke1Gem} 0 checkforadds     
       /if (${Macro.Return.Equal[CAST_NOTREADY]}) /goto :castgorm
   }
   
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_GiftofExqRadMana
|--------------------------------------------------------------------------------
Sub Event_GiftofExqRadMana

   /echo  *** Gift of Exquisite Radiant Mana Triggered!
   /popup *** Gift of Exquisite Radiant Mana Triggered! 
   
:castgoerm
   /if (${Me.PctMana}>=${nuke1minmana} && ${Target.Distance}<=${Spell[${nuke1}].MyRange} && ${Me.SpellReady[${nuke1}]} && ${Target.PctHPs}>${nuke1hpstop} && ${Target.PctHPs}<${nuke1hpstart} && (!${Defined[bewildermentTimer${mobID}]} || (${Defined[bewildermentTimer${mobID}]} && ${Spawn[${mobID}].PctHPs}<75))) {
       /if (${useMindShatter} && ${Me.SpellReady[${mindShatterSpell}]} && (${Me.Buff[Mind Shatter Recourse].Duration}<=0 || ${Me.Buff[Mind Oscillate Recourse].Duration}<=0)) /call cast "${mindShatterSpell}" ${mindShatterGem} 0 CheckForAdds
       /if (${announce} && !${spamDelay}) /${chatChannel} ${nuke1} on >> >> ${Target.CleanName} << <<
       /varset spamDelay (${nukeDelay}-25)
       /delay 1
       /call Cast "${nuke1}" ${nuke1Gem} 0 checkforadds     
       /if (${Macro.Return.Equal[CAST_NOTREADY]}) /goto :castgoerm
   }
   
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: Event_GiftofAmaExqRadMana
|--------------------------------------------------------------------------------
Sub Event_GiftofAmaExqRadMana

   /echo  *** Gift of Amazing Exquisite Radiant Mana Triggered!
   /popup *** Gift of Amazing Exquisite Radiant Mana Triggered!
   
:castgoaerm

      /if (${Me.PctMana}>=${nuke1minmana} && ${Target.Distance}<=${Spell[${nuke1}].MyRange} && ${Me.SpellReady[${nuke1}]} && ${Target.PctHPs}>${nuke1hpstop} && ${Target.PctHPs}<${nuke1hpstart} && (!${Defined[bewildermentTimer${mobID}]} || (${Defined[bewildermentTimer${mobID}]} && ${Spawn[${mobID}].PctHPs}<75))) {
       /if (${useMindShatter} && ${Me.SpellReady[${mindShatterSpell}]} && (${Me.Buff[Mind Shatter Recourse].Duration}<=0 || ${Me.Buff[Mind Oscillate Recourse].Duration}<=0)) /call cast "${mindShatterSpell}" ${mindShatterGem} 0 CheckForAdds
       /if (${announce} && !${spamDelay}) /${chatChannel} ${nuke1} on >> >> ${Target.CleanName} << <<
       /varset spamDelay (${nukeDelay}-25)
       /delay 1
       /call Cast "${nuke1}" ${nuke1Gem} 0 checkforadds     
       /if (${Macro.Return.Equal[CAST_NOTREADY]}) /goto :castgoaerm
   }
   
/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: DoClickies
|--------------------------------------------------------------------------------
Sub DoClickies

/echo Checking for Clickies . . .

|/if (${CMaint}) {
|
|        /if (${Plugin[MQ2ClickMaint].Name.Equal[MQ2ClickMaint]}) {
|            :checkCmaint
|            /if (!${Me.Casting.ID}) /doclicks
|            /delay 1s
|        }
|       
|       /if (${Me.Casting.ID}) {
|       /echo *** Waiting for clickies to finish casting. ***
|       :WaitForCasting
|       /delay 10
|       /if (${Me.Casting.ID}) /goto :WaitForCasting
|        }
|       
|        /if (${CMaint}) {
|             /delay 10
|             /goto :checkCmaint
|        }       
       
}

/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: PluginCheck
|--------------------------------------------------------------------------------
Sub PluginCheck

/echo Checking required plugins . . .

/if (!${Plugin[MQ2Debuffs].Name.Equal[MQ2Debuffs]}) {
    /echo Loading MQ2Debuffs plugin, because this macro requires it !
    /squelch /plugin MQ2Debuffs load
    /delay 1s
    /if (!${Plugin[MQ2Debuffs].Name.Equal[MQ2Debuffs]}) {
        /beep
   /echo Unable to load MQ2Debuffs plugin, quiting.
        /end
    }
} else {
    /echo MQ2Debuffs plugin is loaded.
}

/if (!${Plugin[MQ2EQBC].Name.Equal[MQ2EQBC]}) {
    /echo Loading MQ2EQBC plugin, because this macro requires it !
    /squelch /plugin MQ2EQBC load
    /delay 1s
    /if (!${Plugin[MQ2EQBC].Name.Equal[MQ2EQBC]}) {
        /beep
   /echo Unable to load MQ2EQBC plugin, quiting.
        /end
    }
} else {
    /echo MQ2EQBC plugin is loaded.
}

/if (!${Plugin[MQ2Exchange].Name.Equal[MQ2Exchange]}) {
    /echo Loading MQ2Exchange plugin, because this macro requires it !
    /squelch /plugin MQ2Exchange load
    /delay 1s
    /if (!${Plugin[MQ2Exchange].Name.Equal[MQ2Exchange]}) {
        /beep
   /echo Unable to load MQ2Exchange plugin, quiting.
        /end
    }
} else {
    /echo MQ2Exchange plugin is loaded.
}

/if (!${Plugin[MQ2MoveUtils].Name.Equal[MQ2MoveUtils]}) {
    /echo Loading MQ2MoveUtils plugin, because this macro requires it !
    /squelch /plugin MQ2MoveUtils load
    /delay 1s
    /if (!${Plugin[MQ2MoveUtils].Name.Equal[MQ2MoveUtils]}) {
        /beep
   /echo Unable to load MQ2MoveUtils plugin, quiting.
        /end
    }
} else {
    /echo MQ2MoveUtils plugin is loaded.
}

|/if (!${Plugin[MQ2ClickMaint].Name.Equal[MQ2ClickMaint]}) {
|    /echo Loading MQ2ClickMaint plugin, because this macro requires it |!
|    /squelch /plugin MQ2ClickMaint load
|    /delay 1s
|    /if (!${Plugin[MQ2ClickMaint].Name.Equal[MQ2ClickMaint]}) {
|        /beep
|   /echo Unable to load MQ2ClickMaint plugin, quiting.
|        /end
|    }
|} else {
|    /echo MQ2ClickMaint plugin is loaded.
|}


/echo Plugin check complete . . .

/return
|--------------------------------------------------------------------------------


|--------------------------------------------------------------------------------
|SUB: SetAssist
|--------------------------------------------------------------------------------
Sub SetAssist

  /if (${Defined[Param0]}) {
    /call SetIniVar mainAssist Settings ${Param0}
  } else {
    /if (!${Target.ID} || ${Target.Type.NotEqual[PC]}) {
      /echo You do not have a PC targeted, Doing nothing about it
      |/call SetIniVar mainAssist Settings ${defaultAssist}     
      |/echo You do not have a PC targeted, using default assist: ${defaultAssist}
      |/call SetIniVar mainAssist Settings ${defaultAssist}     
    } else {
      /if (${Target.CleanName.Equal[${Me.CleanName}]}) {
        /echo You cannot assist yourself! Using default assist: ${defaultAssist}
        /call SetIniVar mainAssist Settings ${defaultAssist}     
      } else {
        /call SetIniVar mainAssist Settings ${Target.CleanName}
      }
    }
  }

  /echo Assist set to (${mainAssist}).
  /popup Assist set to (${mainAssist}). 

/return 
|--------------------------------------------------------------------------------
Sat Nov 27, 2010 10:55 pm
can you repost it.

paste it in the text box, then highlight the whole bit of code, then click the # button in the post menu to put [code] tags around it. That will make it maintain the proper spacing and tabs
Sat Nov 27, 2010 11:28 pm
Project Lead
I added code tags.

also please post the quickbeg.inc and move.inc

i'll take a look at it.
_________________
Sorvani
Sun Nov 28, 2010 9:25 am
Senior Project Member
quickbeg.inc
More +
| QuickBeg.inc - Version 4.4 - 09/15/2010
| Written by MacQ with additions/suggestions by A_Druid_00, Niles, and Kroak
|
| Copyright 2005-2010 by MacQ all rights reserved.
|
| This macro is only authorized for the personal use by members in good standing of the MacroQuest2 VIP forums
| If you did not pay for VIP access, then you're a cheap, non contributing bastard who sucks the life out of
| others and will die in hell.
|
|------------------------------------------------------------------------------------------------------------
| Release Notes:
|
| To integrate QuickBeg with your macro do the following:
| - Add #include QuickBeg.inc to your Include section.
| - Add /call QuickBegDeclares to your Declaration section.
| - Add /call MeBegBuff, /call MeBegCure, /call MeBegItem, and /call PetBegBuff wherever you want to beg.
| - Configure the INI file to meet your needs.
|
| The macro uses an INI file called QuickBeg.ini, and assums the INI file is stored in a sub folder called INI,
| located in your macro folder. If you don't like the INI file being stored in a sub folder, then change the
| variable qbIniFile below to a new path/name.
|
| The INI file is divided into a [GeneralSettings] section and a [CLASS/CHARNAME] section where [CLASS/CHARNAME]
| is either your character name or your character class depending on how you set the variable groupIniByClass
| in the [GeneralSettings] section.
|
| To utilize cure begging, this macro requires the MQ2Debuffs plugin from PinkFloyd33.  If you don't know how
| to install/use plugins and/or can't located this plugin, then simply disable cure begging by setting MeBegCure
| in the INI file to FALSE.
|
| ----- INI File Variables - [GeneralSettings] Section -----
|
| - ForceAliasBuild = TRUE/FALSE controls the writing of aliases to your Macroquest.ini file.  If you don't
|   want to worry about when you need to update your QuickBeg aliases in your Macroquest.ini file, then
|   leave this set to TRUE.  However, if startup performance is important, then set this to FALSE but remember
|   to set this to TRUE if/when you change/add aliases in/to your INI file or you get a new Macroquest.ini file.
|   It is YOUR responsbility to mange this properly and keep YOUR aliases organized, you have been warned.
|
| - GroupIniByClass = TRUE/FALSE if this is set to TRUE, then the INI file will be devided into sections by
|   class type.  If this is set to FALSE, then the INI file will be devided into sections by character name.
|
| - SearchRadius = Maximum radius QuickBeg will search for a buffer.
|
| - SearchZRadius = Maximum zradius QuickBeg will search for a buffer.
|
| - StatusMessages = RUE/FALSE reports QuickBeg settings each time you start.
|
| - MeBuffStacksDuration = The duration (ticks) before the buff will wear off you.  This allows you to ask for a
|   buff a number of ticks before it expires.
|
| - PetBuffStacksDuration = The duration (ticks) before the buff will wear off your pet.  This allows you to ask
|   for a pet buff a number of ticks before it expires.
|
|   NOTE: the XX in the variable descriptions below are replaced by a "pseudo array" number (e.g., MeBegBuffName1,
|   MeBegBuffName2, MeBegBuffName3, etc.) XX should never be a number larger than the appropriate variables
|   that contain the totals for that particular group of variables (e.g., MeBegBuffTotal, MeBegCureTotal,
|   MeBegItemTotal, and PetBegBuffTotal).
|
| - MeBegBuffTotal = Total number of Buffs QuickBeg could beg. Must be equal to the total number of Buffs in
|   the MeBegBuff group listed in your INI file.
|
| - MeBegBuffNameXX = Contains the Name of the buff you want to beg.  QuickBeg will not beg for this buff if
|   you are already wearing it or if this buff will NOT stack with another buff you are currently wearing.
|
| - MeBegBuffSourceXX = Contains the Class(s) (in three-letter class codes) that can cast the Buff listed in
|   MeBegBuffNameXX or a substitute Buff from another class that is similar in nature to the Buff listed. List
|   the Primary Class FIRST and any alternate classes after.  If you set AlternateBeg to TRUE, QuickBeg will look
|   for alternate (substitute) classes if no Primary class is available.  Seperate each class with a verticle
|   bar "|", do not start or end with a vertical bar.
|
| - MeBegBuffAliasXX = Contains the aliases for Buff(s) you want to beg for YOURSELF.  From inside EQ an alias
|   controls on/off the begging for this buff.
|
| - MeBegBuffLevelXX = QuickBeg will not ask for this particular Buff if the PC is below this level. If you set the
|   variable MinBegLevel to a number greater than zero, described below, it will superseed MeBegBuffLevelXX.
|
| - MeBegCureTotal = Total number of Cures QuickBeg could beg. Must be equal to the total number of Cures in
|   the MeBegCure group listed in your INI file.
|
| - MeBegCureTypeXX = Contains the Type Name of the Curse you received.  This is per the different types of curses
|   as part of the MQ2Debuffs plugin written by PinkFloyd33.  You will need to reference that plugin to determin
|   the current types of debuff detection possible.
|
| - MeBegCureSourceXX = Contains the Class(s) (in three-letter class codes) that can cast a Cure for the curses
|   listed in MeBegCureTypeXX or a substitute Cure from another class that is similar in nature to the Cure listed.
|   List the Primary Class FIRST and any alternate classes after.  If you set AlternateBeg to TRUE, QuickBeg will look
|   for alternate (substitute) classes if no Primary class is available.  Seperate each class with a verticle
|   bar "|", do not start or end with a vertical bar.
|
| - MeBegCureAliasXX = These variables contain the aliases for Cure you want to beg for YOURSELF.  From inside EQ
|   an alias controls on/off the begging for this cure.
|
| - MeBegCureLevelXX = QuickBeg will not ask for this particular Cure if the PC is below this level. If you set the
|   variable MinBegLevel to a number greater than zero, described below, it will superseed MeBegCureLevelXX.
|
| - MeBegItemTotal = Total number of Items QuickBeg could beg. Must be equal to the total number of Items in
|   the MeBegItem group listed in your INI file.
|
| - MeBegItemNameXX = Contains the Name(s) of the Item(s) you want to beg.  QuickBeg will not beg for this Item if
|   you already have it in your inventory or on your cursor.  Seperate each item with a verticle bar '|', do not start
|   or end with a verticle bar.
|
| - MeBegItemSourceXX = Contains the Class(s) (in three-letter class codes) that can cast this Item listed in
|   MeBegItemNameXX or a substitute Item from another class that is similar in nature to the Item listed.
|   List the Primary Class FIRST and any alternate classes after.  If you set AlternateBeg to TRUE, QuickBeg will look
|   for alternate (substitute) classes if no Primary class is available.  Seperate each class with a verticle
|   bar "|", do not start or end with a vertical bar.
|
| - MeBegItemAliasXX = Contains the aliases for Item(s) you want to beg for YOURSELF.  From inside EQ an alias controls
|   (on/off) for begging this item.
|
| - MeBegItemLevelXX = QuickBeg will not ask for this particular Item if the PC is below this level. If you set the
|   variable MinBegLevel to a number greater than zero, described below, it will superseed MeBegItemLevelXX.
|
| - PetBegBuffTotal = Total number of Pet Buffs QuickBeg could beg. Must be equal to the total number of Pet Buffs in
|   the petBegBuff group listed in your INI file.
|
| - PetBegBuffNameXX = Contains the Name of the Buff you want to beg for YOUR PET.  QuickBeg will not beg for this
|   buff if your pet is already wearing it or if this buff will not stack with another buff your pet is currently wearing.
|
| - PetBegBuffSourceXX = Contains the Class(s) (in three-letter class codes) that can cast the Pet Buff listed in
|   PetBegBuffNameXX or a substitute Pet Buff from another class that is similar in nature to the Pet Buff listed. List
|   the Primary Class FIRST and any alternate classes after.  If you set AlternateBeg to TRUE, QuickBeg will look
|   for alternate (substitute) classes if no Primary class is available.  Seperate each class with a verticle
|   bar "|", do not start or end with a vertical bar.
|
| - PetBegBuffAliasXX = Contains the aliases for Buff(s) you want to beg for YOUR PET.  From inside EQ an alias controls
|   (on/off) begging for this pet buff.
|
| - PetBegBuffLevelXX = QuickBeg will not ask for this particular Pet Buff if the PC is below this level. If you set the
|   variable MinBegLevel to a number greater than zero, described below, it will superseed PetBegBuffLevelXX.
|
|   ----- Variables in INI - [CLASS/NAME] Section -----
|
| - AllowAltBeg = TRUE/FALSE if you defined more than one class in meBegBuffSourceXX, meBegCureSourceXX, meBegItemSourceXX,
|   or petBegBuffSourceXX, then if QuickBeg can't find the Primary Source (e.g., the FIRST CLASS LISTED) QuickBeg will look
|   for other class sources you listed (Alternate Sources). For example, you first would probably look for a Magician to
|   cast a damage shield but not finding one, you might look for a Druid; so you would list MAG|DRU.  Alias is /allowaltbeg
|
| - AskAnyone = TRUE/FALSE if set TRUE will ask anyone for buffs regardless if they are in your raid, group, or
|   guild.  If you set this variable FALSE, QuickBeg will only check first for a raid member in range,
|   then a group member in range, then a guild member in range. Alias is /askanyone
|
| - AskDelay = int variable containing the delay (in DECI-SECONDS) between sending the same buff request. This also
|   means if you asked for a buff, received the buff then its dispelled or you click it off, QuickBeg will still
|   wait the time specified in askDelay before asking again.  Alias is /askdelay
|
| - BegChannel = channel you will beg for buffs (e.g., tell, say, group, etc.) Six valid choices are: tell,t,i msg,g,say,i say
|   Alias is /begchannel.
|
| - BegIfInvis = TRUE/FALSE will or will not beg if you are invised. Alias is /begifinvis.
|
| - MeBegBuff = TRUE/FALSE master on/off for personal buff begging.  Alias is /mebegbuff.
|
| - MeBegCure = TRUE/FALSE master on/off for personal cure begging. Alias is /mebegcure.
|
| - MeBegItem = TRUE/FALSE master on/off for personal item begging. Alias is /mebegitem.
|
| - PetBegBuff = TRUE/FALSE master on/off for pet buff begging. Alias is /petbegbuff.
|
| - MinBegLevel = If this variable is set to a positive number, you will not ask for buffs from anyone below this
|   level.  However, if this variable is set to zero, QuickBeg will use individual spell specific level
|   checks (e.g., MeBegBuffLevelXX, MeBegCureLevelXX, MeBegItemLevelXX, PetBegBuffLevelXX). Alias is /minbeglvl.
|
| - MeBegBuffStatusXX = TRUE/FALSE flag controlling Buff begging for the each personal buff.
|
| - MeBegBuffMessageXX = The message you want to send when you ask for this Buff.
|
| - MeBegCureStatusXX = TRUE/FALSE flag controlling Cure begging for the each debuff type.
|
| - MeBegCureMessageXX = The message you want to send when you ask for this Cure.
|
| - MeBegItemStatusXX = TRUE/FALSE flag controlling begging for an Item (like a mod rod) not in your inventory or
|   on your cursor.  If QuickBeg finds the item in your inventory or on your cursor, it will NOT beg for it.
|
| - MeBegItemMessageXX = The message you want to send when you ask for this Item.
|
| - PetBegBuffStatusXX = TRUE/FALSE flag controlling Pet Buff begging for the buff.
|
| - PetBegBuffPetssageXX = The message you want to send when you ask for this Pet Buff.
|
| You can change several settings while the macro is running by typing an alias.  To use an alias, from an EQ command
| line, type /XXX YYY (assuming there is an alias) where XXX is the alias name and YYY is the new value.  You don't
| need to put quotes around the XXX value even if it has spaces.
|
| Example:
| /askdelay 900 -- sets a the ask delay to 90 seconds.
| /chatchannel i msg -- sets chat channel to "i msg".
|
| For changing Boolean variables you have a few choices.  You can type an alias, if you defined one in the INI file,
| not followed by a new parameter and QuickBeg will simply toggle off (FALSE) if its ON, or ON (TRUE) if its OFF. You
| can also pass a variety of parameters: 1, 0, TRUE, FALSE, ON, or OFF.
|
| Example- Assuming you defined an alias called /begsow, which in this example might control begging for Spirit of
| the Wolf, here are your options:
| /begsow on -- turns Oak begging on.
| /begsow off --  turns Oak begging off.
| /begsow TRUE -- turns Oak begging on.
| /begsow FALSE -- turns Oak begging off.
| /begsow -- turns OFF if its currently ON, or turns ON if its currently OFF (toggle style).
|------------------------------------------------------------------------------------------------------------
|
#event QBSetVar "[MQ2] QBSetVar:#*#"

Sub QuickBegDeclares
   /declare MeBegBuffCounter     int      outer 1
   /declare MeBegCureCounter     int      outer 1
   /declare MeBegItemCounter     int      outer 1
   /declare PetBegBuffCounter    int      outer 1
   /declare SpamDelayTimer       timer    outer
   /declare QbIniFile            string   outer ./QuickBeg.ini
   /declare i                    int      local

   /call QBDeclareIniVar ForceAliasBuild  bool     GeneralSettings TRUE
   /if ( ${ForceAliasBuild} ) {
      /echo QuickBeg writing aliases to your Macroquest.ini file.
      /echo You can disbale this by setting forceAliasBuild to FALSE in your ${QbIniFile} file.
   }

   /call QBDeclareIniVar GroupIniByClass        bool    GeneralSettings FALSE
   /call QBDeclareIniVar PetNameSuffix          bool    GeneralSettings TRUE
   /call QBDeclareIniVar SearchRadius           int     GeneralSettings 100
   /call QBDeclareIniVar SearchZRadius          int     GeneralSettings 100
   /call QBDeclareIniVar StatusMessages         bool    GeneralSettings FALSE
   /call QBDeclareIniVar MeBuffStacksDuration   int     GeneralSettings 0
   /call QBDeclareIniVar PetBuffStacksDuration  int     GeneralSettings 0

   /call QBDeclareIniVar AllowAltBeg      bool     ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE /allowaltbeg
   /call QBDeclareIniVar AskDelay         int      ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} 1800  /askdelay
   /call QBDeclareIniVar AskAnyone        bool     ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE /askanyone
   /call QBDeclareIniVar BegChannel       string   ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} tell  /begchannel
   /call QBDeclareIniVar BegIfInvis       bool     ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE /begifinvis
   /call QBDeclareIniVar MeBegBuff        bool     ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE /mebegbuff
   /call QBDeclareIniVar MeBegItem        bool     ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE /mebegitem
   /call QBDeclareIniVar MeBegCure        bool     ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE /mebegcure
   /call QBDeclareIniVar PetBegBuff       bool     ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE /petbegbuff
   /call QBDeclareIniVar MinBegLevel      int      ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} 0     /minbeglevel

   /call QBDeclareIniVar MeBegBuffTotal               int      GeneralSettings 1
   /if ( ${MeBegBuffTotal} ) {
      /for i 1 to ${MeBegBuffTotal}
         /declare MeBegBuffTimer${i}                  timer  outer
         /call QBDeclareIniVar MeBegBuffName${i}      string GeneralSettings "REPLACE WITH SINGLE BUFF NAME"
         /call QBDeclareIniVar MeBegBuffSource${i}    string GeneralSettings "REPLACE WITH BUFFING PC CLASS(S) SEPERATED BY VERTICLE BAR '|' IF MORE THAN ONE CLASS"
         /if ( ${MinBegLevel} ) {
            /declare MeBegBuffLevel${i}               int outer ${MinBegLevel}
         } else {
            /call QBDeclareIniVar MeBegBuffLevel${i}  int    GeneralSettings
         }
         /call QBDeclareIniVar MeBegBuffStatus${i}    bool   ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE
         /call QBDeclareIniVar MeBegBuffMessage${i}   string ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} "REPLACE WITH BEG BUFF MESSAGE"
         /if ( ${ForceAliasBuild} ) /call QBAliasIniVar MeBegBuffAlias${i} GeneralSettings MeBegBuffStatus${i}
      /next i
   }

   /call QBDeclareIniVar MeBegCureTotal               int    GeneralSettings 1
   /if ( ${MeBegCureTotal} ) {
      /for i 1 to ${MeBegCureTotal}
         /declare MeBegCureTimer${i}                  timer  outer
         /call QBDeclareIniVar MeBegCureType${i}      string GeneralSettings "REPLACE WITH SINGLE CURSE NAME (per MQ2Debuffs plugin)"
         /call QBDeclareIniVar MeBegCureSource${i}    string GeneralSettings "REPLACE WITH CURING PC CLASS(S) SEPERATED BY VERTICLE BAR '|' IF MORE THAN ONE CLASS"
         /if ( ${MinBegLevel} ) {
            /declare MeBegCureLevel${i}               int outer ${MinBegLevel}
         } else {
            /call QBDeclareIniVar MeBegCureLevel${i}  int GeneralSettings
         }
         /call QBDeclareIniVar MeBegCureStatus${i}    bool ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE
         /call QBDeclareIniVar MeBegCureMessage${i}   string ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} "REPLACE WITH BEG CURE MESSAGE"
         /if ( ${ForceAliasBuild} ) /call QBAliasIniVar MeBegCureAlias${i} GeneralSettings MeBegCureStatus${i}
      /next i
   }

   /call QBDeclareIniVar MeBegItemTotal               int      GeneralSettings 1
   /if ( ${MeBegItemTotal} ) {
      /for i 1 to ${MeBegItemTotal}
         /declare MeBegItemTimer${i}                  timer outer
         /call QBDeclareIniVar MeBegItemName${i}      string GeneralSettings "REPLACE WITH ITEM NAMES(S) SEPERATED BY VERTICLE BAR '|' IF MORE THAN ONE ITEM"
         /call QBDeclareIniVar MeBegItemSource${i}    string GeneralSettings "REPLACE WITH SUMMONING PC CLASS(S) SEPERATED BY VERTICLE BAR '|' IF MORE THAN ONE CLASS"
         /if ( ${MinBegLevel} ) {
            /declare MeBegItemLevel${i}               int outer ${MinBegLevel}
         } else {
            /call QBDeclareIniVar MeBegItemLevel${i}  int    GeneralSettings
         }
         /call QBDeclareIniVar MeBegItemStatus${i}    bool   ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE
         /call QBDeclareIniVar MeBegItemMessage${i}   string ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} "REPLACE WITH BEG ITEM MESSAGE"
         /if ( ${ForceAliasBuild} ) /call QBAliasIniVar MeBegItemAlias${i} GeneralSettings MeBegItemStatus${i}
      /next i
   }

   /call QBDeclareIniVar PetBegBuffTotal              int      GeneralSettings 1
   /if ( ${PetBegBuffTotal} ) {
      /for i 1 to ${PetBegBuffTotal}
         /declare PetBegBuffTimer${i}                 timer outer
         /call QBDeclareIniVar PetBegBuffName${i}     string GeneralSettings "REPLACE WITH SINGLE PET BUFF NAME"
         /call QBDeclareIniVar PetBegBuffSource${i}   string GeneralSettingS "REPLACE WITH BUFFING PC CLASS(S) SEPERATED BY VERTICLE BAR '|' IF MORE THAN ONE CLASS"
         /if ( ${MinBegLevel} ) {
            /declare PetBegBuffLevel${i}              int outer ${MinBegLevel}
         } else {
            /call QBDeclareIniVar PetBegBuffLevel${i} int    GeneralSettings
         }
         /call QBDeclareIniVar PetBegBuffStatus${i}   bool   ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} FALSE
         /call QBDeclareIniVar PetBegBuffMessage${i}  string ${If[${GroupIniByClass},${Me.Class.ShortName},${Me.CleanName}]} "REPLACE WITH PET BEG BUFF MESSAGE"
         /if ( ${ForceAliasBuild} ) /call QBAliasIniVar PetBegBuffAlias${i} GeneralSettings PetBegBuffStatus${i}
      /next i
   }

   /if ( ${StatusMessages} ) {
      /if ( !${MeBegBuff} ) {
         /echo QuickBeg will NOT beg for My Buffs.
      } else {
         /echo QuickBeg will beg for My Buffs.
      }
      /if ( !${MeBegCure} ) {
         /echo QuickBeg will NOT beg for My Cures.
      } else {
         /echo QuickBeg will beg for My Cures.
      }
      /if ( !${MeBegItem} ) {
         /echo QuickBeg will NOT beg for My Items.
      } else {
         /echo QuickBeg will beg for My Items.
      }
      /if ( !${PetBegBuff} ) {
         /echo QuickBeg will NOT beg for Pet Buffs.
      } else {
         /echo QuickBeg will beg for Pet Buffs.
      }
      /if ( ${MeBegBuff} || ${MeBegCure} || ${MeBegItem} || ${PetBegBuff} ) {
         /if ( ${AskAnyone} ) {
            /echo QuickBeg will beg from anyone in Range.
         } else {
               /echo QuickBeg will only beg from Raid/Group/Guild members in Range.
         }
         /if ( ${AllowAltBeg} ) {
            /echo QuickBeg will beg from Alternate sources.
         } else {
            /echo QuickBeg will NOT beg from Alternate sources.
         }
         /echo QuickBeg will wait ${Int[${Math.Calc[${AskDelay}/10]}]} seconds between requests for the same buff.
         /echo QuickBeg will beg in channel: /${BegChannel}
         /if ( ${BegIfMeInvis} ) {
            /echo QuickBeg will beg for buffs if I am invised.
         } else {
            /echo QuickBeg will NOT beg for buffs if I am invised.
         }
      }
   }
/return

Sub MeBegBuff
   /if ( ${SpamDelayTimer} || !${MeBegBuffTotal} || !${MeBegBuff} || !${Me.FreeBuffSlots} || ( ${Me.Invis} && !${BegIfInvis} ) ) /return
   /declare i int local
   /declare j int local
   /for i ${MeBegBuffCounter} to ${MeBegBuffTotal}
      /if ( ${MeBegBuffStatus${i}} && !${MeBegBuffTimer${i}} && ${Spell[${MeBegBuffName${i}}].Stacks[${MeBuffStacksDuration}]} ) {
         /for j 1 to ${Math.Calc[${MeBegBuffSource${i}.Count[|]}+1]}
            /call FindBuffer "${MeBegBuffMessage${i}}" ${MeBegBuffSource${i}.Arg[${j},|]} MeBegBuffTimer${i} ${MeBegBuffLevel${i}}
            /if ( ${Macro.Return.Equal[BEG_SUCCESS]} ) {
               /call IncrementCounter "MeBegBuffCounter" "MeBegBuffTotal"
               /return
            }
         /if ( ${AllowAltBeg} ) /next j
      }
   /call IncrementCounter "MeBegBuffCounter" "MeBegBuffTotal"
   /next i
/return

Sub MeBegCure
   /if ( ${SpamDelayTimer} || !${MeBegCureTotal} || !${MeBegCure} || ( ${Me.Invis} && !${BegIfInvis} ) ) /return
   /declare i int local
   /declare j int local
   /for i ${MeBegCureCounter} to ${MeBegCureTotal}
      /if ( ${MeBegCureStatus${i}} && !${MeBegCureTimer${i}} && ${Debuff.${MeBegCureType${i}}} ) {
         /for j 1 to ${Math.Calc[${MeBegCureSource${i}.Count[|]}+1]}
            /call FindBuffer "${MeBegCureMessage${i}}" ${MeBegCureSource${i}.Arg[${j},|]} MeBegCureTimer${i} ${MeBegCureLevel${i}}
            /if ( ${Macro.Return.Equal[BEG_SUCCESS]} ) {
               /call IncrementCounter "MeBegCureCounter" "MeBegCureTotal"
               /return
            }
         /if ( ${AllowAltBeg} ) /next j
      }
   /call IncrementCounter "MeBegCureCounter" "MeBegCureTotal"
   /next i
/return

Sub MeBegItem
   /if ( ${SpamDelayTimer} || !${MeBegItemTotal} || !${MeBegItem} || ( ${Me.Invis} && !${BegIfInvis} ) ) /return
   /declare i int local
   /declare j int local
   /for i ${MeBegItemCounter} to ${MeBegItemTotal}
      /for j 1 to ${Math.Calc[${MeBegItemSource${i}.Count[|]}+1]}
         /if ( ${MeBegItemStatus${i}} && !${MeBegItemTimer${i}} && !${FindItem[${MeBegItemName${i}.Arg[${j},|]}].ID} && !${Cursor.Name.Equal[${MeBegItemName${i}.Arg[${j},|]}]} ) {
            /call FindBuffer "${MeBegItemMessage${i}}" ${MeBegItemSource${i}.Arg[${j},|]} MeBegItemTimer${i} ${MeBegItemLevel${i}}
            /if ( ${Macro.Return.Equal[BEG_SUCCESS]} ) {
               /call IncrementCounter "MeBegItemCounter" "MeBegItemTotal"
               /return
            }
         }
      /if ( ${AllowAltBeg} ) /next j
      /call IncrementCounter "MeBegItemCounter" "MeBegItemTotal"
   /next i
/return

Sub PetBegBuff
   /if ( ${SpamDelayTimer} || !${Me.Pet.ID} || !${PetBegBuffTotal} || !${PetBegBuff} || ( ${Me.Invis} && !${BegIfInvis} ) ) /return
   /declare i int local
   /declare j int local
   /for i ${PetBegBuffCounter} to ${PetBegBuffTotal}
      /if (${PetBegBuffStatus${i}} && !${PetBegBuffTimer${i}} && ${Spell[${PetBegBuffName${i}}].StacksPet[${PetBuffStacksDuration}]} ) {
         /for j 1 to ${Math.Calc[${PetBegBuffSource${i}.Count[|]}+1]}
            /call FindBuffer "${PetBegBuffMessage${i}} ${Me.Pet.CleanName}" ${PetBegBuffSource${i}.Arg[${j},|]} PetBegBuffTimer${i}
            /if (${Macro.Return.Equal[BEG_SUCCESS]}) {
               /call IncrementCounter "PetBegBuffCounter" "PetBegBuffTotal"
               /return
            }
         /if ( ${AllowAltBeg} ) /next j
      }
   /call IncrementCounter "PetBegBuffCounter" "PetBegBuffTotal"
   /next i
/return

Sub FindBuffer(string BegBuff, string BegClass, string BegTimer, int MinBufferLevel)
   /if ( ${Me.Class.ShortName.Equal[${BegClass}]} )  /return BEG_SUCCESS
   /if ( ${NearestSpawn[pc group ${BegClass} range ${MinBufferLevel} 100 radius ${SearchRadius} zradius ${SearchZRadius}].ID} ) /call BegForBuff "${BegBuff}" ${NearestSpawn[PC group ${BegClass} range ${MinBufferLevel} 100]} ${BegTimer}
   /if ( ${Macro.Return.NotEqual[BEG_SUCCESS]} && ${NearestSpawn[pc raid ${BegClass} range ${MinBufferLevel} 100 radius ${SearchRadius} zradius ${SearchZRadius}].ID} ) /call BegForBuff "${BegBuff}" ${NearestSpawn[PC raid ${BegClass} range ${MinBufferLevel} 100]} ${BegTimer}
   /if ( ${Macro.Return.NotEqual[BEG_SUCCESS]} && ${NearestSpawn[pc guild ${BegClass} range ${MinBufferLevel} 100 radius ${SearchRadius} zradius ${SearchZRadius}].ID} && ${Me.Guild.NotEqual[NULL]} ) /call BegForBuff "${BegBuff}" ${NearestSpawn[PC guild ${BegClass} range ${MinBufferLevel} 100]} ${BegTimer}
   /if ( ${Macro.Return.NotEqual[BEG_SUCCESS]} && ${AskAnyone} && ${NearestSpawn[pc ${BegClass} range ${MinBufferLevel} 100 radius ${SearchRadius} zradius ${SearchZRadius}].ID} ) /call BegForBuff "${BegBuff}" ${NearestSpawn[PC ${BegClass} range ${MinBufferLevel} 100]} ${BegTimer}
/return ${Macro.Return}

Sub BegForBuff(string BegBuff, string BufferName, sring BegTimer)
   /if ( ${BegChannel.Equal[tell]} || ${BegChannel.Equal[t]} || ${BegChannel.Equal[i msg]} || ${BegChannel.Equal[bct]} ) {
      /docommand /${BegChannel} ${BufferName} ${BegBuff}
      /varset ${BegTimer} ${AskDelay}
      /varset SpamDelayTimer 3s
      /return BEG_SUCCESS
   } else {
      /if ( ${BegChannel.Equal[g]} || ${BegChannel.Equal[say]} || ${BegChannel.Equal[i say]} || ${BegChannel.Equal[bc]} ) {
      /docommand /${BegChannel} ${BegBuff}
      /varset ${BegTimer} ${AskDelay}
      /varset SpamDelayTimer 3s
      /return BEG_SUCCESS
   }
/return BEG_FAILED

Sub IncrementCounter(string BegVarCounterName, string BegVarTotalName)
   /if ( ${${BegVarCounterName}}==${${BegVarTotalName}} ) {
      /varset ${BegVarCounterName} 1
   } else {
      /varcalc ${BegVarCounterName} ${${BegVarCounterName}}+1
   }
/return

Sub QBDeclareIniVar(string VarName, string VarType, string SectionName, string VarValue, string Alias)
   /if ( !${Defined[${VarName}]} ) /declare ${VarName} ${VarType} outer
   /declare TempString string local ${Ini[${QbIniFile},${SectionName},${VarName},NOTFOUND]}
   /if ( ${TempString.Equal[NOTFOUND]} ) {
      /varset ${VarName} ${VarValue}
      /ini "${QbIniFile}" "${SectionName}" "${VarName}" "${${VarName}}"
   } else {
      /varset ${VarName} ${TempString}
   }
   /if ( ${ForceAliasBuild} && ${Defined[alias]} ) /squelch /alias ${Alias} /echo QBSetVar: ${VarName}
   }
/return

Sub QBAliasIniVar(string VarName, string SectionName, string AliasVar)
   /declare TempString string local ${Ini[${QbIniFile},${SectionName},${VarName},NOTFOUND]}
   /if ( ${TempString.NotEqual[NOTFOUND]} && ${ForceAliasBuild} ) /squelch /alias ${TempString} /echo QBSetVar: ${AliasVar}
/return

Sub Event_QBSetVar(string Line)
   /declare VarName  string local ${Line.Arg[3]}
   /declare NewValue string local ${Line.Arg[4]}
   /if ( !${Defined[${VarName}]} ) /return
   /if ( ${${VarName}(type).Name.Equal[bool]} && ${NewValue.Equal[NULL]} ) {
      /if ( ${${VarName}} ) {
         /varset ${VarName} FALSE
         /echo ${VarName} is now OFF
      } else {
         /varset ${VarName} TRUE
         /echo ${VarName} is now ON
      }
   } else {
      /if ( ${${VarName}(type).Name.Equal[bool]} ) {
         /if ( ${NewValue.Equal[on]} || ${NewValue.Equal[1]} || ${NewValue.Equal[true]} ) {
         /varset ${VarName} TRUE
         } else {
            /if ( ${NewValue.Equal[off]} || ${NewValue.Equal[0]} || ${NewValue.Equal[false]} ) {
            /varset ${VarName} FALSE
            } else {
               /echo ${VarName} was NOT changed
            }
         }
      } else {
         /if ( !${NewValue.Equal[NULL]} ) {
            /varset ${VarName} ${NewValue}
            /echo ${VarName} is now ${${VarName}}
         } else {
            /echo ${VarName} was NOT changed
         }
      }
   }
   /if ( ${GroupIniByClass} ) {
      /ini "${QbIniFile}" "${Me.Class.ShortName}" "${VarName}" "${${VarName}}"
   } else {
      /ini "${QbIniFile}" "${Me.CleanName}" "${VarName}" "${${VarName}}"
   }
/return
Sun Nov 28, 2010 12:04 pm
move.inc
More +
|===================================================|
|Move.Inc                                         |
|                                                   |
|Simple moving and object-avoidance routines        |
|                                                   |
|Originally by beatnik007 (Who credits Mckorr)      |
|                                                   |
|Revised and converted to MQ2Data by Terramantian   |
|===================================================|


| Sub MoveToLoc                                     |
|---------------------------------------------------|
|This simply moves the player to within 10 units of |
|the requested location, while avoiding obstacles   |
|                                                   |
|This is beatnik007's original sub, with a few minor|
|changes and rewritten in MQ2Data format            |
|                                                   |
|SYNTAX: /call MoveToLoc Y X                        |


Sub MoveToLoc(MoveToY, MoveToX)
   | /echo Moving to Location: ${MoveToY}, ${MoveToX}.
   | /echo Distance: ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}

    /declare running int local
    /declare distanceNow float local
    /declare distanceBefore float local
    /declare distanceModifier int local
    /varset running 0
    /declare distanceTimer timer 0
    /varset distanceModifier 1
   
    :moveToLocation

    /face fast nolook loc ${MoveToY},${MoveToX}

    /if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}<10) {
        /keypress forward
        /return
    }
   
    /if (${distanceTimer}==0) {
        /if (${Me.Sneaking}) {
            /varset distanceModifier 2
        } else {
            /varset distanceModifier 1
        }

        /varset distanceNow ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
        /if (${Math.Calc[${distanceBefore}-${distanceNow}]}<${Math.Calc[10/${distanceModifier}]} && ${distanceBefore} ) {
      /call strafePastObstacle
        }
        /varset distanceBefore ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
        /varset distanceTimer 15
    }

    /if (${running}==0) {
        /keypress forward
        /if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}>10) {
            /varset running 1
            /keypress forward hold
        }
    } else {
        /if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}<11) {
            /varset running 0
            /keypress forward
        }
    }
    /goto :moveToLocation
/return


| Sub MoveToSpawn                                   |
|---------------------------------------------------|
|This moves the player to within a provided distance|
|of the provided spawn, while avoiding obstacles    |
|                                                   |
|I "wrote" this, but as you can see, it's the same  |
|as MoveToLoc with a few variable replacements.     |
|                                                   |
|The second parameter, Distance, allows for the     |
|player to stop short of the target by a certain    |
|amount, to provide for different aggro radii, etc. |
|                                                   |
|SYNTAX: /call MoveToSpawn ID Distance              |

Sub MoveToSpawn(MoveToID, StopDistance)

    /if (!(${Defined[MoveToID]})||(${Spawn[MoveToID].ID})) {
        /echo Spawn ID not found or no ID provided. Aborting...
        /return
    }
    /if (!(${Defined[StopDistance]})) {
   /echo Stopping point not defined, using default distance of 70
        /declare StopDistance int local
        /varset StopDistance 70   
    }

    /echo Moving to Spawn: ${MoveToID} (${Spawn[${MoveToID}].CleanName}).
|   /echo Current Location: ${Spawn[${MoveToID}].Y}, ${Spawn[${MoveToID}].X}
|   /echo Current Distance: ${Spawn[${MoveToID}].Distance}

    /declare running int local
    /declare distanceNow float local
    /declare distanceBefore float local
    /declare distanceModifier int local
    /varset running 0
    /declare distanceTimer timer 15
    /varset distanceBefore ${Spawn[${MoveToID}].Distance}
    /varset distanceModifier 1
   
    :moveToSpawn

    /squelch /face fast nolook id ${MoveToID}

    /if (${Spawn[${MoveToID}].Distance}<${StopDistance}) {
        /keypress forward
        /return
    }
   
    /if (${distanceTimer}==0) {
        /if (${Me.Sneaking}) {
            /varset distanceModifier 2
        } else {
            /varset distanceModifier 1
        }

        /varset distanceNow ${Spawn[${MoveToID}].Distance}
        /if (${Math.Calc[${distanceBefore}-${distanceNow}]}<${Math.Calc[10/${distanceModifier}]}) {
      /call strafePastObstacle
        }
        /varset distanceBefore ${Spawn[${MoveToID}].Distance}
        /varset distanceTimer 15
    }

    /if (${running}==0) {
        /keypress forward
        /if (${Spawn[${MoveToID}].Distance}>=${StopDistance}) {
            /varset running 1
            /keypress forward hold
        }
    } else {
        /if (${Spawn[${MoveToID}].Distance}<${StopDistance}) {
            /varset running 0
            /keypress forward
        }
    }
    /goto :moveToSpawn
/return

| Only to be used by the previous functions - It's obvious what it does. |

sub strafePastObstacle
    /keypress forward
   | /keypress back hold
   | /delay 5
   | /keypress back
    /if (${Math.Rand[99]}>50) {
        /keypress strafe_right hold
    } else {
        /keypress strafe_left hold
    }
    /delay 1s
    /keypress strafe_right
    /keypress strafe_left
    /keypress forward hold
/return


mod edit: fixed
Sun Nov 28, 2010 12:06 pm
The only obvious thing i could see and the only time i could make a chanter stand up and sit down was when the values in the ini dind't match the ones hardcoded into the med routine.

poking around, I found a /sit routine embedded in the /CastBuffs section. that sit routine was using the ini file while the Medding sub was not. I moved that code to the medding routine and I do not notice any more problems. I can not run this really well though because all I have is a gimp 65 chanter on PEQ and all the configuration in the default ini here is for something beyond that era.

More +
|--------------------------------------------------------------------------------
|SUB: Medding
|--------------------------------------------------------------------------------
Sub Medding
  /if (${autoSit} && ${Me.PctMana}<=${minMana} && !${Me.Mount.ID} && !${Me.Casting.ID}) {
    /if (${Me.State.Equal[STAND]} && ${NearestSpawn[Targetable NPC].Distance3D}>=${distanceToSit} && ${Me.PctHPs}>90 && !${following}) /sit
  }
  /if (${autoSit} && ${Me.State.Equal[SIT]}) {
    /if (${Me.PctMana}>${minMana} && !${Window[SpellBookWnd].Open}) /stand
    /if (!${Window[SpellBookWnd].Open} && ${NearestSpawn[Targetable NPC].Distance3D}<=${distanceToSit}) /stand
    /if (${following}) /stand
  }
  /if ((${Me.PctMana}<=5) && ${Me.AltAbility[Gather Mana]} && ${Me.AltAbilityReady[Gather Mana]}) /call Cast "gather mana" alt
/return
|--------------------------------------------------------------------------------

_________________
Sorvani
Mon Nov 29, 2010 1:54 pm
Senior Project Member
well i made that change and it didnt affect anything as far as my chanter sitting to med. you say you tried this out with your chanter and he would med? I also play on peq, ill try and look you up ingame.
Mon Nov 29, 2010 8:51 pm
Public Macros chanter macro wont stay sitting to med.
Reply