genbot - bothealer - group fix

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

Moderator: MacroQuest Developers

inthrall
orc pawn
orc pawn
Posts: 13
Joined: Sun Mar 14, 2004 3:57 pm

genbot - bothealer - group fix

Post by inthrall » Sun Mar 13, 2005 12:04 pm

After updating MQ2 bothealer in the last version of genbot is slightly broken. I have hopefully fixed this.

Code: Select all

|bothealer.inc 
|Bot healer module. 
|Version 13.3.5
|Date:08/29/2004 
| 
||** 
[bothealer] 
version=13.3.5
**|| 

Sub Init-Healer 
   /declare cmds-HEALER string outer Healer: 

   |For each command 
   |/call AddCommand "Command Section" "Command Phrase" "Called Sub" 
   |Command Section - where the command will be listed in response to the cmd phrase 
   |Command Phrase to trigger bot - End User can change to suit prefferences 
   |Called Sub - Routine to execute in response to Command Phrase 
   /call AddCommands heal resetwatch setcasterheal setcasterhealpct 
   /call AddCommands setdefaultheal setpatchheal setpetheal setpethealpct 
   /call AddCommands settankheal settankhealpct watchtarget 

|declare Vars 
   /declare CasterList string outer 
   /declare HealTargets[21] int outer 0 
   /declare LowHealthCheck int outer 0 
   /declare TankList string outer 
   /declare WatchTargetCount int outer 0 
   /declare WatchTargetIDs[15] int outer 0 
   /declare WatchTargets[15] string outer 
   /declare WatchWaitCount int outer 0 

|Timers 
   /declare CastMsgTimer1 timer outer 
   /declare CastMsgTimer2 timer outer 

|Load Settings 
   /call AddToggle doheal on return "I will not heal anyone unless commanded." "I will watch and cast heal spells as necessary." 
   /call LoadSetting CasterSpell string CasterSpell "Name of heal spell autoheal uses on Non Tanks" 
   /call LoadSetting CasterPctHeal int CasterPctHeal 70 
   /call LoadSetting DefaultHealSpell string DefaultHealSpell "Name of Default Heal Spell" 
   /call LoadSetting HealCasterMsg string HealCasterMsg "Healing %t" 
   /call LoadSetting HealPetMsg string HealPetMsg "Healing %t" 
   /call AddToggle healpets off return "I will not heal the pets." "I will heal the pets." 
   /call LoadSetting HealTankMsg string HealTankMsg "Big Heal on %t" 
   /call LoadSetting IsPally bool IsPally 0 
   /call LoadSetting PalGrpPct int PalGrpPct 81 
   /call LoadSetting PalHealPct int PalHealPct 81 
   /call LoadSetting PallyGroupSpell string PallyGroupSpell "Name of Pally Group Heal Spell" 
   /call LoadSetting PallyHealSpell string PallyHealSpell "Name of Pally Heal Spell" 
   /call LoadSetting PalHealMsg string PalHealMsg "Healing %t" 
   /call AddToggle patchheal on return "I'm not a patch Healer." "I'm a patch Healer." 
   /call LoadSetting PatchHealMsg string PatchHealMsg "Patch Healing %t" 
   /call LoadSetting PatchSpell string PatchSpell "Name of Patch Heal Spell" 
   /call LoadSetting PetPctHeal int PetPctHeal 51 
   /call LoadSetting PetSpell string PetSpell "Name of Pet Heal Spell" 
   /call LoadSetting ReportAutoHeal bool ReportAutoHeal 1 
   /call LoadSetting TankSpell string TankSpell "Name of heal spell autoheal uses on Tanks" 
   /call LoadSetting TankPctHeal int TankPctHeal 51 
   /call AddToggle stopifhealed on return "I will not interrupt heal spells even if target is healed by someone else." "I will interrupt heal spells if target is already above the heal %." 
   /call AddToggle stopforheals off return "I will not interrupt other spells for heal spells." "I will interrupt other spells for heal spells." 



   /varset TankList ${Ini[${IniFile},Healer,TankList,NotFound]} 
   /varset CasterList ${Ini[${IniFile},Healer,CasterList,NotFound]} 
   /if (${TankList.Equal[NotFound]} && ${CasterList.Equal[NotFound]}) { 
      /ini ${IniFile} Healer TankList "Warrior|Shadow Knight|Paladin|Monk|Beastlord|Ranger|Shaman|Berserker" 
      /ini ${IniFile} Healer CasterList "Necromancer|Wizard|Enchanter|Magician|Rogue|Druid|Cleric|Bard" 
      /varset TankList Warrior|Shadow Knight|Paladin|Monk|Beastlord|Ranger|Shaman|Berserker 
      /varset CasterList Necromancer|Wizard|Enchanter|Magician|Rogue|Druid|Cleric|Bard 
   } 
/return 

Sub HealerMain 
   /call CheckGrpHealth 
   /call PalGrpHealChk 
   /call PalHealChk 
/return 

||||| Do Subs 
Sub Command-setcasterheal 
   /if (!${Defined[Param0]}) { 
      /call ChatOut 3 "I heal non tanks with ${CasterSpell}." 
      /return 
   } 
   /varset CasterSpell ${CommandParam} 
   /call ChatOut 3 "I'll start using ${CasterSpell} on non tanks." 
/return 

Sub Command-setcasterhealpct 
   /if (!${Defined[Param0]}) { 
      /call ChatOut 3 "I heal non tanks at ${CasterPctHeal} %." 
      /return 
   } 
   /varset CasterPctHeal ${Param0} 
   /call ChatOut 3 "I heal non tanks at ${CasterPctHeal} %." 
/return 

Sub Command-setdefaultheal 
   /if (!${Defined[Param0]}) { 
      /call ChatOut 3 "I usualy heal with ${DefaultHealSpell}." 
      /return 
   } 
   /varset DefaultHealSpell ${CommandParam} 
   /call ChatOut 3 "I'll start using ${DefaultHealSpell}." 
/return 

Sub Command-heal 
   /if (${DefaultHealSpell.Equal[${DefaultHealSpell-DefaultValue}]}) /return 
   /call AssignCastTarget "${CommandParam}" 
   /declare HealTarget string local ${Macro.Return} 
   |/call ChatOut 3 "Casting ${DefaultHealSpell} on ${NearestSpawn[${HealTarget}]}." 
   /call AddCast "${DefaultHealSpell}" "${HealTarget}" h-com 
/return 

Sub Command-setpatchheal 
   /if (!${Defined[Param0]}) { 
      /call ChatOut 3 "I use ${PatchSpell} for patch heals." 
      /return 
   } 
   /varset PatchSpell ${CommandParam} 
   /call ChatOut 3 "I'll use ${PatchSpell} for patch heals now." 
/return 

Sub Command-setpetheal 
   /if (!${Defined[Param0]}) { 
      /call ChatOut 3 "My pet heal is ${PetSpell}." 
      /return 
   } 
   /varset PetSpell ${CommandParam} 
   /call ChatOut 3 "I'll use ${PetSpell} to heal pets." 
/return 

Sub Command-setpethealpct 
   /if (!${Defined[Param0]}) { 
      /call ChatOut 3 "I heal pets at ${PetPctHeal} %." 
      /return 
   } 
   /varset PetPctHeal ${Param0} 
   /call ChatOut 3 "I heal pets at ${PetPctHeal} %." 
/return 

Sub Command-settankheal 
   /if (!${Defined[Param0]}) { 
      /call ChatOut 3 "My tank heal is ${TankSpell}" 
      /return 
   } 
   /varset TankSpell ${CommandParam} 
   /call ChatOut 3 "I'll use ${TankSpell} to heal tanks." 
/return 

Sub Command-settankhealpct 
   /if (!${Defined[Param0]}) { 
      /call ChatOut 3 "I heal tanks at ${TankPctHeal} %." 
      /return 
   } 
   /varset TankPctHeal ${Param0} 
   /call ChatOut 3 "I heal tanks at ${TankPctHeal} %." 
/return 

Sub Command-watchtarget 
   /if (${String[${Param0}].Equal[off]}) { 
      /varset WatchTargetCount 0 
      /return 
   } 
   /squelch /target clear 
   /call delay 5 
   /call StandardTarget "${CommandParam}" 
   /if (${Target.ID}) { 
      /varcalc WatchTargetCount ${WatchTargetCount}+1 
      /varset WatchTargets[${WatchTargetCount}] ${Target.CleanName} 
      /varset WatchTargetIDs[${WatchTargetCount}] ${Target.ID} 
      /call ChatOut 3 "Now watching the health of ${Target.CleanName}." 
   } else { 
      /call ChatOut 3 "Who did you want me to watch?" 
   } 
/return 

Sub Command-resetwatch 
   /call ResetWatchTargets 
/return 

||||| Called Subs 

Sub CastHeal(int TarID,string HealSpell,string castMsg) 
   /if (!${CastMsgTimer1}) { 
      |/if (${ReportAutoHeal}) /g ${castMsg} 
      /varset CastMsgTimer1 50 
   } 
   /call AddCast "${HealSpell}" "id ${TarID}" "heal" 
/return 

Sub CheckGrpHealth 
   /declare HealCount int local 0 
   /declare BadIDs int local 0 
   /declare SaveCombatStat int local 0 
   /declare SaveCombatID int local 0 
   /declare QuickID int local 0 
   /declare tempvar int local 0 
   /if (!${Toggle-doheal}) /return 
   /if (${IsPally}) /return 
   /varset HealCount ${Group.Members} 
   /for tempvar 1 to ${Group.Members} 
      /varset HealTargets[${tempvar}] ${Group.Member[${tempvar}].ID} 
   /next tempvar 
   /varcalc HealCount ${HealCount}+1 
   /varset HealTargets[${HealCount}] ${Me.ID} 
   /if (${WatchWaitCount}>10 && ${WatchTargetCount}>0) { 
      /for tempvar 1 to ${WatchTargetCount} 
         /varcalc HealCount ${HealCount}+1 
         /varset HealTargets[${HealCount}] ${WatchTargetIDs[${tempvar}]} 
      /next tempvar 
      /varset WatchWaitCount 0 
   } 
   /varcalc WatchWaitCount ${WatchWaitCount}+1 
   /for tempvar 1 to ${HealCount} 
      /if (${tempvar}>${Group} && ${Target.ID}!=${HealTargets[${tempvar}]} && ${HealTargets[${tempvar}]}!=${Me.ID}) { 
         /squelch /target id ${HealTargets[${tempvar}]} 
         /delay 5 
         /if (${Target.ID}!=${HealTargets[${tempvar}]}) { 
            /varcalc BadIDs ${BadIDs}+1 
         } 
      } 
      /varset QuickID ${HealTargets[${tempvar}]} 
      /if (${Spawn[${QuickID}].PctHPs}<${TankPctHeal} && ${Spawn[${QuickID}].State.NotEqual[DEAD]}) { 
         /if (${TankList.Find[${Spawn[${QuickID}].Class}]}) { 
            /if (${Spawn[${QuickID}].PctHPs}<${Math.Calc[${TankPctHeal}/2]} && ${Toggle-patchhealer}) /call PatchHeal ${QuickID} 
            /call CastHeal ${QuickID} "${TankSpell}" "${HealTankMsg}" 
         } 
      } 
      /if ((${Spawn[${QuickID}].PctHPs}<${CasterPctHeal})&&(${Spawn[${QuickID}].State.NotEqual[DEAD]})) { 
         /if (${CasterList.Find[${Spawn[${QuickID}].Class}]}) { 
            /if ((${Spawn[${QuickID}].PctHPs}<${Math.Calc[${CasterPctHeal}/2]})&&(${Toggle-patchhealer})) /call PatchHeal ${QuickID} 
            /call CastHeal ${QuickID} "${CasterSpell}" "${HealCasterMsg}" 
         } 
      } 
      /if (${Toggle-healpets} && ${Spawn[${QuickID}].Class.PetClass} && ${Spawn[${QuickID}].Pet.ID}) { 
         /if (${Spawn[${QuickID}].Pet.PctHPs}<${PetPctHeal}) { 
            /call CastHeal ${Spawn[${QuickID}].Pet.ID} "${PetSpell}" "${HealPetMsg}" 
         } 
      } 
   /next tempvar 
   /if (${CombatTargetID}) /call Target "id ${CombatTargetID}" 
   /if (${BadIDs}>0) /call ResetWatchTargets 
/return 

Sub PalHealChk 
    /declare tempvar int local 0 
   /if (!${IsPally}) /return 
   /if (!${Toggle-doheal}) /return 
   /for tempvar 0 to ${Group} 
      /if ((${Group[${tempvar}].PctHPs}<${PalHealPct})&&(${Group[${tempvar}].State.NotEqual[DEAD]})) /call PallyHeal ${Group[${tempvar}].ID} 
   /next tempvar 
/return 

Sub PalGroupheal 
   /if (${Me.Sitting}) /stand 
   /if (${ReportAutoHeal}) /g ${PalHealGrpMsg} 
   /call AddCast "${PallyGroupSpell}" 0 heal 
/return 

Sub PalGrpHealChk 
   /declare tempvar int local 1 
   /if (!${IsPally}) /return 
   /if (!${Toggle-doheal}) /return 
   /if (${Me.PctHPs}>${PalHealPct}) { 
      /varset LowHealthCheck 0 
   } else { 
      /varset LowHealthCheck 1 
   } 
   /for tempvar 1 to ${Group} 
      /if ((${Group[${tempvar}].PctHPs}<${PalHealPct})&&(${Group[${tempvar}].State.NotEqual[DEAD]})) /varcalc LowHealthCheck ${LowHealthCheck}+1 
      /if (${LowHealthCheck}>=3) { 
         /call PalGroupheal 
         /return 
      } 
   /next tempvar 
/return 

Sub PallyHeal(int TarID) 
   /if (${CombatTargetID}) /return 
   /if (${TarID}==${Me.ID}) /target myself 
   /if (${TarID}!=${Me.ID}) /squelch /target id ${TarID} 
   /g ${PalHealMsg} 
   /call AddCast "${PallyHealSpell}" 0 heal 
/return 

Sub Patchheal(int TarID) 
   /if (${CastMsgTimer1}<=0) { 
      |/if (${ReportAutoHeal}) /g ${PatchHealMsg} 
      /varset CastMsgTimer1 50 
   } 
   /if (${Me.Gem[${PatchSpell}]}) /call AddCast "${PatchSpell}" "id ${TarID}" "heal" 
/return 

Sub ResetWatchTargets 
   /declare counter int local 
   /for counter 1 to ${WatchTargetCount} 
      /squelch /target PC ${WatchTargets[${counter}]} 
      /call Delay 25 
      /if (${Target.CleanName.Equal[${WatchTargets[${counter}]}]}) { 
            /varset WatchTargetIDs[${counter}] ${Target.ID} 
      } else { 
            /call ChatOut 5 "I failed to find ${WatchTargets[${counter}]} in the zone." 
      } 
   /next counter 
/return
Last edited by inthrall on Sun Mar 13, 2005 12:31 pm, edited 1 time in total.

User avatar
htw
a grimling bloodguard
a grimling bloodguard
Posts: 512
Joined: Wed Feb 18, 2004 8:30 pm
Location: Albuquerque, NM USA
Contact:

Post by htw » Sun Mar 13, 2005 12:09 pm

Oops, somebody forgot enable bbcode!! =P =P

inthrall
orc pawn
orc pawn
Posts: 13
Joined: Sun Mar 14, 2004 3:57 pm

Post by inthrall » Sun Mar 13, 2005 12:33 pm

probably not posted in the right section either, just trying to help though

Kay7
orc pawn
orc pawn
Posts: 17
Joined: Sat Sep 18, 2004 9:54 pm

Post by Kay7 » Tue Apr 19, 2005 1:36 am

Thanks man. That fixed it for me. Hopefully it'll get incorporated quickly into the main thread.

Process
a lesser mummy
a lesser mummy
Posts: 73
Joined: Fri Jun 25, 2004 5:30 pm

Post by Process » Tue Apr 19, 2005 4:03 pm

Using this with Genbot is causing me to CTD. However, if I turn off heals (doheal=off) in the character's genbot ini file, it works fine. Am I doing something wrong?

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Tue Apr 19, 2005 4:39 pm

check out bug reports
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

ascii38
a grimling bloodguard
a grimling bloodguard
Posts: 506
Joined: Sat Jul 17, 2004 8:06 pm

Post by ascii38 » Wed Apr 20, 2005 1:47 am

Make sure you make the same update to advpath.inc if you use it. I also think there were some ${Group} changes missed that will only be triggered by a paladin that is group healing.

rowdan
orc pawn
orc pawn
Posts: 16
Joined: Wed Feb 05, 2003 4:57 pm
Location: el cajon
Contact:

Post by rowdan » Sat Apr 23, 2005 10:16 pm

tryed this fix out and seems to work great..... thanks

Norz
orc pawn
orc pawn
Posts: 12
Joined: Tue Dec 14, 2004 11:36 am

Post by Norz » Tue Apr 26, 2005 4:46 am

For some reason eq keeps crashing when running mq2 only when i join gorup. I applied patch and it didnt help. Seems to work fine on my cle but crashes on my dru. Any ideas what's going on?

xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: genbot - bothealer - group fix

Post by xyilla » Wed Apr 30, 2025 8:11 pm


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: genbot - bothealer - group fix

Post by xyilla » Wed Apr 30, 2025 8:12 pm


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: genbot - bothealer - group fix

Post by xyilla » Wed Apr 30, 2025 8:13 pm


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: genbot - bothealer - group fix

Post by xyilla » Wed Apr 30, 2025 8:14 pm


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: genbot - bothealer - group fix

Post by xyilla » Wed Apr 30, 2025 8:16 pm


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: genbot - bothealer - group fix

Post by xyilla » Wed Apr 30, 2025 8:17 pm