Advbot.mac - Advanced Caster Bot - Heal/Debuff/Buff

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

RudeBoy
orc pawn
orc pawn
Posts: 23
Joined: Wed Mar 24, 2004 7:04 am

Post by RudeBoy » Mon Jun 21, 2004 5:48 am

You got the latest MQ2 installed?

Macro worked fine for me yesterday

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Mon Jun 21, 2004 5:56 am

Yea its somewhat broken atm.


chain casting debuffs instead of pausing or stoping after its casted once. Healing working fine, just debuffs / pets were alittle flaky

devestator
a ghoul
a ghoul
Posts: 121
Joined: Thu Feb 27, 2003 4:25 pm

Post by devestator » Mon Jun 21, 2004 8:35 am

My debuffs are working fine but since the last patch my follow has gone to crap. Character keeps looking straight up and running really slow I think they are even jumping trying to go up =p

Kind of annoying cause I'll sometime run 3 accounts on this bot so its a pain to move all 3 of them at the same time.

omper
a ghoul
a ghoul
Posts: 110
Joined: Sat Dec 06, 2003 10:46 pm

Post by omper » Mon Jun 21, 2004 10:51 am

chain casting the buffs.. i tried looking into it but cant find the problem.. I am thinking now that its in the main program code and will be found shortly..
:oops:

clide
decaying skeleton
decaying skeleton
Posts: 3
Joined: Mon May 03, 2004 5:03 pm

Post by clide » Mon Jun 21, 2004 2:36 pm

I noticed some problems with calculations. I fixed the chain buffing issue and replaced this code where I found it elsewhere by making the following changes in advbot.mac lines 242, 438, 610 and 759. Basically, it was always setting the calculation to -5 by eliminating the duration and runtime somehow.

Here are the changes
Change line 242

Code: Select all

/varset MDL[${a},${b}] ${Math.Calc[[color=red]([/color]${Spell[${DebuffID[${b}]}].Duration.TotalSeconds}+${Macro.RunTime}[color=red])[/color]-5]}
To

Code: Select all

/varset MDL[${a},${b}] ${Math.Calc[${Spell[${DebuffID[${b}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]}
Change line 438

Code: Select all

/varset SelfBuffedList[${a}] ${Math.Calc[[color=red]([/color]${Spell[${SelfBuffID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}[color=red])[/color]-5]}
To

Code: Select all

/varset SelfBuffedList[${a}] ${Math.Calc[${Spell[${SelfBuffID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]}
Change line 610

Code: Select all

/varset EventList[${a}] ${Math.Calc[[color=red]([/color]${Spell[${EventSpellID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}[color=red])[/color]-5]}
To

Code: Select all

/varset EventList[${a}] ${Math.Calc[${Spell[${EventSpellID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]}
Change line 759

Code: Select all

/varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[[color=red]([/color]${Spell[${GroupBuffID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}[color=red])[/color]-5]} 
To

Code: Select all

/varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[${Spell[${GroupBuffID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]} 

mcdebug
a lesser mummy
a lesser mummy
Posts: 30
Joined: Mon Jun 07, 2004 4:24 am

Post by mcdebug » Mon Jun 21, 2004 3:50 pm

hmmmm did all that and it still chain casts buffs and debuffs, wonder whats up.

Boredbard
a ghoul
a ghoul
Posts: 89
Joined: Thu Nov 27, 2003 11:49 am

Post by Boredbard » Mon Jun 21, 2004 9:14 pm

Still going crazy with the self buffs :(

clide
decaying skeleton
decaying skeleton
Posts: 3
Joined: Mon May 03, 2004 5:03 pm

Post by clide » Tue Jun 22, 2004 1:26 am

I also changed lines 441 and 762. Sorry was posting from work.

Change line 441 from

Code: Select all

/varset SelfBuffedList[${a}] ${Math.Calc[[color=red]([/color]${SelfBuffDuration[${a}]}+${Macro.RunTime}[color=red])[/color]-5]}
To

Code: Select all

/varset SelfBuffedList[${a}] ${Math.Calc[${SelfBuffDuration[${a}]}+${Macro.RunTime}-5]}
Change line 762 from

Code: Select all

/varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[[color=red]([/color]${GroupBuffDuration[${a}]}+${Macro.RunTime}[color=red])[/color]-5]} 
To

Code: Select all

/varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[${GroupBuffDuration[${a}]}+${Macro.RunTime}-5]} 
Hope that helps.

Boredbard
a ghoul
a ghoul
Posts: 89
Joined: Thu Nov 27, 2003 11:49 am

Post by Boredbard » Tue Jun 22, 2004 8:05 pm

Works great now, thanks for the tip!

omper
a ghoul
a ghoul
Posts: 110
Joined: Sat Dec 06, 2003 10:46 pm

Post by omper » Tue Jun 22, 2004 10:13 pm

can someone post a completed update.. IE i cant find the spots you were talking about.. so which .mac or .inc it is and can you post a complete one..

thanks

RudeBoy
orc pawn
orc pawn
Posts: 23
Joined: Wed Mar 24, 2004 7:04 am

Post by RudeBoy » Wed Jun 23, 2004 4:05 am

its in the advbot.mac. If you dont have a visual and work in a text editor without linenumber. Do a search with a part of the strings you been given above and read the lines you find until you find the right line. Make the change. :roll:

Spanky_Monkey
a ghoul
a ghoul
Posts: 103
Joined: Wed Feb 19, 2003 3:10 pm

Hrmmm

Post by Spanky_Monkey » Wed Jun 23, 2004 11:04 am

Ok this is what I came up with. Still not working.

Code: Select all

|
| advbot.mac
| Advanced Caster Bot macro. This macro lets you specify precise thresholds for debuffing/healing/events etc.
| Version 1.95
| Date:5/16/2004 11:00am
|

#turbo 40

#include advbot.inc
#include advbot2.inc
#include spellcast.inc
#include advpath.inc

| Uncomment these if you'd like commands to work via group and chat channels.
|#chat group
|#chat chat

#chat tell


Sub Main(INI)
/declare a int local
/declare b int local
/call SetupADVars
/call InitAPFVars 1 15 20 
/varset IniFile AD_${Me.Name}
/if (${Defined[INI]}) {
    /varset IniFile ${IniFile}_${INI}
}
/varset IniFile ${IniFile}.ini
/call Startup


:MainLoop
/call AdvPathCall

/if (!${Zone.Name.Equal["${ZoneName}"]}) {
    /for a 1 to ${TrackNumber}
        /varset MobList[${a}] 0
        /for b 1 to ${DebuffCount}
            /varset MDL[${a},${b}] 0
            /varset MobAnnounced[${a},${b}] 0
        /next b
    /next a
    /varset VarNpcCount 0     
    /varset ZoneName ${Zone.Name}   
}

/if (${PauseDebuffs}==0 && !${Me.Moving} && ${DebuffTimer}==0) /call DebuffSub

/if (${PauseDebuffs}==0) /call CheckNPC

/if (${PausePet}==0 && ${PetCheckTimer}==0) /call PetCheck

/if (${NoSit}==0 && !${Me.Moving} && ${SitCheckTimer}==0 && !${Me.Mount.ID}>0) /call SitCheck

/doevents

/if (${PauseDebuffs}==0 && !${Me.Moving}) /call IterateNPC

/if (${PauseSelfBuffs}==0 && !${Me.Moving} && ${SelfBuffTimer}==0 && (${VarNpcCount}<2 || ${PauseDebuffs}==1)) /call SelfBuffCheck

/if (${PauseGroupBuffs}==0 && !${Me.Moving} && ${GroupBuffTimer}==0 && (${VarNpcCount}<2 || ${PauseDebuffs}==1)) /call GroupBuffCheck

/if (${PausePet}==0 && !${Me.Moving} && ${PetBuffCheckTimer}==0 && (${VarNpcCount}<2 || ${PauseDebuffs}==1)) /call PetBuffCheck

/if (${PauseEvents}==0 && !${Me.Moving} && ${EventTimer}==0) /call EventCheck

/if (${PauseDebuffs}==0) /call CheckNPC

/if (${NoSit}==0 && !${Me.Moving}) /call SitCheck

/if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck

/doevents

/if (${MiscCheckTimer}==0) {
    /varset MiscCheckTimer 5s
    /if (${Me.Invited}) /timed 20 /disband
    /if (${Window[ConfirmationDialogBox].Open}) /notify ConfirmationDialogBox Yes_Button leftmouseup
}
/goto :MainLoop
/return

Sub AdvPathCall
/if (${FollowFlag}==1) {
    /if (!${Me.Mount.ID}>0 && !${Me.Standing} && ${Spawn[${FollowID}].Distance3D}>=${FollowDistance}) /stand
    /call AdvPathPoll
}
/return

Sub SitCheck
/declare MobHeading int local
/declare MeHeading int local
/declare MiniIterate int local
/declare AggroFlag int local
/declare AggroID int local
/varset SitCheckTimer 2s
/if (${FollowFlag}==1 && ${Spawn[${FollowID}].Distance3D}>${FollowDistance}) /return
    /varset MiniIterate 1
    /varset AggroFlag 0
    /varset AggroID 0
    :CheckNext
    /varset AggroID ${NearestSpawn[${MiniIterate},npc radius ${SitAggroRadiusCheck} zradius 10].ID}
    /if (${AggroID}>0) {
        /varset MobHeading ${Spawn[${AggroID}].Heading.Degrees}
        /if (${Math.Abs[${Math.Calc[${Spawn[${AggroID}].HeadingTo.Degrees}+180]}]}>=359.99) {
            /varset MeHeading ${Math.Calc[(${Spawn[${AggroID}].HeadingTo.Degrees}-180)+360]}
        } else {
            /varset MeHeading ${Math.Calc[(${Spawn[${AggroID}].HeadingTo.Degrees}+180)+360]}
        }
        /if ((${Math.Calc[${MobHeading}+360]}>${Math.Calc[${MeHeading}-15]})&&(${Math.Calc[${MobHeading}+360]}<${Math.Calc[${MeHeading}+15]})) {
            /varset AggroFlag 1
            /if (!${Me.Mount.ID}>0) {
                /if (${Me.Sitting}) /stand
            }
            /goto :BreakOutCheckAggro
        }
    } else {
        /if (${AggroFlag}==0) {
            /if (!${Me.Mount.ID}>0) {
                /if (${Me.Standing}) /sit on
            }
            /goto :BreakOutCheckAggro
        }
    }
    /varset MiniIterate ${Math.Calc[${MiniIterate}+1]}
    /goto :CheckNext
    :BreakOutCheckAggro
/return


Sub IterateNPC
/declare npcid int local
/declare a int local
/declare b int local
/declare compare int local
/declare TempNpcCount int local
/varset npcid 0
/varset TempNpcCount 0
:GetSpawn
/doevents
/varset npcid ${NearestSpawn[${Math.Calc[${TempNpcCount}+1]},npc radius ${Radius} zradius 10 noalert ${AlertList}].ID}
/if (!${String[${npcid}].Equal[NULL]}) {

   /varset TempNpcCount ${Math.Calc[${TempNpcCount}+1]}
   /if (${TempNpcCount}>${TrackNumber}) /goto :DoneSearching
   /varset compare 0
   /for a 1 to ${TrackNumber}
       /if (${npcid}==${MobList[${a}]}) {
           /varset compare 1
           /goto :BreakOutComp
       }
   /next a
   :BreakOutComp
   /if (${compare}==0) {
       /for a 1 to ${TrackNumber}
           /if (${MobList[${a}]}==0) {
               /varset VarNpcCount ${Math.Calc[${VarNpcCount}+1]}
               /varset MobList[${a}] ${npcid}
               /for b 1 to ${DebuffCount}
                   /varset MDL[${a},${b}] ${Math.Calc[${DebuffStartWait[${b}]}+${Macro.RunTime}]}
                   /varset MobAnnounced[${a},${b}] 0
               /next b
               /goto :GetSpawn
           }
       /next a
   }
} else {
    /goto :DoneSearching
}
/goto :GetSpawn
:DoneSearching
/return


Sub DebuffSub
/call IterateNPC
/varset DebuffTimer ${DebuffCheckTime}
/declare a int local
/declare b int local
/declare c int local
/declare MATarget int local 0
/if (${PauseAssist}==0) {
    /if (${TankName.Length}>0 && !${TankName.Equal[Main Assist Name]}) {
        /if (${Spawn[pc ${TankName}].Distance}<200) {
            /squelch /target myself
            /delay 1s ${Target.ID}==${Me.ID}
            /assist ${TankName}
            /delay 1s ${Target.ID}!=${Me.ID}
            /varset MATarget ${Target.ID}
        }
    }
}
/for a 1 to ${TrackNumber}
    /doevents Enraged
    /call AdvPathCall 
    /if (${PauseDebuffs}==0  && !${Me.Moving}) {
        /if (${MobList[${a}]}!=0) {
        /for b 1 to ${DebuffCount}
            /doevents Enraged
            /if (${MobList[${a}]}!=${MATarget} && ${DebuffOnMATarget[${b}]}==1 && ${PauseAssist}==0) /goto :BreakOutDebuff
            /if (${VarNpcCount}<${DebuffMinMobsInArea[${b}]}) /goto :BreakOutDebuff

            /call AdvPathCall 
            /squelch /target id ${MobList[${a}]}
            /delay 1s ${Target.ID}==${MobList[${a}]}
            /if (!${Target.Type.Equal["NPC"]}) /goto :NotNPC
            /if (${Spawn[${MobList[${a}]}].Distance}>${Radius}) /goto :NotNPC
            /if (((${MDL[${a},${b}]}==0)||(${MDL[${a},${b}]}<${Math.Calc[${Macro.RunTime}]}))&&(${Spawn[${MobList[${a}]}].PctHPs}<=${DebuffMinHealth[${b}]})&&(${Spawn[${MobList[${a}]}].PctHPs}>${DebuffMinHealthNoCast[${b}]})&&(!${Spawn[${MobList[${a}]}].State.Equal["DEAD"]})&&(${Me.PctMana}>${DebuffMinMana[${b}]})) {
                /if (((!${Debuff[${b}].Find["item"]})&&(!${Debuff[${b}].Find["activate"]}))&&((!${Me.SpellReady["${Debuff[${b}]}"]})&&(${Me.Gem["${Debuff[${b}]}"]}))) {
                    /for c 1 to 30
                        /delay 1
                        /if (${Me.SpellReady["${Debuff[${b}]}"]}) {
                            /goto :ContinueDebuff
                        }
                    /next c
                    /if (!${Me.SpellReady["${Debuff[${b}]}"]}) /goto :BreakOutDebuff
                }
                :ContinueDebuff
                /if (!${Target.ID}>0) /goto :NotNPC
                /echo Debuffing: -[ ${Spawn[${MobList[${a}]}].CleanName} ]- with ${Debuff[${b}]}.
                /if (${FaceBeforeDebuff}==1) /face
                /if (${Announce}==1) {
                    /call Debuff ${MobList[${a}]} "${Debuff[${b}]}" "${DebuffAnnounce[${b}]}" ${a} ${b} "${DebuffMemToSlot[${b}]}"
                } else {
                    /call Debuff ${MobList[${a}]} "${Debuff[${b}]}" "NULL" ${a} ${b} "${DebuffMemToSlot[${b}]}"
                }

                /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) {
                    /delay 5
                    /return
                }
                /if (${Macro.Return.Equal["NODELAY"]}) {
                    /if (${DebuffDuration[${b}]}==99999) {
                        /varset MDL[${a},${b}] ${Math.Calc[99999+${Macro.RunTime}]}
                    } else /if (${DebuffDuration[${b}]}==0) {
                        /if (${Spell[${DebuffID[${b}]}].Duration.TotalSeconds}==0) {
                            /varset MDL[${a},${b}] ${Math.Calc[(1+${Macro.RunTime})-5]}
                        } else {
/varset MDL[${a},${b}] ${Math.Calc[${Spell[${DebuffID[${b}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]}                        }
                    } else {
                        /varset MDL[${a},${b}] ${Math.Calc[(${DebuffDuration[${b}]}+${Macro.RunTime})-5]}
                    }
                } else {
                    /varset MDL[${a},${b}] ${Math.Calc[15+${Macro.RunTime}]}
                }
                /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck
                /if (${PausePet}==0 && ${PetCheckTimer}==0) /call PetCheck
            }
        :BreakOutDebuff
        /next b
        /if (${PauseEvents}==0 && ${EventTimer}==0 && !${Me.Moving}) /call EventCheck
        /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck
        }
    }
    :NotNPC
    /doevents
/next a
/return


Sub CheckNPC
/declare a int local
/declare b int local
/for a 1 to ${TrackNumber}
    /if (${MobList[${a}]}!=0) {
        /if ((${Spawn[${MobList[${a}]}].State.Equal["DEAD"]})||(!${Spawn[${MobList[${a}]}].ID})||(${Spawn[${MobList[${a}]}].Distance}>${Radius})) {
            /varset MobList[${a}] 0
            /varset VarNpcCount ${Math.Calc[${VarNpcCount}-1]}
            /for b 1 to ${DebuffCount}
                /varset MDL[${a},${b}] 0
                /varset MobAnnounced[${a},${b}] 0
            /next b
        }
    }
/next a
/return


Sub Debuff(mobid,debname,debannounce,a,b,memtoslot)
/declare resistcount int local
/declare retrytimer int local
/declare ParseAnnounceChannels string local
/declare TempHoldAnnounce string local

/varset resistcount 1
:RecastDebuff
/if (${PauseDebuffs}==1) /return
/if (${Me.Sitting}) /stand
/if (${debname.Left[4].Equal["item"]}) {
    /call Cast "${debname.Right[-5]}" "item" "${Dismount}"
} else /if (${debname.Left[8].Equal["activate"]}) {
    /if (!${Me.AltAbilityReady[${debname.Right[-9]}]}) /return DELAY
    /call Cast "${debname.Right[-9]}" "activate" "${Dismount}"
} else {
    /call Cast "${debname}" "gem${memtoslot}" "${Dismount}"
}
/if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) /return CAST_LOSTTARGET

/if (${Macro.Return.Equal["CAST_TOOK2LONG"]}) /return DELAY

/if (${Macro.Return.Equal["CAST_RESISTED"]}) {
    /if (${Spell["${debname}"].RecastTime}) {
        /if (${Spell["${debname}"].RecastTime}<=10) {
            /varset retrytimer ${Math.Calc[${Spell["${debname}"].RecastTime}+1+${Macro.RunTime}]}
        } else {
            /return NODELAY
        }
    }
    /if (${resistcount}<${RetryCount}) {
        /varset resistcount ${Math.Calc[${resistcount}+1]}
        :WaitForGem
        /call AdvPathCall 
        /delay 1
        /if (${debname.Left[4].Equal["item"]}) {
            /squelch /target id ${mobid}
            /delay 1s ${Target.ID}==${mobid}
            /goto :RecastDebuff
        } else /if (${debname.Left[8].Equal["activate"]}) {
            /squelch /target id ${mobid}
            /delay 1s ${Target.ID}==${mobid}
            /goto :RecastDebuff
        } else {
            /if (${retrytimer}<${Math.Calc[${Macro.RunTime}]}) {
                /return NODELAY
            }
            /if (!${Me.SpellReady["${debname}"]}) {
                /goto :WaitForGem
            }
        }
        /squelch /target id ${mobid}
        /delay 1s ${Target.ID}==${mobid}
        /goto :RecastDebuff
    } else {
        /return NODELAY
    }
}
/if ((${Macro.Return.Equal["CAST_CANNOTSEE"]})||(${Macro.Return.Equal["CAST_OUTOFRANGE"]})) {
    /echo -(( Mob out of range or cannot be seen.  Waiting 15 seconds and trying again. ))-
    /return DELAY
}
/if ((${Macro.Return.Equal["CAST_SUCCESS"]})&&(${Announce}==1)&&(!${debannounce.Equal["NULL"]})&&(${MobAnnounced[${a},${b}]}==0)) {
    /if (${AnnounceChannel.Length}>0) {
        /if (${AnnounceChannel.Find[;]}) {
            /varset TempHoldAnnounce ${AnnounceChannel}
            :ParseNext
            /varset ParseAnnounceChannels ${TempHoldAnnounce.Arg[1,;]}
            /varset TempHoldAnnounce ${TempHoldAnnounce.Right[-${TempHoldAnnounce.Find[;]}]}
            :SendIt
            /if (${ParseAnnounceChannels.Equal[gsay]} && ${Group}>0) {
                /gsay ${debannounce}
            } else /if (!${ParseAnnounceChannels.Equal[gsay]}) {
                /docommand /${ParseAnnounceChannels} ${debannounce}
            }
            /if (${TempHoldAnnounce.Length}>0) {
                /if (${TempHoldAnnounce.Find[;]}>0) {
                    /goto :ParseNext
                } else {
                    /varset ParseAnnounceChannels ${TempHoldAnnounce}
                    /varset TempHoldAnnounce
                    /goto :SendIt
                }
            }
        } else {
            /if (${AnnounceChannel.Equal[gsay]} && ${Group}>0) {
                /gsay ${debannounce}
            } else /if (!${AnnounceChannel.Equal[gsay]}) {
                /docommand /${AnnounceChannel} ${debannounce}
            }
        }
    }
    /varset MobAnnounced[${a},${b}] 1
}
/return NODELAY


Sub SelfBuffCheck
/varset SelfBuffTimer ${SelfBuffCheckTime}
/declare a int local
/declare f int local
/declare RetryBuffCount int local
/if (${SelfBuffCount}>0) {
    /for a 1 to ${SelfBuffCount}
        /if (${PauseSelfBuffs}==1 || ${Me.Moving}) /return
        /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck
        /varset RetryBuffCount 0       
        /call AdvPathCall 
        /if ((${SelfBuffedList[${a}]}<${Math.Calc[${Macro.RunTime}]})||((${SelfBuffIconCheck[${a}]}==1)&&(!${Me.Buff["${SelfBuffIconName[${a}]}"].Duration})&&(${SelfBuffedList[${a}]}!=99999))) {
            :RetryBuff
            /if (${PauseSelfBuffs}==1) /return

            /if ((!${SelfBuff[${a}].Find["item"]}>0)&&(!${SelfBuff[${a}].Find["activate"]}>0)) {
                /if (${Me.Gem[${SelfBuff[${a}]}]}) {
                    /for f 1 to 30
                        /delay 1
                        /if (${Me.SpellReady["${SelfBuff[${a}]}"]}) {
                            /goto :ContinueSelfBuff
                        }
                    /next f
                    /if (!${Me.SpellReady["${SelfBuff[${a}]}"]}) /goto :BreakOutSelf
                }
            }
            :ContinueSelfBuff
            /if ((${Me.Gem[${SelfBuff[${a}]}]})||(${SelfBuff[${a}].Find["item"]})||(${SelfBuff[${a}].Find["activate"]})||(${SelfBuffMemToSlot[${a}]}>0)) {
                /if (${Me.Sitting}) /stand
                /squelch /target myself
                /delay 1s ${Target.ID}==${Me.ID}
                /if (${SelfBuff[${a}].Left[4].Equal["item"]}) {
                    /echo -[ Casting Self Buff : ${SelfBuff[${a}]} ]-
                    /call Cast "${SelfBuff[${a}].Right[-5]}" "item" "${Dismount}"
                } else /if (${SelfBuff[${a}].Left[8].Equal["activate"]}) {
                    /if (!${Me.AltAbilityReady[${SelfBuff[${a}].Right[-9]}]}) /goto :BreakOutSelf
                    /echo -[ Casting Self Buff : ${SelfBuff[${a}]} ]-
                    /call Cast "${SelfBuff[${a}].Right[-9]}" "activate" "${Dismount}"
                } else {
                    /echo -[ Casting Self Buff : ${SelfBuff[${a}]} ]-
                    /call Cast "${SelfBuff[${a}]}" "gem${SelfBuffMemToSlot[${a}]}" "${Dismount}"
                }
                /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) {
                    /delay 5
                    /varset SelfBuffTimer 0
                    /return
                }
                /if (${Macro.Return.Equal["CAST_TOOK2LONG"]}) {
                    /varset SelfBuffedList[${a}] ${Math.Calc[15+${Macro.RunTime}]}
                    /goto :BreakOutSelf
                }
                /if (${SelfBuffDuration[${a}]}==99999) {
                    /varset SelfBuffedList[${a}] ${Math.Calc[99999+${Macro.RunTime}]}
                } else /if (${SelfBuffDuration[${a}]}==0) {

                    /if (${Spell[${SelfBuffID[${a}]}].Duration.TotalSeconds}==0) {
                        /varset SelfBuffedList[${a}] ${Math.Calc[(1+${Macro.RunTime})-5]}
                    } else {
/varset SelfBuffedList[${a}] ${Math.Calc[${Spell[${SelfBuffID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]}                    }
                } else {
/varset SelfBuffedList[${a}] ${Math.Calc[${SelfBuffDuration[${a}]}+${Macro.RunTime}-5]}                }
            } else {
                /if (${RetryBuffCount}==0) {
                    /if (!${Me.SpellReady["${SelfBuff[${a}]}"]}) {
                        /call Delay 3s
                        /varset RetryBuffCount ${Math.Calc[${RetryBuffCount}+1]}
                        /goto :RetryBuff
                    }
                }
                /echo -(( Self Buff:${SelfBuff[${a}]} not memmed or not ready. ))-
                /echo -(( Waiting 60 seconds before retrying buff. ))-
                /varset SelfBuffedList[${a}] ${Math.Calc[60+${Macro.RunTime}]}
            }
        }
    :BreakOutSelf
    /next a
}
/return


Sub PetCheck
/varset PetCheckTimer ${PetCheckTime}
/declare PetTarget int local 0
/if (${PauseAssist}==0) {
    /if (${Me.Pet.ID}>0 && !${TankName.Equal[Main Assist Name]} && ${TankName.Length}>0) {
        /if (${Spawn["${TankName}"].Distance}<150) {
            /squelch /target id ${Me.Pet.ID}
            /delay 1s ${Target.ID}==${Me.Pet.ID}
            /assist
            /delay 1s ${Target.ID}!=${Me.Pet.ID}
            /if ((${Target.ID}>0) && (${Target.ID}!=${Me.Pet.ID}) && (!${Target.Type.Equal[CORPSE]})) {
                /varset PetTarget ${Target.ID}
            } else {
                /varset PetTarget 0
            }
            /assist ${TankName}
            /delay 7
            /if (${Target.ID}>0 && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}<=${PetAssistOnHPPct}) {
                /if (${PetTarget}==0) {
                    /pet attack
                } else /if (${PetTarget}!=${Target.ID}) {
                    /pet back off
                    /delay 2
                    /pet attack
                }
            }
        }
    }
}
/return


Sub PetBuffCheck
/declare a int local
/declare f int local
/declare RetryPetBuffCount int local
/varset PetBuffCheckTimer ${PetBuffCheckTime}
/if (${Me.Pet.ID}>0 && ${PetBuffCount}>0) {
    /for a 1 to ${PetBuffCount}
        /varset RetryPetBuffCount 0
        /if (!${Me.PetBuff["${PetBuffIconName[${a}]}"]}>0 && ${Me.Pet.Distance}<100) {
            /if (${PausePet}==1) /return

            :RetryPetBuff
            /if ((!${PetBuff[${a}].Find["item"]}>0)&&(!${PetBuff[${a}].Find["activate"]}>0)) {
                /if (${Me.Gem[${PetBuff[${a}]}]}) {
                    /for f 1 to 30
                        /delay 1
                        /if (${Me.SpellReady["${PetBuff[${a}]}"]}) {
                            /goto :ContinuePetBuff
                        }
                    /next f
                    /if (!${Me.SpellReady["${PetBuff[${a}]}"]}) /goto :BreakOutPetBuff
                }
            }
            :ContinuePetBuff
            /if ((${Me.Gem[${PetBuff[${a}]}]})||(${PetBuff[${a}].Find["item"]})||(${PetBuff[${a}].Find["activate"]})||(${PetBuffMemToSlot[${a}]}>0)) {
                /if (${Me.Sitting}) /stand
                /squelch /target id ${Me.Pet.ID}
                /delay 1s ${Target.ID}==${Me.Pet.ID}
                /if (${PetBuff[${a}].Left[4].Equal["item"]}) {
                    /echo -[ Casting Pet Buff : ${PetBuff[${a}]} ]-
                    /call Cast "${PetBuff[${a}].Right[-5]}" "item" "${Dismount}"
                } else /if (${PetBuff[${a}].Left[8].Equal["activate"]}) {
                    /if (!${Me.AltAbilityReady[${PetBuff[${a}].Right[-9]}]}) /goto :BreakOutPetBuff
                    /echo -[ Casting Pet Buff : ${PetBuff[${a}]} ]-
                    /call Cast "${PetBuff[${a}].Right[-9]}" "activate" "${Dismount}"
                } else {
                    /echo -[ Casting Pet Buff : ${PetBuff[${a}]} ]-
                    /call Cast "${PetBuff[${a}]}" "gem${PetBuffMemToSlot[${a}]}" "${Dismount}"
                }
            } else {
                /if (${RetryPetBuffCount}==0) {
                    /if (!${Me.SpellReady["${PetBuff[${a}]}"]}) {
                        /call Delay 3s
                        /varset RetryPetBuffCount ${Math.Calc[${RetryPetBuffCount}+1]}
                        /goto :RetryPetBuff
                    }
                }
            }


        }
    :BreakOutPetBuff
    /next a
}
/return


Sub EventCheck
/varset EventTimer ${EventCheckTime}
/declare a int local
/declare c int local
/declare RetryEventCount int local
/if (${EventCount}>0) {
    /for a 1 to ${EventCount}
        /call AdvPathCall 
        /if (${PauseEvents}==1 || ${Me.Moving}) /return
        /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck
        /varset RetryEventCount 0
        /if ((${Me.PctMana}<=${EventMinMana[${a}]})&&(${Me.PctMana}>=${EventMaxMana[${a}]})&&(${Me.PctHPs}<=${EventMinHP[${a}]})&&(${Me.PctHPs}>=${EventMaxHP[${a}]})) {
            /if (${EventList[${a}]}<${Math.Calc[${Macro.RunTime}]}) {
                :RetryEvent
                /if (${PauseEvents}==1) /return

                /if ((!${EventSpell[${a}].Find["item"]}>0)&&(!${EventSpell[${a}].Find["activate"]}>0)) {
                    /if (${Me.Gem[${EventSpell[${a}]}]}) {
                        /for c 1 to 30
                            /delay 1
                            /if (${Me.SpellReady["${EventSpell[${a}]}"]}) {
                                /goto :ContinueEvent
                            }
                        /next c
                        /if (!${Me.SpellReady["${EventSpell[${a}]}"]}) /goto :BreakOutEvent
                    }
                }
                :ContinueEvent
                /if ((${Me.Gem[${EventSpell[${a}]}]})||(${EventSpell[${a}].Find["item"]})||(${EventSpell[${a}].Find["activate"]})||(${EventMemToSlot[${a}]}>0)) {
                    /if (${Me.Sitting}) /stand
                    /squelch /target myself
                    /delay 1s ${Target.ID}==${Me.ID}
                    /if (${EventSpell[${a}].Left[4].Equal["item"]}) {
                        /echo -[ Casting Event Spell : ${EventSpell[${a}]} ]-
                        /call Cast "${EventSpell[${a}].Right[-5]}" "item" "${Dismount}"
                    } else /if (${EventSpell[${a}].Left[8].Equal["activate"]}) {
                        /if (!${Me.AltAbilityReady[${EventSpell[${a}].Right[-9]}]}) /goto :BreakOutEvent
                        /echo -[ Casting Event Spell : ${EventSpell[${a}]} ]-
                        /call Cast "${EventSpell[${a}].Right[-9]}" "activate" "${Dismount}"
                    } else {
                        /echo -[ Casting Event Spell : ${EventSpell[${a}]} ]-
                        /call Cast "${EventSpell[${a}]}" "gem${EventMemToSlot[${a}]}" "${Dismount}"
                    }
                    /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) {
                        /delay 5
                        /varset EventTimer 0
                        /return
                    }
                    /if (${Macro.Return.Equal["CAST_TOOK2LONG"]}) {
                        /varset EventList[${a}] ${Math.Calc[15+${Macro.RunTime}]}
                        /goto :BreakOutEvent
                    }

                    /if (${EventDuration[${a}]}==99999) {
                        /varset EventList[${a}] ${Math.Calc[99999+${Macro.RunTime}]}
                    } else /if (${EventDuration[${a}]}==0) {
                        /if (${Spell[${EventSpellID[${a}]}].Duration.TotalSeconds}==0) {
                            /varset EventList[${a}] ${Math.Calc[(1+${Macro.RunTime})-5]}
                        } else {
/varset EventList[${a}] ${Math.Calc[${Spell[${EventSpellID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]}                        }
                    } else {
                        /varset EventList[${a}] ${Math.Calc[(${EventDuration[${a}]}+${Macro.RunTime})-5]}
                    }

                } else {
                    /if (${RetryEventCount}==0) {
                        /if (!${Me.SpellReady["${EventSpell[${a}]}"]}) {
                            /call Delay 3s
                            /varset RetryEventCount ${Math.Calc[${RetryEventCount}+1]}
                            /goto :RetryEvent
                        }
                    }
                    /echo -(( Event Spell:${EventSpell[${a}]} not memmed or not ready. ))-
                    /echo -(( Waiting 60 seconds before retrying event. ))-
                    /varset EventList[${a}] ${Math.Calc[60+${Macro.RunTime}]}
                }
            }
        }
    :BreakOutEvent
    /next a
}
/return


Sub GroupBuffCheck
/varset GroupBuffTimer ${GroupBuffCheckTime}
/declare a int local
/declare b int local
/declare c int local
/declare f int local
/declare RetryBuffCount int local
/declare ParseAnnounceChannels string local
/declare TempHoldAnnounce string local
/if (${GroupBuffCount}>0) {
    /for a 1 to ${GroupBuffCount}
        /if (${PauseGroupBuffs}==1 || ${Me.Moving}) /return
        /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck
        /call AdvPathCall
        /for b 0 to ${Group}
            /call AdvPathCall
            /varset RetryBuffCount 0       
            /if (${Me.PctMana}>=${GroupBuffMinMana[${a}]}) {

                /if (${GBL[${a},${Math.Calc[${b}+1]}]}<${Math.Calc[${Macro.RunTime}]}) {

                /if (${Math.Calc[${Group}+1]}<${GroupBuffMinGroupCount[${a}]}) /goto :BreakOutBuff

                /if (((${Spell[${GroupBuffID[${a}]}].TargetType.Find["Group"]})&&(${b}!=0))||((${GroupBuffMinGroupCount[${a}]}>0)&&(${b}!=0))) /goto :BreakOutBuff

                /if ((${b}>0)&&(!${GroupBuffClass[${a}].Find["${Group[${b}].Class.ShortName}"]})) /goto :BreakOutMember

                /if ((${b}==0)&&(!${GroupBuffClass[${a}].Find["${Me.Class.ShortName}"]})&&((!${Spell[${GroupBuffID[${a}]}].TargetType.Find["Group"]})||(${GroupBuffMinGroupCount[${a}]}==0))) /goto :BreakOutMember

                    :RetryBuff
                    /if (${PauseGroupBuffs}==1 || ${Me.Moving}) /return
                    /if ((${Me.Gem[${GroupBuff[${a}]}]})||(${GroupBuff[${a}].Find["item"]})||(${GroupBuff[${a}].Find["activate"]})||(${GroupBuffMemToSlot[${a}]}>0)) {

                        /if ((${GroupBuff[${a}].Find["activate"]})&&(!${Me.AltAbilityReady[${GroupBuff[${a}].Right[-9]}]})) /goto :BreakOutBuff

                        /if ((!${GroupBuff[${a}].Find["item"]}>0)&&(!${GroupBuff[${a}].Find["activate"]}>0)) {
                            /if (${Me.Gem[${GroupBuff[${a}]}]}) {
                                /for f 1 to 30
                                    /delay 1
                                    /if (${Me.SpellReady["${GroupBuff[${a}]}"]}) {
                                        /goto :ContinueGroupBuff
                                    }
                                /next f
                                /if (!${Me.SpellReady["${GroupBuff[${a}]}"]}) /goto :BreakOutBuff
                           }
                        }
                        :ContinueGroupBuff
                        /if (${Spell[${GroupBuffID[${a}]}].TargetType.Find["Group"]} || ${b}==0) {                       
                            /squelch /target myself
                            /delay 1s ${Target.ID}==${Me.ID}
                        } else {
                            /squelch /target id ${Group[${b}].ID}
                            /delay 1s ${Target.ID}==${Group[${b}].ID}
                        }
                        /if (!${Target.CleanName.Equal[${Group[${b}]}]}) {
                            /echo -(( Target not in zone.  Waiting 30 seconds and trying again. ))-
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[30+${Macro.RunTime}]}
                            /goto :BreakOutMember
                        }
                        /if (!${GroupBuff[${a}].Find[Item]} && !${GroupBuff[${a}].Find[Activate]} && ${Target.Distance3D}>${Spell[${GroupBuffID[${a}]}].Range}) /goto :BreakOutMember
                        /if ((${Announce}==1)&&(!${GroupBuffAnnounce[${a}].Equal["NULL"]})) {
                            /if (${AnnounceChannel.Length}>0) {
                                /if (${AnnounceChannel.Find[;]}) {
                                    /varset TempHoldAnnounce ${AnnounceChannel}
                                    :ParseNext
                                    /varset ParseAnnounceChannels ${TempHoldAnnounce.Arg[1,;]}
                                    /varset TempHoldAnnounce ${TempHoldAnnounce.Right[-${TempHoldAnnounce.Find[;]}]}
                                    :SendIt
                                    /if (${ParseAnnounceChannels.Equal[gsay]} && ${Group}>0) {
                                        /gsay ${GroupBuffAnnounce[${a}]}
                                    } else /if (!${ParseAnnounceChannels.Equal[gsay]}) {
                                        /docommand /${ParseAnnounceChannels} ${GroupBuffAnnounce[${a}]}
                                    }
                                    /if (${TempHoldAnnounce.Length}>0) {
                                        /if (${TempHoldAnnounce.Find[;]}>0) {
                                            /goto :ParseNext
                                        } else {
                                            /varset ParseAnnounceChannels ${TempHoldAnnounce}
                                            /varset TempHoldAnnounce
                                            /goto :SendIt
                                        }
                                   }
                               } else {
                                   /if (${AnnounceChannel.Equal[gsay]} && ${Group}>0) {
                                       /gsay ${GroupBuffAnnounce[${a}]}
                                   } else /if (!${AnnounceChannel.Equal[gsay]}) {
                                       /docommand /${AnnounceChannel} ${GroupBuffAnnounce[${a}]}
                                   }
                               }
                            }
                        }
                        /if (${Me.Sitting}) /stand
                        /if (${GroupBuff[${a}].Left[4].Equal["item"]}) {
                            /echo -[ Casting Group Buff : ${GroupBuff[${a}]} ]-
                            /call Cast "${GroupBuff[${a}].Right[-5]}" "item" "${Dismount}"
                        } else /if (${GroupBuff[${a}].Left[8].Equal["activate"]}) {
                            /echo -[ Casting Group Buff : ${GroupBuff[${a}]} ]-
                            /call Cast "${GroupBuff[${a}].Right[-9]}" "activate" "${Dismount}"
                        } else {
                            /echo -[ Casting Group Buff : ${GroupBuff[${a}]} ]-
                            /call Cast "${GroupBuff[${a}]}" "gem${GroupBuffMemToSlot[${a}]}" "${Dismount}"
                        }
                        /if (${Macro.Return.Equal["CAST_TOOK2LONG"]}) {
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[15+${Macro.RunTime}]}
                            /goto :BreakOutBuff
                        }
                        /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) {
                            /delay 5
                            /varset GroupBuffTimer 0
                            /return
                        }
                        /if ((${Macro.Return.Equal["CAST_CANNOTSEE"]})||(${Macro.Return.Equal["CAST_OUTOFRANGE"]})) {
                            /echo -(( Out of range or cannot be seen.  Waiting 20 seconds and trying again. ))-
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[20+${Macro.RunTime}]}
                            /goto :BreakOutMember
                        }
                        /if (${GroupBuffDuration[${a}]}==99999) {
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[99999+${Macro.RunTime}]}
                        } else /if (${GroupBuffDuration[${a}]}==0) {

                            /if (${Spell[${GroupBuffID[${a}]}].Duration.TotalSeconds}==0) {
                                /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[(1+${Macro.RunTime})-5]}
                            } else {
/varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[${Spell[${GroupBuffID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]}                            }
                        } else {
/varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[${GroupBuffDuration[${a}]}+${Macro.RunTime}-5]}                        }
                    } else {
                        /if (${RetryBuffCount}==0) {
                            /if (!${Me.SpellReady["${GroupBuff[${a}]}"]}) {
                                /call Delay 3s
                                /varset RetryBuffCount ${Math.Calc[${RetryBuffCount}+1]}
                                /goto :RetryBuff
                            }
                        }
                        /echo -(( Group Buff:${GroupBuff[${a}]} not memmed or not ready. ))-
                        /echo -(( Waiting 60 seconds before retrying buff. ))-
                        /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[60+${Macro.RunTime}]}
                    }
                }
            }
        :BreakOutMember
        /next b
    :BreakOutBuff
    /next a
}
/return


Sub HealCheck
/varset HealTimer ${HealCheckTime}
/declare a int local
/declare b int local
/declare c int local
/declare d int local
/declare e int local
/declare f int local
/declare RetryHealCount int local
/declare GroupHPTotal int local
/declare GroupHealFlag int local
/declare TempIndex int local
/declare TempGroupCount int local
/declare ParseAnnounceChannels string local
/declare TempHoldAnnounce string local
/declare PetHealFlag int local 0
/declare TempGrpCt int local 0
/declare TempClass string local Nothing
/declare TempHealth int local 0
/declare TempTargetType string local
/varset TempGroupCount ${Group}

/if (${HealCount}>0) {
    /for a 1 to ${HealCount}
        /doevents Enraged
        /call AdvPathCall
        /if (${PauseHeals}==1) /return
        /if (${Group}!=${TempGroupCount}) /return
        /varset GroupHealFlag 0
        /if (${Me.PctMana}>=${HealMinMana[${a}]}) {
            /varset GroupHPTotal 0
            /for b 0 to ${Math.Calc[${Group}+${WatchListCount}]}
                /varset PetHealFlag 0
                /call AdvPathCall
                /if (${b}>${Group}) {
                    /varset d ${Math.Calc[${b}-${Group}]}
                    /if (!${WatchList[${d}].Equal[Empty]}) {
                         /for e 0 to 5
                             /if (${WatchList[${d}].Equal[${Group[${e}]}]}) {
                                 /goto :BreakOutHoT
                             }
                         /next e
                    }
                }
                /if (${Group}!=${TempGroupCount}) /return
                /varset TempIndex ${Math.Calc[${b}-${Group}]}
                /if (${b}>${Group}) {
                    /if (!${WatchList[${TempIndex}].Equal[Empty]}) {
                        /if (${Spawn[${WatchList[${TempIndex}]}].ID}) {
                            /if (${Spawn[${WatchList[${TempIndex}]}].Distance}<250) {
                                /if (${Math.Calc[${Macro.RunTime}]}>${WatchTimer[${TempIndex}]}) {
                                    /if (${Target.ID}!=${Spawn[${WatchList[${TempIndex}]}].ID}) {
                                        /squelch /target id ${Spawn[${WatchList[${TempIndex}]}].ID}
                                        /delay 1s ${Target.ID}==${Spawn[${WatchList[${TempIndex}]}].ID}
                                    }
                                    /if (${Spawn[${WatchList[${TempIndex}]}].Pet.ID}>0 && ${HealPets}==1) {
                                        /squelch /target id ${Spawn[${WatchList[${TempIndex}]}].Pet.ID}
                                        /delay 1s ${Target.ID}==${Spawn[${WatchList[${TempIndex}]}].Pet.ID}
                                    }
                                    /varset WatchTimer[${Math.Calc[${TempIndex}]}+1]}] ${Math.Calc[${Macro.RunTime}+2]}
                                }
                            }
                        }
                    }
                }
                /varset RetryHealCount 0
                /if (${Math.Calc[${Group}+1]}<${HealMinGroupCount[${a}]}) /goto :BreakOutHeal

                /varset TempTargetType ${Spell[${HealSpellID[${a}]}].TargetType}
                /if ((${TempTargetType.Find["Group"]})||(${HealMinGroupCount[${a}]}>0)) {
                    /if (${b}<=${Group}) {
                        /if (${Group[${b}].ID}>0) /varset GroupHPTotal ${Math.Calc[${GroupHPTotal}+${Group[${b}].PctHPs}]}
                        /goto :BreakOutHoT
                    } else {
                        /goto :BreakOutHoT
                    }
                }

                /if (${b}<=${Group}) {
                    /varset TempClass ${Group[${b}].Class.ShortName}
                    /varset TempHealth ${Group[${b}].PctHPs}
                    /if (${String["WIZ|MAG|ENC|NEC"].Find["${TempClass}"]}>0) {
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${Math.Calc[${HealMaxHP[${a}]}+${WussyFactor}]}) /goto :ContinueHeal
                    } else /if (${String["SHM|CLR|DRU"].Find["${TempClass}"]}>0) {
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${Math.Calc[${HealMaxHP[${a}]}+(${WussyFactor}/2)]}) /goto :ContinueHeal
                    } else {
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${HealMaxHP[${a}]}) /goto :ContinueHeal
                    }
                    /if (${HealPets}==1) {
                        /varset TempHealth ${Group[${b}].Pet.PctHPs}
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${HealMaxHP[${a}]}) {
                            /varset PetHealFlag 1
                            /goto :ContinueHealPet
                        }
                    }
                } else {
                    /varset TempClass ${Spawn[${WatchList[${TempIndex}]}].Class.ShortName}
                    /varset TempHealth ${Spawn[${WatchList[${TempIndex}]}].PctHPs}
                    /if (${String["WIZ|MAG|ENC|NEC"].Find["${TempClass}"]}>0) {
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${Math.Calc[${HealMaxHP[${a}]}+${WussyFactor}]}) /goto :ContinueHeal
                    } else /if (${String["SHM|CLR|DRU"].Find["${TempClass}"]}>0) {
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${Math.Calc[${HealMaxHP[${a}]}+(${WussyFactor}/2)]}) /goto :ContinueHeal
                    } else {
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${HealMaxHP[${a}]}) /goto :ContinueHeal
                    }
                    /if (${HealPets}==1) {
                        /varset TempHealth ${Spawn[${WatchList[${TempIndex}]}].Pet.PctHPs}
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${HealMaxHP[${a}]}) {
                            /varset PetHealFlag 1
                            /goto :ContinueHealPet
                        }
                    }
                }

                    /goto :BreakOutHoT

                    :ContinueHeal
                    /call AdvPathCall
                    /if (!${HealClass[${a}].Find["${TempClass}"]}>0) /goto :BreakOutHoT

                    :ContinueHealPet
                    /if (${PetHealFlag}==0 && ${Math.Calc[${Macro.RunTime}]}<${HoTList[${Math.Calc[${b}+1]},1]} && ${TempTargetType.Find["Single"]}) /goto :BreakOutHoT
                    /if (${PetHealFlag}==1 && ${Math.Calc[${Macro.RunTime}]}<${HoTList[${Math.Calc[${b}+1]},2]} && ${TempTargetType.Find["Single"]}) /goto :BreakOutHoT
       
                    :RetryHeal
                    /if (${PauseHeals}==1) /return
                    /if (${Me.Gem[${HealSpell[${a}]}]} || ${HealSpell[${a}].Find["item"]} || ${HealSpell[${a}].Find["activate"]} || ${HealMemToSlot[${a}]}>0) {

                        /if (${HealSpell[${a}].Find["activate"]} && !${Me.AltAbilityReady[${HealSpell[${a}].Right[-9]}]}) /goto :BreakOutHeal

                        /if (!${HealSpell[${a}].Find["item"]}>0 && !${HealSpell[${a}].Find["activate"]}>0) {
                            /if (${Me.Gem[${HealSpell[${a}]}]}) {
                                /for f 1 to 30
                                    /delay 1
                                    /if (${Me.SpellReady["${HealSpell[${a}]}"]}) {
                                        /goto :ContinueHeal2
                                    }
                                /next f
                                /if (!${Me.SpellReady["${HealSpell[${a}]}"]}) /goto :BreakOutHeal
                           }
                        }
                        :ContinueHeal2

                        /if (${b}<=${Group} && !${Group[${b}].ID}>0) /goto :BreakOutHoT
                        /if (${b}>${Group} && !${Spawn[${WatchList[${TempIndex}]}].ID}>0) /goto :BreakOutHoT

                        /if ((${TempTargetType.Find["Group"]} || ${b}==0) && ${PetHealFlag}==0) {                       
                            /squelch /target myself
                            /delay 1s ${Target.ID}==${Me.ID}
                        } else /if (${b}<=${Group} && ${PetHealFlag}==0) {
                            /squelch /target id ${Group[${b}].ID}
                            /delay 1s ${Target.ID}==${Group[${b}].ID}
                        } else /if (${PetHealFlag}==1) {
                            /if (${b}<=${Group}) {
                                /squelch /target id ${Group[${b}].Pet.ID}
                                /delay 1s ${Target.ID}==${Group[${b}].Pet.ID}
                            } else {
                                /squelch /target id ${Spawn[${WatchList[${TempIndex}]}].Pet.ID}
                                /delay 1s ${Target.ID}==${Spawn[${WatchList[${TempIndex}]}].Pet.ID}
                            }
                        } else {
                            /squelch /target id ${Spawn[${WatchList[${TempIndex}]}].ID}
                            /delay 1s ${Target.ID}==${Spawn[${WatchList[${TempIndex}]}].ID}
                        }

                        /if (${Target.CleanName.Equal[${Group[${b}]}]}) /goto :TargetInZone
                        /if (${Target.CleanName.Equal[${WatchList[${TempIndex}]}]}) /goto :TargetInZone
                        /if (${Target.CleanName.Equal[${Group[${b}].Pet.CleanName}]}) /goto :TargetInZone
                        /if (${Target.CleanName.Equal[${Spawn[${WatchList[${TempIndex}]}].Pet.CleanName}]}) /goto :TargetInZone

                        /echo -(( Target not in zone.  Waiting 10 seconds and trying again. ))-
                        /if (${PetHealFlag}==0) /varset HoTList[${Math.Calc[${b}+1]},1] ${Math.Calc[10+${Macro.RunTime}]}
                        /if (${PetHealFlag}==1) /varset HoTList[${Math.Calc[${b}+1]},2] ${Math.Calc[10+${Macro.RunTime}]}
                        /goto :BreakOutHoT

                        :TargetInZone
                        /if (!${HealSpell[${a}].Find[Item]} && !${HealSpell[${a}].Find[Activate]} && ${Target.Distance3D}>${Spell[${HealSpellID[${a}]}].Range}) /goto :BreakOutHoT
                        /if (${Announce}==1 && !${HealAnnounce[${a}].Equal["NULL"]}) {
                            /if (${AnnounceChannel.Length}>0) {
                                /if (${AnnounceChannel.Find[;]}) {
                                    /varset TempHoldAnnounce ${AnnounceChannel}
                                    :ParseNext
                                    /varset ParseAnnounceChannels ${TempHoldAnnounce.Arg[1,;]}
                                    /varset TempHoldAnnounce ${TempHoldAnnounce.Right[-${TempHoldAnnounce.Find[;]}]}
                                    :SendIt
                                    /if (${ParseAnnounceChannels.Equal[gsay]} && ${Group}>0) {
                                        /gsay ${HealAnnounce[${a}]}
                                    } else /if (!${ParseAnnounceChannels.Equal[gsay]}) {
                                        /docommand /${ParseAnnounceChannels} ${HealAnnounce[${a}]}
                                    }
                                    /if (${TempHoldAnnounce.Length}>0) {
                                        /if (${TempHoldAnnounce.Find[;]}>0) {
                                            /goto :ParseNext
                                        } else {
                                            /varset ParseAnnounceChannels ${TempHoldAnnounce}
                                            /varset TempHoldAnnounce
                                            /goto :SendIt
                                        }
                                   }
                               } else {
                                   /if (${AnnounceChannel.Equal[gsay]} && ${Group}>0) {
                                       /gsay ${HealAnnounce[${a}]}
                                   } else /if (!${AnnounceChannel.Equal[gsay]}) {
                                       /docommand /${AnnounceChannel} ${HealAnnounce[${a}]}
                                   }
                               }
                            }
                        }
                        /if (${Me.Sitting}) /stand
                        /if (${HealSpell[${a}].Left[4].Equal["item"]}) {
                            /echo -[ Casting Heal Spell : ${HealSpell[${a}]} ]-
                            /call Cast "${HealSpell[${a}].Right[-5]}" "item" "${Dismount}"
                        } else /if (${HealSpell[${a}].Left[8].Equal["activate"]}) {
                            /echo -[ Casting Heal Spell : ${HealSpell[${a}]} ]-
                            /call Cast "${HealSpell[${a}].Right[-9]}" "activate" "${Dismount}"
                        } else {
                            /echo -[ Casting Heal Spell : ${HealSpell[${a}]} ]-
                            /call Cast "${HealSpell[${a}]}" "gem${HealMemToSlot[${a}]}" "${Dismount}"
                        }

                        /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) {
                            /delay 5
                            /varset HealTimer 0
                            /return
                        }
                        /if (${Macro.Return.Equal["CAST_CANNOTSEE"]} || ${Macro.Return.Equal["CAST_OUTOFRANGE"]}) {
                            /echo -(( Out of range or cannot be seen.  Waiting 10 seconds and trying again. ))-
                            /if (${PetHealFlag}==0) /varset HoTList[${Math.Calc[${b}+1]},1] ${Math.Calc[10+${Macro.RunTime}]}
                            /if (${PetHealFlag}==1) /varset HoTList[${Math.Calc[${b}+1]},2] ${Math.Calc[10+${Macro.RunTime}]}
                            /goto :BreakOutHoT
                        }
                        /if (${GroupHealFlag}==1) {
                            /delay 15
                            /varset GroupHealFlag 0
                        }
                        /if (${Spell[${HealSpellID[${a}]}].Duration}>0 && ${Macro.Return.Equal["CAST_SUCCESS"]}) {
                            /if (${PetHealFlag}==0) /varset HoTList[${Math.Calc[${b}+1]},1] ${Math.Calc[${Spell[${HealSpellID[${a}]}].Duration.Seconds}+${Macro.RunTime}]}
                            /if (${PetHealFlag}==1) /varset HoTList[${Math.Calc[${b}+1]},2] ${Math.Calc[${Spell[${HealSpellID[${a}]}].Duration.Seconds}+${Macro.RunTime}]}
                            /if (${Spell[${HealSpellID[${a}]}].Duration}>0 && ${Macro.Return.Equal["CAST_SUCCESS"]} && (${TempTargetType.Find["Group"]} || ${HealMinGroupCount[${a}]}>0)) {
                                /for c 0 to ${Group}
                                    /varset HoTList[${Math.Calc[${c}+1]},1] ${Math.Calc[${Spell[${HealSpellID[${a}]}].Duration.Seconds}+${Macro.RunTime}]}
                                /next c
                                /varset GroupHPTotal ${Math.Calc[100*${Math.Calc[${Group}+1]}]}
                                /goto :BreakOutHeal
                            }
                        }
                        /varset GroupHPTotal ${Math.Calc[100*${Math.Calc[${Group}+1]}]}
                    } else {
                        /if (${RetryHealCount}==0) {
                            /if (!${Me.SpellReady["${HealSpell[${a}]}"]}) {
                                /call Delay 3s
                                /varset RetryHealCount ${Math.Calc[${RetryHealCount}+1]}
                                /goto :RetryHeal
                            }
                        }
                        /echo -(( Heal Spell:${HealSpell[${a}]} not memmed or not ready. ))-
                        /goto :BreakOutHeal
                    }
            :BreakOutHoT
            /next b
            /if (${TempTargetType.Find["Group"]} || ${HealMinGroupCount[${a}]}>0) {
                /varset TempGrpCt 0
                /for c 0 to ${Group}
                    /if (${Group[${c}].ID}>0) /varset TempGrpCt ${Math.Calc[${TempGrpCt}+1]}
                /next c
                /if (${Math.Calc[${GroupHPTotal}\${TempGrpCt}]}>${HealMinHP[${a}]} && ${Math.Calc[${GroupHPTotal}\${TempGrpCt}]}<${HealMaxHP[${a}]}) {
                    /for c 0 to ${Group}
                        /if (${Math.Calc[${Macro.RunTime}]}<${HoTList[${Math.Calc[${c}+1]},1]}) /goto :BreakOutHeal
                    /next c
                    /varset GroupHealFlag 1
                    /varset b 0
                    /goto :RetryHeal
                }
            }
        }
    :BreakOutHeal
    /next a
}
/return


omper
a ghoul
a ghoul
Posts: 110
Joined: Sat Dec 06, 2003 10:46 pm

Post by omper » Wed Jun 23, 2004 11:18 am

wow .. looks like i am not the only one that is having a prob with this .. But want to thank you for that vote of confidence RUDE.. your quite the gentleman..

Again.. i searched for the lines with find and some of them did not come up to be replaced..

could it be that the one that you edited was not the same version as the one we have.. just a guess.. but will prolly get chastized for that also..

oh.. and if you think about trying to say something about my spelling .. dont .. cuz i dont care..

Human Enigma
orc pawn
orc pawn
Posts: 13
Joined: Thu Jun 17, 2004 3:24 pm

Post by Human Enigma » Wed Jun 23, 2004 3:33 pm

just search for all lines that have a right paren followed by a minus sign, then remove the opening and closing parens in that math calc. there is no need for these parens because it's all addition and subtraction anyway and it appears there is a parse error in the new calc that has to do with subtraction following parens.

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Thu Jun 24, 2004 12:32 pm

didnt test the selfbuff code as I dont use it but rest works

Code: Select all

| 
| advbot.mac 
| Advanced Caster Bot macro. This macro lets you specify precise thresholds for debuffing/healing/events etc. 
| Version 1.96 
| Date:6/24/2004 11:31am 
| 

#turbo 40 

#include advbot.inc 
#include advbot2.inc 
#include spellcast.inc 
#include advpath.inc 

| Uncomment these if you'd like commands to work via group and chat channels. 
|#chat group 
|#chat chat 

#chat tell 


Sub Main(INI) 
/declare a int local 
/declare b int local 
/call SetupADVars 
/call InitAPFVars 1 15 20  
/varset IniFile AD_${Me.Name} 
/if (${Defined[INI]}) { 
    /varset IniFile ${IniFile}_${INI} 
} 
/varset IniFile ${IniFile}.ini 
/call Startup 


:MainLoop 
/call AdvPathCall 

/if (!${Zone.Name.Equal["${ZoneName}"]}) { 
    /for a 1 to ${TrackNumber} 
        /varset MobList[${a}] 0 
        /for b 1 to ${DebuffCount} 
            /varset MDL[${a},${b}] 0 
            /varset MobAnnounced[${a},${b}] 0 
        /next b 
    /next a 
    /varset VarNpcCount 0      
    /varset ZoneName ${Zone.Name}    
} 

/if (${PauseDebuffs}==0 && !${Me.Moving} && ${DebuffTimer}==0) /call DebuffSub 

/if (${PauseDebuffs}==0) /call CheckNPC 

/if (${PausePet}==0 && ${PetCheckTimer}==0) /call PetCheck 

/if (${NoSit}==0 && !${Me.Moving} && ${SitCheckTimer}==0 && !${Me.Mount.ID}>0) /call SitCheck 

/doevents 

/if (${PauseDebuffs}==0 && !${Me.Moving}) /call IterateNPC 

/if (${PauseSelfBuffs}==0 && !${Me.Moving} && ${SelfBuffTimer}==0 && (${VarNpcCount}<2 || ${PauseDebuffs}==1)) /call SelfBuffCheck 

/if (${PauseGroupBuffs}==0 && !${Me.Moving} && ${GroupBuffTimer}==0 && (${VarNpcCount}<2 || ${PauseDebuffs}==1)) /call GroupBuffCheck 

/if (${PausePet}==0 && !${Me.Moving} && ${PetBuffCheckTimer}==0 && (${VarNpcCount}<2 || ${PauseDebuffs}==1)) /call PetBuffCheck 

/if (${PauseEvents}==0 && !${Me.Moving} && ${EventTimer}==0) /call EventCheck 

/if (${PauseDebuffs}==0) /call CheckNPC 

/if (${NoSit}==0 && !${Me.Moving}) /call SitCheck 

/if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck 

/doevents 

/if (${MiscCheckTimer}==0) { 
    /varset MiscCheckTimer 5s 
    /if (${Me.Invited}) /timed 20 /disband 
    /if (${Window[ConfirmationDialogBox].Open}) /notify ConfirmationDialogBox Yes_Button leftmouseup 
} 
/goto :MainLoop 
/return 

Sub AdvPathCall 
/if (${FollowFlag}==1) { 
    /if (!${Me.Mount.ID}>0 && !${Me.Standing} && ${Spawn[${FollowID}].Distance3D}>=${FollowDistance}) /stand 
    /call AdvPathPoll 
} 
/return 

Sub SitCheck 
/declare MobHeading int local 
/declare MeHeading int local 
/declare MiniIterate int local 
/declare AggroFlag int local 
/declare AggroID int local 
/varset SitCheckTimer 2s 
/if (${FollowFlag}==1 && ${Spawn[${FollowID}].Distance3D}>${FollowDistance}) /return 
    /varset MiniIterate 1 
    /varset AggroFlag 0 
    /varset AggroID 0 
    :CheckNext 
    /varset AggroID ${NearestSpawn[${MiniIterate},npc radius ${SitAggroRadiusCheck} zradius 10].ID} 
    /if (${AggroID}>0) { 
        /varset MobHeading ${Spawn[${AggroID}].Heading.Degrees} 
        /if (${Math.Abs[${Math.Calc[${Spawn[${AggroID}].HeadingTo.Degrees}+180]}]}>=359.99) { 
            /varset MeHeading ${Math.Calc[(${Spawn[${AggroID}].HeadingTo.Degrees}-180)+360]} 
        } else { 
            /varset MeHeading ${Math.Calc[(${Spawn[${AggroID}].HeadingTo.Degrees}+180)+360]} 
        } 
        /if ((${Math.Calc[${MobHeading}+360]}>${Math.Calc[${MeHeading}-15]})&&(${Math.Calc[${MobHeading}+360]}<${Math.Calc[${MeHeading}+15]})) { 
            /varset AggroFlag 1 
            /if (!${Me.Mount.ID}>0) { 
                /if (${Me.Sitting}) /stand 
            } 
            /goto :BreakOutCheckAggro 
        } 
    } else { 
        /if (${AggroFlag}==0) { 
            /if (!${Me.Mount.ID}>0) { 
                /if (${Me.Standing}) /sit on 
            } 
            /goto :BreakOutCheckAggro 
        } 
    } 
    /varset MiniIterate ${Math.Calc[${MiniIterate}+1]} 
    /goto :CheckNext 
    :BreakOutCheckAggro 
/return 


Sub IterateNPC 
/declare npcid int local 
/declare a int local 
/declare b int local 
/declare compare int local 
/declare TempNpcCount int local 
/varset npcid 0 
/varset TempNpcCount 0 
:GetSpawn 
/doevents 
/varset npcid ${NearestSpawn[${Math.Calc[${TempNpcCount}+1]},npc radius ${Radius} zradius 10 noalert ${AlertList}].ID} 
/if (!${String[${npcid}].Equal[NULL]}) { 

   /varset TempNpcCount ${Math.Calc[${TempNpcCount}+1]} 
   /if (${TempNpcCount}>${TrackNumber}) /goto :DoneSearching 
   /varset compare 0 
   /for a 1 to ${TrackNumber} 
       /if (${npcid}==${MobList[${a}]}) { 
           /varset compare 1 
           /goto :BreakOutComp 
       } 
   /next a 
   :BreakOutComp 
   /if (${compare}==0) { 
       /for a 1 to ${TrackNumber} 
           /if (${MobList[${a}]}==0) { 
               /varset VarNpcCount ${Math.Calc[${VarNpcCount}+1]} 
               /varset MobList[${a}] ${npcid} 
               /for b 1 to ${DebuffCount} 
                   /varset MDL[${a},${b}] ${Math.Calc[${DebuffStartWait[${b}]}+${Macro.RunTime}]} 
                   /varset MobAnnounced[${a},${b}] 0 
               /next b 
               /goto :GetSpawn 
           } 
       /next a 
   } 
} else { 
    /goto :DoneSearching 
} 
/goto :GetSpawn 
:DoneSearching 
/return 


Sub DebuffSub 
/call IterateNPC 
/varset DebuffTimer ${DebuffCheckTime} 
/declare a int local 
/declare b int local 
/declare c int local 
/declare MATarget int local 0 
/if (${PauseAssist}==0) { 
    /if (${TankName.Length}>0 && !${TankName.Equal[Main Assist Name]}) { 
        /if (${Spawn[pc ${TankName}].Distance}<200) { 
            /squelch /target myself 
            /delay 1s ${Target.ID}==${Me.ID} 
            /assist ${TankName} 
            /delay 1s ${Target.ID}!=${Me.ID} 
            /varset MATarget ${Target.ID} 
        } 
    } 
} 
/for a 1 to ${TrackNumber} 
    /doevents Enraged 
    /call AdvPathCall  
    /if (${PauseDebuffs}==0  && !${Me.Moving}) { 
        /if (${MobList[${a}]}!=0) { 
        /for b 1 to ${DebuffCount} 
            /doevents Enraged 
            /if (${MobList[${a}]}!=${MATarget} && ${DebuffOnMATarget[${b}]}==1 && ${PauseAssist}==0) /goto :BreakOutDebuff 
            /if (${VarNpcCount}<${DebuffMinMobsInArea[${b}]}) /goto :BreakOutDebuff 

            /call AdvPathCall  
            /squelch /target id ${MobList[${a}]} 
            /delay 1s ${Target.ID}==${MobList[${a}]} 
            /if (!${Target.Type.Equal["NPC"]}) /goto :NotNPC 
            /if (${Spawn[${MobList[${a}]}].Distance}>${Radius}) /goto :NotNPC 
            /if (((${MDL[${a},${b}]}==0)||(${MDL[${a},${b}]}<${Math.Calc[${Macro.RunTime}]}))&&(${Spawn[${MobList[${a}]}].PctHPs}<=${DebuffMinHealth[${b}]})&&(${Spawn[${MobList[${a}]}].PctHPs}>${DebuffMinHealthNoCast[${b}]})&&(!${Spawn[${MobList[${a}]}].State.Equal["DEAD"]})&&(${Me.PctMana}>${DebuffMinMana[${b}]})) { 
                /if (((!${Debuff[${b}].Find["item"]})&&(!${Debuff[${b}].Find["activate"]}))&&((!${Me.SpellReady["${Debuff[${b}]}"]})&&(${Me.Gem["${Debuff[${b}]}"]}))) { 
                    /for c 1 to 30 
                        /delay 1 
                        /if (${Me.SpellReady["${Debuff[${b}]}"]}) { 
                            /goto :ContinueDebuff 
                        } 
                    /next c 
                    /if (!${Me.SpellReady["${Debuff[${b}]}"]}) /goto :BreakOutDebuff 
                } 
                :ContinueDebuff 
                /if (!${Target.ID}>0) /goto :NotNPC 
                /echo Debuffing: -[ ${Spawn[${MobList[${a}]}].CleanName} ]- with ${Debuff[${b}]}. 
                /if (${FaceBeforeDebuff}==1) /face 
                /if (${Announce}==1) { 
                    /call Debuff ${MobList[${a}]} "${Debuff[${b}]}" "${DebuffAnnounce[${b}]}" ${a} ${b} "${DebuffMemToSlot[${b}]}" 
                } else { 
                    /call Debuff ${MobList[${a}]} "${Debuff[${b}]}" "NULL" ${a} ${b} "${DebuffMemToSlot[${b}]}" 
                } 

                /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) { 
                    /delay 5 
                    /return 
                } 
                /if (${Macro.Return.Equal["NODELAY"]}) { 
                    /if (${DebuffDuration[${b}]}==99999) { 
                        /varset MDL[${a},${b}] ${Math.Calc[99999+${Macro.RunTime}]} 
                    } else /if (${DebuffDuration[${b}]}==0) { 
                        /if (${Spell[${DebuffID[${b}]}].Duration.TotalSeconds}==0) { 
                            /varset MDL[${a},${b}] ${Math.Calc[1+${Macro.RunTime}-5]} 
                        } else { 
                            /varset MDL[${a},${b}] ${Math.Calc[${Spell[${DebuffID[${b}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]} 
                        } 
                    } else { 
                        /varset MDL[${a},${b}] ${Math.Calc[${DebuffDuration[${b}]}+${Macro.RunTime}-5]} 
                    } 
                } else { 
                    /varset MDL[${a},${b}] ${Math.Calc[15+${Macro.RunTime}]} 
                } 
                /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck 
                /if (${PausePet}==0 && ${PetCheckTimer}==0) /call PetCheck 
            } 
        :BreakOutDebuff 
        /next b 
        /if (${PauseEvents}==0 && ${EventTimer}==0 && !${Me.Moving}) /call EventCheck 
        /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck 
        } 
    } 
    :NotNPC 
    /doevents 
/next a 
/return 


Sub CheckNPC 
/declare a int local 
/declare b int local 
/for a 1 to ${TrackNumber} 
    /if (${MobList[${a}]}!=0) { 
        /if ((${Spawn[${MobList[${a}]}].State.Equal["DEAD"]})||(!${Spawn[${MobList[${a}]}].ID})||(${Spawn[${MobList[${a}]}].Distance}>${Radius})) { 
            /varset MobList[${a}] 0 
            /varset VarNpcCount ${Math.Calc[${VarNpcCount}-1]} 
            /for b 1 to ${DebuffCount} 
                /varset MDL[${a},${b}] 0 
                /varset MobAnnounced[${a},${b}] 0 
            /next b 
        } 
    } 
/next a 
/return 


Sub Debuff(mobid,debname,debannounce,a,b,memtoslot) 
/declare resistcount int local 
/declare retrytimer int local 
/declare ParseAnnounceChannels string local 
/declare TempHoldAnnounce string local 

/varset resistcount 1 
:RecastDebuff 
/if (${PauseDebuffs}==1) /return 
/if (${Me.Sitting}) /stand 
/if (${debname.Left[4].Equal["item"]}) { 
    /call Cast "${debname.Right[-5]}" "item" "${Dismount}" 
} else /if (${debname.Left[8].Equal["activate"]}) { 
    /if (!${Me.AltAbilityReady[${debname.Right[-9]}]}) /return DELAY 
    /call Cast "${debname.Right[-9]}" "activate" "${Dismount}" 
} else { 
    /call Cast "${debname}" "gem${memtoslot}" "${Dismount}" 
} 
/if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) /return CAST_LOSTTARGET 

/if (${Macro.Return.Equal["CAST_TOOK2LONG"]}) /return DELAY 

/if (${Macro.Return.Equal["CAST_RESISTED"]}) { 
    /if (${Spell["${debname}"].RecastTime}) { 
        /if (${Spell["${debname}"].RecastTime}<=10) { 
            /varset retrytimer ${Math.Calc[${Spell["${debname}"].RecastTime}+1+${Macro.RunTime}]} 
        } else { 
            /return NODELAY 
        } 
    } 
    /if (${resistcount}<${RetryCount}) { 
        /varset resistcount ${Math.Calc[${resistcount}+1]} 
        :WaitForGem 
        /call AdvPathCall  
        /delay 1 
        /if (${debname.Left[4].Equal["item"]}) { 
            /squelch /target id ${mobid} 
            /delay 1s ${Target.ID}==${mobid} 
            /goto :RecastDebuff 
        } else /if (${debname.Left[8].Equal["activate"]}) { 
            /squelch /target id ${mobid} 
            /delay 1s ${Target.ID}==${mobid} 
            /goto :RecastDebuff 
        } else { 
            /if (${retrytimer}<${Math.Calc[${Macro.RunTime}]}) { 
                /return NODELAY 
            } 
            /if (!${Me.SpellReady["${debname}"]}) { 
                /goto :WaitForGem 
            } 
        } 
        /squelch /target id ${mobid} 
        /delay 1s ${Target.ID}==${mobid} 
        /goto :RecastDebuff 
    } else { 
        /return NODELAY 
    } 
} 
/if ((${Macro.Return.Equal["CAST_CANNOTSEE"]})||(${Macro.Return.Equal["CAST_OUTOFRANGE"]})) { 
    /echo -(( Mob out of range or cannot be seen.  Waiting 15 seconds and trying again. ))- 
    /return DELAY 
} 
/if ((${Macro.Return.Equal["CAST_SUCCESS"]})&&(${Announce}==1)&&(!${debannounce.Equal["NULL"]})&&(${MobAnnounced[${a},${b}]}==0)) { 
    /if (${AnnounceChannel.Length}>0) { 
        /if (${AnnounceChannel.Find[;]}) { 
            /varset TempHoldAnnounce ${AnnounceChannel} 
            :ParseNext 
            /varset ParseAnnounceChannels ${TempHoldAnnounce.Arg[1,;]} 
            /varset TempHoldAnnounce ${TempHoldAnnounce.Right[-${TempHoldAnnounce.Find[;]}]} 
            :SendIt 
            /if (${ParseAnnounceChannels.Equal[gsay]} && ${Group}>0) { 
                /gsay ${debannounce} 
            } else /if (!${ParseAnnounceChannels.Equal[gsay]}) { 
                /docommand /${ParseAnnounceChannels} ${debannounce} 
            } 
            /if (${TempHoldAnnounce.Length}>0) { 
                /if (${TempHoldAnnounce.Find[;]}>0) { 
                    /goto :ParseNext 
                } else { 
                    /varset ParseAnnounceChannels ${TempHoldAnnounce} 
                    /varset TempHoldAnnounce 
                    /goto :SendIt 
                } 
            } 
        } else { 
            /if (${AnnounceChannel.Equal[gsay]} && ${Group}>0) { 
                /gsay ${debannounce} 
            } else /if (!${AnnounceChannel.Equal[gsay]}) { 
                /docommand /${AnnounceChannel} ${debannounce} 
            } 
        } 
    } 
    /varset MobAnnounced[${a},${b}] 1 
} 
/return NODELAY 


Sub SelfBuffCheck 
/varset SelfBuffTimer ${SelfBuffCheckTime} 
/declare a int local 
/declare f int local 
/declare RetryBuffCount int local 
/if (${SelfBuffCount}>0) { 
    /for a 1 to ${SelfBuffCount} 
        /if (${PauseSelfBuffs}==1 || ${Me.Moving}) /return 
        /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck 
        /varset RetryBuffCount 0        
        /call AdvPathCall  
        /if ((${SelfBuffedList[${a}]}<${Math.Calc[${Macro.RunTime}]})||((${SelfBuffIconCheck[${a}]}==1)&&(!${Me.Buff["${SelfBuffIconName[${a}]}"].Duration})&&(${SelfBuffedList[${a}]}!=99999))) { 
            :RetryBuff 
            /if (${PauseSelfBuffs}==1) /return 

            /if ((!${SelfBuff[${a}].Find["item"]}>0)&&(!${SelfBuff[${a}].Find["activate"]}>0)) { 
                /if (${Me.Gem[${SelfBuff[${a}]}]}) { 
                    /for f 1 to 30 
                        /delay 1 
                        /if (${Me.SpellReady["${SelfBuff[${a}]}"]}) { 
                            /goto :ContinueSelfBuff 
                        } 
                    /next f 
                    /if (!${Me.SpellReady["${SelfBuff[${a}]}"]}) /goto :BreakOutSelf 
                } 
            } 
            :ContinueSelfBuff 
            /if ((${Me.Gem[${SelfBuff[${a}]}]})||(${SelfBuff[${a}].Find["item"]})||(${SelfBuff[${a}].Find["activate"]})||(${SelfBuffMemToSlot[${a}]}>0)) { 
                /if (${Me.Sitting}) /stand 
                /squelch /target myself 
                /delay 1s ${Target.ID}==${Me.ID} 
                /if (${SelfBuff[${a}].Left[4].Equal["item"]}) { 
                    /echo -[ Casting Self Buff : ${SelfBuff[${a}]} ]- 
                    /call Cast "${SelfBuff[${a}].Right[-5]}" "item" "${Dismount}" 
                } else /if (${SelfBuff[${a}].Left[8].Equal["activate"]}) { 
                    /if (!${Me.AltAbilityReady[${SelfBuff[${a}].Right[-9]}]}) /goto :BreakOutSelf 
                    /echo -[ Casting Self Buff : ${SelfBuff[${a}]} ]- 
                    /call Cast "${SelfBuff[${a}].Right[-9]}" "activate" "${Dismount}" 
                } else { 
                    /echo -[ Casting Self Buff : ${SelfBuff[${a}]} ]- 
                    /call Cast "${SelfBuff[${a}]}" "gem${SelfBuffMemToSlot[${a}]}" "${Dismount}" 
                } 
                /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) { 
                    /delay 5 
                    /varset SelfBuffTimer 0 
                    /return 
                } 
                /if (${Macro.Return.Equal["CAST_TOOK2LONG"]}) { 
                    /varset SelfBuffedList[${a}] ${Math.Calc[15+${Macro.RunTime}]} 
                    /goto :BreakOutSelf 
                } 
                /if (${SelfBuffDuration[${a}]}==99999) { 
                    /varset SelfBuffedList[${a}] ${Math.Calc[99999+${Macro.RunTime}]} 
                } else /if (${SelfBuffDuration[${a}]}==0) { 

                    /if (${Spell[${SelfBuffID[${a}]}].Duration.TotalSeconds}==0) { 
                        /varset SelfBuffedList[${a}] ${Math.Calc[1+${Macro.RunTime}-5]} 
                    } else { 
                        /varset SelfBuffedList[${a}] ${Math.Calc[${Spell[${SelfBuffID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]} 
                    } 
                } else { 
                    /varset SelfBuffedList[${a}] ${Math.Calc[${SelfBuffDuration[${a}]}+${Macro.RunTime}-5]} 
                } 
            } else { 
                /if (${RetryBuffCount}==0) { 
                    /if (!${Me.SpellReady["${SelfBuff[${a}]}"]}) { 
                        /call Delay 3s 
                        /varset RetryBuffCount ${Math.Calc[${RetryBuffCount}+1]} 
                        /goto :RetryBuff 
                    } 
                } 
                /echo -(( Self Buff:${SelfBuff[${a}]} not memmed or not ready. ))- 
                /echo -(( Waiting 60 seconds before retrying buff. ))- 
                /varset SelfBuffedList[${a}] ${Math.Calc[60+${Macro.RunTime}]} 
            } 
        } 
    :BreakOutSelf 
    /next a 
} 
/return 


Sub PetCheck 
/varset PetCheckTimer ${PetCheckTime} 
/declare PetTarget int local 0 
/if (${PauseAssist}==0) { 
    /if (${Me.Pet.ID}>0 && !${TankName.Equal[Main Assist Name]} && ${TankName.Length}>0) { 
        /if (${Spawn["${TankName}"].Distance}<150) { 
            /squelch /target id ${Me.Pet.ID} 
            /delay 1s ${Target.ID}==${Me.Pet.ID} 
            /assist 
            /delay 1s ${Target.ID}!=${Me.Pet.ID} 
            /if ((${Target.ID}>0) && (${Target.ID}!=${Me.Pet.ID}) && (!${Target.Type.Equal[CORPSE]})) { 
                /varset PetTarget ${Target.ID} 
            } else { 
                /varset PetTarget 0 
            } 
            /assist ${TankName} 
            /delay 7 
            /if (${Target.ID}>0 && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}<=${PetAssistOnHPPct}) { 
                /if (${PetTarget}==0) { 
                    /pet attack 
                } else /if (${PetTarget}!=${Target.ID}) { 
                    /pet back off 
                    /delay 2 
                    /pet attack 
                } 
            } 
        } 
    } 
} 
/return 


Sub PetBuffCheck 
/declare a int local 
/declare f int local 
/declare RetryPetBuffCount int local 
/varset PetBuffCheckTimer ${PetBuffCheckTime} 
/if (${Me.Pet.ID}>0 && ${PetBuffCount}>0) { 
    /for a 1 to ${PetBuffCount} 
        /varset RetryPetBuffCount 0 
        /if (!${Me.PetBuff["${PetBuffIconName[${a}]}"]}>0 && ${Me.Pet.Distance}<100) { 
            /if (${PausePet}==1) /return 

            :RetryPetBuff 
            /if ((!${PetBuff[${a}].Find["item"]}>0)&&(!${PetBuff[${a}].Find["activate"]}>0)) { 
                /if (${Me.Gem[${PetBuff[${a}]}]}) { 
                    /for f 1 to 30 
                        /delay 1 
                        /if (${Me.SpellReady["${PetBuff[${a}]}"]}) { 
                            /goto :ContinuePetBuff 
                        } 
                    /next f 
                    /if (!${Me.SpellReady["${PetBuff[${a}]}"]}) /goto :BreakOutPetBuff 
                } 
            } 
            :ContinuePetBuff 
            /if ((${Me.Gem[${PetBuff[${a}]}]})||(${PetBuff[${a}].Find["item"]})||(${PetBuff[${a}].Find["activate"]})||(${PetBuffMemToSlot[${a}]}>0)) { 
                /if (${Me.Sitting}) /stand 
                /squelch /target id ${Me.Pet.ID} 
                /delay 1s ${Target.ID}==${Me.Pet.ID} 
                /if (${PetBuff[${a}].Left[4].Equal["item"]}) { 
                    /echo -[ Casting Pet Buff : ${PetBuff[${a}]} ]- 
                    /call Cast "${PetBuff[${a}].Right[-5]}" "item" "${Dismount}" 
                } else /if (${PetBuff[${a}].Left[8].Equal["activate"]}) { 
                    /if (!${Me.AltAbilityReady[${PetBuff[${a}].Right[-9]}]}) /goto :BreakOutPetBuff 
                    /echo -[ Casting Pet Buff : ${PetBuff[${a}]} ]- 
                    /call Cast "${PetBuff[${a}].Right[-9]}" "activate" "${Dismount}" 
                } else { 
                    /echo -[ Casting Pet Buff : ${PetBuff[${a}]} ]- 
                    /call Cast "${PetBuff[${a}]}" "gem${PetBuffMemToSlot[${a}]}" "${Dismount}" 
                } 
            } else { 
                /if (${RetryPetBuffCount}==0) { 
                    /if (!${Me.SpellReady["${PetBuff[${a}]}"]}) { 
                        /call Delay 3s 
                        /varset RetryPetBuffCount ${Math.Calc[${RetryPetBuffCount}+1]} 
                        /goto :RetryPetBuff 
                    } 
                } 
            } 


        } 
    :BreakOutPetBuff 
    /next a 
} 
/return 


Sub EventCheck 
/varset EventTimer ${EventCheckTime} 
/declare a int local 
/declare c int local 
/declare RetryEventCount int local 
/if (${EventCount}>0) { 
    /for a 1 to ${EventCount} 
        /call AdvPathCall  
        /if (${PauseEvents}==1 || ${Me.Moving}) /return 
        /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck 
        /varset RetryEventCount 0 
        /if ((${Me.PctMana}<=${EventMinMana[${a}]})&&(${Me.PctMana}>=${EventMaxMana[${a}]})&&(${Me.PctHPs}<=${EventMinHP[${a}]})&&(${Me.PctHPs}>=${EventMaxHP[${a}]})) { 
            /if (${EventList[${a}]}<${Math.Calc[${Macro.RunTime}]}) { 
                :RetryEvent 
                /if (${PauseEvents}==1) /return 

                /if ((!${EventSpell[${a}].Find["item"]}>0)&&(!${EventSpell[${a}].Find["activate"]}>0)) { 
                    /if (${Me.Gem[${EventSpell[${a}]}]}) { 
                        /for c 1 to 30 
                            /delay 1 
                            /if (${Me.SpellReady["${EventSpell[${a}]}"]}) { 
                                /goto :ContinueEvent 
                            } 
                        /next c 
                        /if (!${Me.SpellReady["${EventSpell[${a}]}"]}) /goto :BreakOutEvent 
                    } 
                } 
                :ContinueEvent 
                /if ((${Me.Gem[${EventSpell[${a}]}]})||(${EventSpell[${a}].Find["item"]})||(${EventSpell[${a}].Find["activate"]})||(${EventMemToSlot[${a}]}>0)) { 
                    /if (${Me.Sitting}) /stand 
                    /squelch /target myself 
                    /delay 1s ${Target.ID}==${Me.ID} 
                    /if (${EventSpell[${a}].Left[4].Equal["item"]}) { 
                        /echo -[ Casting Event Spell : ${EventSpell[${a}]} ]- 
                        /call Cast "${EventSpell[${a}].Right[-5]}" "item" "${Dismount}" 
                    } else /if (${EventSpell[${a}].Left[8].Equal["activate"]}) { 
                        /if (!${Me.AltAbilityReady[${EventSpell[${a}].Right[-9]}]}) /goto :BreakOutEvent 
                        /echo -[ Casting Event Spell : ${EventSpell[${a}]} ]- 
                        /call Cast "${EventSpell[${a}].Right[-9]}" "activate" "${Dismount}" 
                    } else { 
                        /echo -[ Casting Event Spell : ${EventSpell[${a}]} ]- 
                        /call Cast "${EventSpell[${a}]}" "gem${EventMemToSlot[${a}]}" "${Dismount}" 
                    } 
                    /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) { 
                        /delay 5 
                        /varset EventTimer 0 
                        /return 
                    } 
                    /if (${Macro.Return.Equal["CAST_TOOK2LONG"]}) { 
                        /varset EventList[${a}] ${Math.Calc[15+${Macro.RunTime}]} 
                        /goto :BreakOutEvent 
                    } 

                    /if (${EventDuration[${a}]}==99999) { 
                        /varset EventList[${a}] ${Math.Calc[99999+${Macro.RunTime}]} 
                    } else /if (${EventDuration[${a}]}==0) { 
                        /if (${Spell[${EventSpellID[${a}]}].Duration.TotalSeconds}==0) { 
                            /varset EventList[${a}] ${Math.Calc[1+${Macro.RunTime}-5]} 
                        } else { 
                            /varset EventList[${a}] ${Math.Calc[${Spell[${EventSpellID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]} 
                        } 
                    } else { 
                        /varset EventList[${a}] ${Math.Calc[${EventDuration[${a}]}+${Macro.RunTime}-5]} 
                    } 

                } else { 
                    /if (${RetryEventCount}==0) { 
                        /if (!${Me.SpellReady["${EventSpell[${a}]}"]}) { 
                            /call Delay 3s 
                            /varset RetryEventCount ${Math.Calc[${RetryEventCount}+1]} 
                            /goto :RetryEvent 
                        } 
                    } 
                    /echo -(( Event Spell:${EventSpell[${a}]} not memmed or not ready. ))- 
                    /echo -(( Waiting 60 seconds before retrying event. ))- 
                    /varset EventList[${a}] ${Math.Calc[60+${Macro.RunTime}]} 
                } 
            } 
        } 
    :BreakOutEvent 
    /next a 
} 
/return 


Sub GroupBuffCheck 
/varset GroupBuffTimer ${GroupBuffCheckTime} 
/declare a int local 
/declare b int local 
/declare c int local 
/declare f int local 
/declare RetryBuffCount int local 
/declare ParseAnnounceChannels string local 
/declare TempHoldAnnounce string local 
/if (${GroupBuffCount}>0) { 
    /for a 1 to ${GroupBuffCount} 
        /if (${PauseGroupBuffs}==1 || ${Me.Moving}) /return 
        /if (${PauseHeals}==0 && ${HealTimer}==0) /call HealCheck 
        /call AdvPathCall 
        /for b 0 to ${Group} 
            /call AdvPathCall 
            /varset RetryBuffCount 0        
            /if (${Me.PctMana}>=${GroupBuffMinMana[${a}]}) { 

                /if (${GBL[${a},${Math.Calc[${b}+1]}]}<${Math.Calc[${Macro.RunTime}]}) { 

                /if (${Math.Calc[${Group}+1]}<${GroupBuffMinGroupCount[${a}]}) /goto :BreakOutBuff 

                /if (((${Spell[${GroupBuffID[${a}]}].TargetType.Find["Group"]})&&(${b}!=0))||((${GroupBuffMinGroupCount[${a}]}>0)&&(${b}!=0))) /goto :BreakOutBuff 

                /if ((${b}>0)&&(!${GroupBuffClass[${a}].Find["${Group[${b}].Class.ShortName}"]})) /goto :BreakOutMember 

                /if ((${b}==0)&&(!${GroupBuffClass[${a}].Find["${Me.Class.ShortName}"]})&&((!${Spell[${GroupBuffID[${a}]}].TargetType.Find["Group"]})||(${GroupBuffMinGroupCount[${a}]}==0))) /goto :BreakOutMember 

                    :RetryBuff 
                    /if (${PauseGroupBuffs}==1 || ${Me.Moving}) /return 
                    /if ((${Me.Gem[${GroupBuff[${a}]}]})||(${GroupBuff[${a}].Find["item"]})||(${GroupBuff[${a}].Find["activate"]})||(${GroupBuffMemToSlot[${a}]}>0)) { 

                        /if ((${GroupBuff[${a}].Find["activate"]})&&(!${Me.AltAbilityReady[${GroupBuff[${a}].Right[-9]}]})) /goto :BreakOutBuff 

                        /if ((!${GroupBuff[${a}].Find["item"]}>0)&&(!${GroupBuff[${a}].Find["activate"]}>0)) { 
                            /if (${Me.Gem[${GroupBuff[${a}]}]}) { 
                                /for f 1 to 30 
                                    /delay 1 
                                    /if (${Me.SpellReady["${GroupBuff[${a}]}"]}) { 
                                        /goto :ContinueGroupBuff 
                                    } 
                                /next f 
                                /if (!${Me.SpellReady["${GroupBuff[${a}]}"]}) /goto :BreakOutBuff 
                           } 
                        } 
                        :ContinueGroupBuff 
                        /if (${Spell[${GroupBuffID[${a}]}].TargetType.Find["Group"]} || ${b}==0) {                        
                            /squelch /target myself 
                            /delay 1s ${Target.ID}==${Me.ID} 
                        } else { 
                            /squelch /target id ${Group[${b}].ID} 
                            /delay 1s ${Target.ID}==${Group[${b}].ID} 
                        } 
                        /if (!${Target.CleanName.Equal[${Group[${b}]}]}) { 
                            /echo -(( Target not in zone.  Waiting 30 seconds and trying again. ))- 
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[30+${Macro.RunTime}]} 
                            /goto :BreakOutMember 
                        } 
                        /if (!${GroupBuff[${a}].Find[Item]} && !${GroupBuff[${a}].Find[Activate]} && ${Target.Distance3D}>${Spell[${GroupBuffID[${a}]}].Range}) /goto :BreakOutMember 
                        /if ((${Announce}==1)&&(!${GroupBuffAnnounce[${a}].Equal["NULL"]})) { 
                            /if (${AnnounceChannel.Length}>0) { 
                                /if (${AnnounceChannel.Find[;]}) { 
                                    /varset TempHoldAnnounce ${AnnounceChannel} 
                                    :ParseNext 
                                    /varset ParseAnnounceChannels ${TempHoldAnnounce.Arg[1,;]} 
                                    /varset TempHoldAnnounce ${TempHoldAnnounce.Right[-${TempHoldAnnounce.Find[;]}]} 
                                    :SendIt 
                                    /if (${ParseAnnounceChannels.Equal[gsay]} && ${Group}>0) { 
                                        /gsay ${GroupBuffAnnounce[${a}]} 
                                    } else /if (!${ParseAnnounceChannels.Equal[gsay]}) { 
                                        /docommand /${ParseAnnounceChannels} ${GroupBuffAnnounce[${a}]} 
                                    } 
                                    /if (${TempHoldAnnounce.Length}>0) { 
                                        /if (${TempHoldAnnounce.Find[;]}>0) { 
                                            /goto :ParseNext 
                                        } else { 
                                            /varset ParseAnnounceChannels ${TempHoldAnnounce} 
                                            /varset TempHoldAnnounce 
                                            /goto :SendIt 
                                        } 
                                   } 
                               } else { 
                                   /if (${AnnounceChannel.Equal[gsay]} && ${Group}>0) { 
                                       /gsay ${GroupBuffAnnounce[${a}]} 
                                   } else /if (!${AnnounceChannel.Equal[gsay]}) { 
                                       /docommand /${AnnounceChannel} ${GroupBuffAnnounce[${a}]} 
                                   } 
                               } 
                            } 
                        } 
                        /if (${Me.Sitting}) /stand 
                        /if (${GroupBuff[${a}].Left[4].Equal["item"]}) { 
                            /echo -[ Casting Group Buff : ${GroupBuff[${a}]} ]- 
                            /call Cast "${GroupBuff[${a}].Right[-5]}" "item" "${Dismount}" 
                        } else /if (${GroupBuff[${a}].Left[8].Equal["activate"]}) { 
                            /echo -[ Casting Group Buff : ${GroupBuff[${a}]} ]- 
                            /call Cast "${GroupBuff[${a}].Right[-9]}" "activate" "${Dismount}" 
                        } else { 
                            /echo -[ Casting Group Buff : ${GroupBuff[${a}]} ]- 
                            /call Cast "${GroupBuff[${a}]}" "gem${GroupBuffMemToSlot[${a}]}" "${Dismount}" 
                        } 
                        /if (${Macro.Return.Equal["CAST_TOOK2LONG"]}) { 
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[15+${Macro.RunTime}]} 
                            /goto :BreakOutBuff 
                        } 
                        /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) { 
                            /delay 5 
                            /varset GroupBuffTimer 0 
                            /return 
                        } 
                        /if ((${Macro.Return.Equal["CAST_CANNOTSEE"]})||(${Macro.Return.Equal["CAST_OUTOFRANGE"]})) { 
                            /echo -(( Out of range or cannot be seen.  Waiting 20 seconds and trying again. ))- 
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[20+${Macro.RunTime}]} 
                            /goto :BreakOutMember 
                        } 
                        /if (${GroupBuffDuration[${a}]}==99999) { 
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[99999+${Macro.RunTime}]} 
                        } else /if (${GroupBuffDuration[${a}]}==0) { 

                            /if (${Spell[${GroupBuffID[${a}]}].Duration.TotalSeconds}==0) { 
                                /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[1+${Macro.RunTime}-5]} 
                            } else { 
                                /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[${Spell[${GroupBuffID[${a}]}].Duration.TotalSeconds}+${Macro.RunTime}-5]} 
                            } 
                        } else { 
                            /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[${GroupBuffDuration[${a}]}+${Macro.RunTime}-5]}  
                        } 
                    } else { 
                        /if (${RetryBuffCount}==0) { 
                            /if (!${Me.SpellReady["${GroupBuff[${a}]}"]}) { 
                                /call Delay 3s 
                                /varset RetryBuffCount ${Math.Calc[${RetryBuffCount}+1]} 
                                /goto :RetryBuff 
                            } 
                        } 
                        /echo -(( Group Buff:${GroupBuff[${a}]} not memmed or not ready. ))- 
                        /echo -(( Waiting 60 seconds before retrying buff. ))- 
                        /varset GBL[${a},${Math.Calc[${b}+1]}] ${Math.Calc[60+${Macro.RunTime}]} 
                    } 
                } 
            } 
        :BreakOutMember 
        /next b 
    :BreakOutBuff 
    /next a 
} 
/return 


Sub HealCheck 
/varset HealTimer ${HealCheckTime} 
/declare a int local 
/declare b int local 
/declare c int local 
/declare d int local 
/declare e int local 
/declare f int local 
/declare RetryHealCount int local 
/declare GroupHPTotal int local 
/declare GroupHealFlag int local 
/declare TempIndex int local 
/declare TempGroupCount int local 
/declare ParseAnnounceChannels string local 
/declare TempHoldAnnounce string local 
/declare PetHealFlag int local 0 
/declare TempGrpCt int local 0 
/declare TempClass string local Nothing 
/declare TempHealth int local 0 
/declare TempTargetType string local 
/varset TempGroupCount ${Group} 

/if (${HealCount}>0) { 
    /for a 1 to ${HealCount} 
        /doevents Enraged 
        /call AdvPathCall 
        /if (${PauseHeals}==1) /return 
        /if (${Group}!=${TempGroupCount}) /return 
        /varset GroupHealFlag 0 
        /if (${Me.PctMana}>=${HealMinMana[${a}]}) { 
            /varset GroupHPTotal 0 
            /for b 0 to ${Math.Calc[${Group}+${WatchListCount}]} 
                /varset PetHealFlag 0 
                /call AdvPathCall 
                /if (${b}>${Group}) { 
                    /varset d ${Math.Calc[${b}-${Group}]} 
                    /if (!${WatchList[${d}].Equal[Empty]}) { 
                         /for e 0 to 5 
                             /if (${WatchList[${d}].Equal[${Group[${e}]}]}) { 
                                 /goto :BreakOutHoT 
                             } 
                         /next e 
                    } 
                } 
                /if (${Group}!=${TempGroupCount}) /return 
                /varset TempIndex ${Math.Calc[${b}-${Group}]} 
                /if (${b}>${Group}) { 
                    /if (!${WatchList[${TempIndex}].Equal[Empty]}) { 
                        /if (${Spawn[${WatchList[${TempIndex}]}].ID}) { 
                            /if (${Spawn[${WatchList[${TempIndex}]}].Distance}<250) { 
                                /if (${Math.Calc[${Macro.RunTime}]}>${WatchTimer[${TempIndex}]}) { 
                                    /if (${Target.ID}!=${Spawn[${WatchList[${TempIndex}]}].ID}) { 
                                        /squelch /target id ${Spawn[${WatchList[${TempIndex}]}].ID} 
                                        /delay 1s ${Target.ID}==${Spawn[${WatchList[${TempIndex}]}].ID} 
                                    } 
                                    /if (${Spawn[${WatchList[${TempIndex}]}].Pet.ID}>0 && ${HealPets}==1) { 
                                        /squelch /target id ${Spawn[${WatchList[${TempIndex}]}].Pet.ID} 
                                        /delay 1s ${Target.ID}==${Spawn[${WatchList[${TempIndex}]}].Pet.ID} 
                                    } 
                                    /varset WatchTimer[${Math.Calc[${TempIndex}]}+1]}] ${Math.Calc[${Macro.RunTime}+2]} 
                                } 
                            } 
                        } 
                    } 
                } 
                /varset RetryHealCount 0 
                /if (${Math.Calc[${Group}+1]}<${HealMinGroupCount[${a}]}) /goto :BreakOutHeal 

                /varset TempTargetType ${Spell[${HealSpellID[${a}]}].TargetType} 
                /if ((${TempTargetType.Find["Group"]})||(${HealMinGroupCount[${a}]}>0)) { 
                    /if (${b}<=${Group}) { 
                        /if (${Group[${b}].ID}>0) /varset GroupHPTotal ${Math.Calc[${GroupHPTotal}+${Group[${b}].PctHPs}]} 
                        /goto :BreakOutHoT 
                    } else { 
                        /goto :BreakOutHoT 
                    } 
                } 

                /if (${b}<=${Group}) { 
                    /varset TempClass ${Group[${b}].Class.ShortName} 
                    /varset TempHealth ${Group[${b}].PctHPs} 
                    /if (${String["WIZ|MAG|ENC|NEC"].Find["${TempClass}"]}>0) { 
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${Math.Calc[${HealMaxHP[${a}]}+${WussyFactor}]}) /goto :ContinueHeal 
                    } else /if (${String["SHM|CLR|DRU"].Find["${TempClass}"]}>0) { 
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${Math.Calc[${HealMaxHP[${a}]}+(${WussyFactor}/2)]}) /goto :ContinueHeal 
                    } else { 
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${HealMaxHP[${a}]}) /goto :ContinueHeal 
                    } 
                    /if (${HealPets}==1) { 
                        /varset TempHealth ${Group[${b}].Pet.PctHPs} 
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${HealMaxHP[${a}]}) { 
                            /varset PetHealFlag 1 
                            /goto :ContinueHealPet 
                        } 
                    } 
                } else { 
                    /varset TempClass ${Spawn[${WatchList[${TempIndex}]}].Class.ShortName} 
                    /varset TempHealth ${Spawn[${WatchList[${TempIndex}]}].PctHPs} 
                    /if (${String["WIZ|MAG|ENC|NEC"].Find["${TempClass}"]}>0) { 
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${Math.Calc[${HealMaxHP[${a}]}+${WussyFactor}]}) /goto :ContinueHeal 
                    } else /if (${String["SHM|CLR|DRU"].Find["${TempClass}"]}>0) { 
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${Math.Calc[${HealMaxHP[${a}]}+(${WussyFactor}/2)]}) /goto :ContinueHeal 
                    } else { 
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${HealMaxHP[${a}]}) /goto :ContinueHeal 
                    } 
                    /if (${HealPets}==1) { 
                        /varset TempHealth ${Spawn[${WatchList[${TempIndex}]}].Pet.PctHPs} 
                        /if (${TempHealth}>${HealMinHP[${a}]} && ${TempHealth}<${HealMaxHP[${a}]}) { 
                            /varset PetHealFlag 1 
                            /goto :ContinueHealPet 
                        } 
                    } 
                } 

                    /goto :BreakOutHoT 

                    :ContinueHeal 
                    /call AdvPathCall 
                    /if (!${HealClass[${a}].Find["${TempClass}"]}>0) /goto :BreakOutHoT 

                    :ContinueHealPet 
                    /if (${PetHealFlag}==0 && ${Math.Calc[${Macro.RunTime}]}<${HoTList[${Math.Calc[${b}+1]},1]} && ${TempTargetType.Find["Single"]}) /goto :BreakOutHoT 
                    /if (${PetHealFlag}==1 && ${Math.Calc[${Macro.RunTime}]}<${HoTList[${Math.Calc[${b}+1]},2]} && ${TempTargetType.Find["Single"]}) /goto :BreakOutHoT 
        
                    :RetryHeal 
                    /if (${PauseHeals}==1) /return 
                    /if (${Me.Gem[${HealSpell[${a}]}]} || ${HealSpell[${a}].Find["item"]} || ${HealSpell[${a}].Find["activate"]} || ${HealMemToSlot[${a}]}>0) { 

                        /if (${HealSpell[${a}].Find["activate"]} && !${Me.AltAbilityReady[${HealSpell[${a}].Right[-9]}]}) /goto :BreakOutHeal 

                        /if (!${HealSpell[${a}].Find["item"]}>0 && !${HealSpell[${a}].Find["activate"]}>0) { 
                            /if (${Me.Gem[${HealSpell[${a}]}]}) { 
                                /for f 1 to 30 
                                    /delay 1 
                                    /if (${Me.SpellReady["${HealSpell[${a}]}"]}) { 
                                        /goto :ContinueHeal2 
                                    } 
                                /next f 
                                /if (!${Me.SpellReady["${HealSpell[${a}]}"]}) /goto :BreakOutHeal 
                           } 
                        } 
                        :ContinueHeal2 

                        /if (${b}<=${Group} && !${Group[${b}].ID}>0) /goto :BreakOutHoT 
                        /if (${b}>${Group} && !${Spawn[${WatchList[${TempIndex}]}].ID}>0) /goto :BreakOutHoT 

                        /if ((${TempTargetType.Find["Group"]} || ${b}==0) && ${PetHealFlag}==0) {                        
                            /squelch /target myself 
                            /delay 1s ${Target.ID}==${Me.ID} 
                        } else /if (${b}<=${Group} && ${PetHealFlag}==0) { 
                            /squelch /target id ${Group[${b}].ID} 
                            /delay 1s ${Target.ID}==${Group[${b}].ID} 
                        } else /if (${PetHealFlag}==1) { 
                            /if (${b}<=${Group}) { 
                                /squelch /target id ${Group[${b}].Pet.ID} 
                                /delay 1s ${Target.ID}==${Group[${b}].Pet.ID} 
                            } else { 
                                /squelch /target id ${Spawn[${WatchList[${TempIndex}]}].Pet.ID} 
                                /delay 1s ${Target.ID}==${Spawn[${WatchList[${TempIndex}]}].Pet.ID} 
                            } 
                        } else { 
                            /squelch /target id ${Spawn[${WatchList[${TempIndex}]}].ID} 
                            /delay 1s ${Target.ID}==${Spawn[${WatchList[${TempIndex}]}].ID} 
                        } 

                        /if (${Target.CleanName.Equal[${Group[${b}]}]}) /goto :TargetInZone 
                        /if (${Target.CleanName.Equal[${WatchList[${TempIndex}]}]}) /goto :TargetInZone 
                        /if (${Target.CleanName.Equal[${Group[${b}].Pet.CleanName}]}) /goto :TargetInZone 
                        /if (${Target.CleanName.Equal[${Spawn[${WatchList[${TempIndex}]}].Pet.CleanName}]}) /goto :TargetInZone 

                        /echo -(( Target not in zone.  Waiting 10 seconds and trying again. ))- 
                        /if (${PetHealFlag}==0) /varset HoTList[${Math.Calc[${b}+1]},1] ${Math.Calc[10+${Macro.RunTime}]} 
                        /if (${PetHealFlag}==1) /varset HoTList[${Math.Calc[${b}+1]},2] ${Math.Calc[10+${Macro.RunTime}]} 
                        /goto :BreakOutHoT 

                        :TargetInZone 
                        /if (!${HealSpell[${a}].Find[Item]} && !${HealSpell[${a}].Find[Activate]} && ${Target.Distance3D}>${Spell[${HealSpellID[${a}]}].Range}) /goto :BreakOutHoT 
                        /if (${Announce}==1 && !${HealAnnounce[${a}].Equal["NULL"]}) { 
                            /if (${AnnounceChannel.Length}>0) { 
                                /if (${AnnounceChannel.Find[;]}) { 
                                    /varset TempHoldAnnounce ${AnnounceChannel} 
                                    :ParseNext 
                                    /varset ParseAnnounceChannels ${TempHoldAnnounce.Arg[1,;]} 
                                    /varset TempHoldAnnounce ${TempHoldAnnounce.Right[-${TempHoldAnnounce.Find[;]}]} 
                                    :SendIt 
                                    /if (${ParseAnnounceChannels.Equal[gsay]} && ${Group}>0) { 
                                        /gsay ${HealAnnounce[${a}]} 
                                    } else /if (!${ParseAnnounceChannels.Equal[gsay]}) { 
                                        /docommand /${ParseAnnounceChannels} ${HealAnnounce[${a}]} 
                                    } 
                                    /if (${TempHoldAnnounce.Length}>0) { 
                                        /if (${TempHoldAnnounce.Find[;]}>0) { 
                                            /goto :ParseNext 
                                        } else { 
                                            /varset ParseAnnounceChannels ${TempHoldAnnounce} 
                                            /varset TempHoldAnnounce 
                                            /goto :SendIt 
                                        } 
                                   } 
                               } else { 
                                   /if (${AnnounceChannel.Equal[gsay]} && ${Group}>0) { 
                                       /gsay ${HealAnnounce[${a}]} 
                                   } else /if (!${AnnounceChannel.Equal[gsay]}) { 
                                       /docommand /${AnnounceChannel} ${HealAnnounce[${a}]} 
                                   } 
                               } 
                            } 
                        } 
                        /if (${Me.Sitting}) /stand 
                        /if (${HealSpell[${a}].Left[4].Equal["item"]}) { 
                            /echo -[ Casting Heal Spell : ${HealSpell[${a}]} ]- 
                            /call Cast "${HealSpell[${a}].Right[-5]}" "item" "${Dismount}" 
                        } else /if (${HealSpell[${a}].Left[8].Equal["activate"]}) { 
                            /echo -[ Casting Heal Spell : ${HealSpell[${a}]} ]- 
                            /call Cast "${HealSpell[${a}].Right[-9]}" "activate" "${Dismount}" 
                        } else { 
                            /echo -[ Casting Heal Spell : ${HealSpell[${a}]} ]- 
                            /call Cast "${HealSpell[${a}]}" "gem${HealMemToSlot[${a}]}" "${Dismount}" 
                        } 

                        /if (${Macro.Return.Equal["CAST_LOSTTARGET"]}) { 
                            /delay 5 
                            /varset HealTimer 0 
                            /return 
                        } 
                        /if (${Macro.Return.Equal["CAST_CANNOTSEE"]} || ${Macro.Return.Equal["CAST_OUTOFRANGE"]}) { 
                            /echo -(( Out of range or cannot be seen.  Waiting 10 seconds and trying again. ))- 
                            /if (${PetHealFlag}==0) /varset HoTList[${Math.Calc[${b}+1]},1] ${Math.Calc[10+${Macro.RunTime}]} 
                            /if (${PetHealFlag}==1) /varset HoTList[${Math.Calc[${b}+1]},2] ${Math.Calc[10+${Macro.RunTime}]} 
                            /goto :BreakOutHoT 
                        } 
                        /if (${GroupHealFlag}==1) { 
                            /delay 15 
                            /varset GroupHealFlag 0 
                        } 
                        /if (${Spell[${HealSpellID[${a}]}].Duration}>0 && ${Macro.Return.Equal["CAST_SUCCESS"]}) { 
                            /if (${PetHealFlag}==0) /varset HoTList[${Math.Calc[${b}+1]},1] ${Math.Calc[${Spell[${HealSpellID[${a}]}].Duration.Seconds}+${Macro.RunTime}]} 
                            /if (${PetHealFlag}==1) /varset HoTList[${Math.Calc[${b}+1]},2] ${Math.Calc[${Spell[${HealSpellID[${a}]}].Duration.Seconds}+${Macro.RunTime}]} 
                            /if (${Spell[${HealSpellID[${a}]}].Duration}>0 && ${Macro.Return.Equal["CAST_SUCCESS"]} && (${TempTargetType.Find["Group"]} || ${HealMinGroupCount[${a}]}>0)) { 
                                /for c 0 to ${Group} 
                                    /varset HoTList[${Math.Calc[${c}+1]},1] ${Math.Calc[${Spell[${HealSpellID[${a}]}].Duration.Seconds}+${Macro.RunTime}]} 
                                /next c 
                                /varset GroupHPTotal ${Math.Calc[100*${Math.Calc[${Group}+1]}]} 
                                /goto :BreakOutHeal 
                            } 
                        } 
                        /varset GroupHPTotal ${Math.Calc[100*${Math.Calc[${Group}+1]}]} 
                    } else { 
                        /if (${RetryHealCount}==0) { 
                            /if (!${Me.SpellReady["${HealSpell[${a}]}"]}) { 
                                /call Delay 3s 
                                /varset RetryHealCount ${Math.Calc[${RetryHealCount}+1]} 
                                /goto :RetryHeal 
                            } 
                        } 
                        /echo -(( Heal Spell:${HealSpell[${a}]} not memmed or not ready. ))- 
                        /goto :BreakOutHeal 
                    } 
            :BreakOutHoT 
            /next b 
            /if (${TempTargetType.Find["Group"]} || ${HealMinGroupCount[${a}]}>0) { 
                /varset TempGrpCt 0 
                /for c 0 to ${Group} 
                    /if (${Group[${c}].ID}>0) /varset TempGrpCt ${Math.Calc[${TempGrpCt}+1]} 
                /next c 
                /if (${Math.Calc[${GroupHPTotal}\${TempGrpCt}]}>${HealMinHP[${a}]} && ${Math.Calc[${GroupHPTotal}\${TempGrpCt}]}<${HealMaxHP[${a}]}) { 
                    /for c 0 to ${Group} 
                        /if (${Math.Calc[${Macro.RunTime}]}<${HoTList[${Math.Calc[${c}+1]},1]}) /goto :BreakOutHeal 
                    /next c 
                    /varset GroupHealFlag 1 
                    /varset b 0 
                    /goto :RetryHeal 
                } 
            } 
        } 
    :BreakOutHeal 
    /next a 
} 
/return