• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Anyone Have a Working Genbot? (1 Viewer)

wendel

New member
Joined
Jan 29, 2006
RedCents
I know it's an old macro, and there are probably many others that do way more, but I know Genbot's commands like the back of my hands.
I have one that will heal, cast spells, follow, and buff, but it will only track one buff. So say I ask my bot to buff me with sow, then with thorns, it will only track the last request.
I see that when I do a bufflist command it will list all the buffs okay, but when listing player tracked buffs I get something like this
Rich (BB code):
1. Skin like Steel for Warrior to be cast in 35 minutes 44 seconds
2. Null Null for Null  to be cast in 0 minutes 0 seconds
3. Null Null for Null to be cast in 0 minutes 0 seconds.

Here is that snippet of code that sends those tells

Rich (BB code):
Sub Command-bufflist
   /declare GenFor int local
   /call ChatOut 1 "Buffs I have on myself now:"
   /for GenFor 1 to 15
      /if (${Me.Buff[${GenFor}].ID}) {
         /call ChatOut 1 "${Me.Buff[${GenFor}].Name} with ${Me.Buff[${GenFor}].Duration.Minutes} minutes ${Me.Buff[${GenFor}].Duration.Seconds} seconds left."
      }
   /next GenFor
   /if (${BuffPtrList.Length}) {
      /call ChatOut 1 "Buffs I am timing for myself or others:"
      /for GenFor 1 to ${Math.Calc[${BuffPtrList.Count[ ]}+1]}
         /call ChatOut 1 "${GenFor}. ${Buff-${GenFor}-Text.Arg[1,;]} ${Buff-${GenFor}-Text.Arg[2,;]} for ${Spawn[${Buff-${GenFor}-Text.Arg[3,;]}]} to be cast in ${Math.Calc[${ST-BuffRefresh-${GenFor}}\600].Int} minutes ${Math.Calc[${ST-BuffRefresh-${GenFor}}%600/10].Int} seconds."
      /next GenFor
   } else {
      /call ChatOut 1 "I am keeping up no other buffs at the moment."
   }
/return

Here is the complete Botspell.inc which I thinks tracks the buffs.


Rich (BB code):
|botspell.inc
|Bot spell module.
|Version 13.3.7
|Date:10/17/2005
|
||**
[botspell]
version=13.3.6
**||

#event CastFizzle "Your spell fizzles!"
#event CastInterrupt "Your spell is interrupted."
#event CastInterrupt "Your casting has been interrupted."
#event CastNoMana "Insufficient Mana to cast this spell!"
#event CastResist "Your target resisted #*#"
#event CastTooFar "Your target is out of range, get closer!"
#event Collapse "Your gate is too unstable, and collapses."
#event Distracted "You are too distracted to cast a spell now!"
#event ImmuneSlow "Your target is immune to changes in its attack speed."
#event ImmuneRoot "Your target is immune to changes in its run speed."
#event MissedNote "You miss a note, bringing your song to a close!"
#event NoLOS "You cannot see your target."
#event NoMem "You do not seem to have that spell memorized."
#event NoOverWrite "Your spell would not have taken hold on your target."
#event NoTarget "You must first select a target for this spell!"
#event Recovered "You haven't recovered yet..."
#event Recovered "Spell recovery time not yet met."
#event RootOff "Your Immobilize spell has worn off."
#event Sitting "You must be standing to cast a spell."
#event Stunned "You can't cast spells while stunned!"
#event Stunned "You *CANNOT* cast spells, you have been silenced!"
#event WornOff "Your #1# spell has worn off of #2#."

Sub Init-Spell
   /declare cmds-SPELL string outer Spell:
   |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 buff chainnuke chainstun evac loadlist
   /call AddCommands mana selfbuff bufflist setlompct sn snt spellgem
|/declare Vars
   /declare BuffPtrList string outer
   /declare BuffSelfIconList string outer
   /declare CastInfo string outer
   /declare CastLastResult string outer
   /declare CastName string outer
   /declare CastOldTargetID int outer
   /declare CastQueue string outer
   /declare CastStep int outer
   /declare CastTarget string outer
   /declare CastType string outer
   /declare ChainStunNum int outer
   /declare DoAgain bool outer FALSE
   /declare LastSn string outer NA
   /declare SpellNeedToRemem bool outer 0

|Timers
   /declare ChainStunTime timer outer
   /declare CannTimer timer outer
   /declare CastTimer timer outer
   /declare CTimer timer outer
   /declare LomTimer timer outer
   /declare ST-CheckSelfBuffs timer outer 1
   /declare YaulpTimer timer outer

|Load Settings
   /call LoadSetting BuffSelfList string SelfBuffList "Buffs you wish to maintain on yourself separated with |"
   /call AddToggle sitaftercast on return "I will no longer sit after casting." "I will now sit after casting."
   /call LoadSetting DelayBeforeSit string DelayBeforeSit 3s
   /call AddToggle canni off return "I won't eat myself for mana." "I will eat myself for mana."
   /call LoadSetting CanniSpell string CanniSpell Cannibalize
   /call LoadSetting CanniLimit string CanniUntilPctHPsLessThan 40
   /call LoadSetting CanniHoT string CanniHealOverTime Quiescence
   /call LoadSetting ChainNuke string ChainNuke "Your Chain Nuke Spells separated with |."
   /call LoadSetting ChainStun string ChainStun "Your Chain Stun Spells separated with |."
   /call LoadSetting DefaultSpellSet string DefaultSpellSet Default
   /call AddToggle dobuff on return "I won't cast buffs until commanded." "I will cast buffs."
   /call LoadSetting EvacSpell string EvacSpell "Enter the name of your Evac spell here."
   /call LoadSetting LomMsg string LomMsg "Warning I'm running low on Mana."
   /call AddToggle reportlom off return "I won't tell you when I'm low on Mana." "I'll let you know when I'm low on Mana."
   /call AddToggle remem off return "I won't remem my spellset after casting." "I will remem my spellset after casting."
   /call LoadSetting SpellGem int DefaultSpellGem 8
   /call AddToggle yaulp off return "I won't Yaulp for mana." "I will Yaulp for mana."
   /call LoadSetting YaulpSpell string YaulpSpell Yaulp


   /if (${BuffSelfList.NotEqual[${BuffSelfList-DefaultValue}]}) {
      /declare ArgNum int local 1
      /for ArgNum 1 to ${Math.Calc[${BuffSelfList.Count[|]}+1]}
         /varset CommandParam ${BuffSelfList.Arg[${ArgNum},|]}
         /call Command-SelfBuff "${CommandParam}"
      /next ArgNum
   }
/return

Sub SpellMain
   /call CastFromQueue
   /if (${Toggle-canni}) /call CheckCann
   /if (${Toggle-yaulp}) /call CheckYaulp
/return

||||| Do Subs

Sub Command-buff
   /declare BuffName string local
   /declare BuffType string local
   /if (!${Defined[Param0]}) /return
   /if (${Param0.Equal[on]}) /return
   /if (${Param0.Equal[off]}) {
      /varset BuffListCount 0
      /return
   }
   /declare SpellNameParam string local ${Param0}
   /declare TargetName string local
   /declare ParamCount int local 1
   /if (${Param0.Equal[on]}) {
      /varset SpellNameParam ${LastSn}
      /goto :Command-BuffTargetStart
   }
   :Command-BuffSpellLoop
      /if (${Defined[Param${ParamCount}]}) {
         /if (${Param${ParamCount}.Equal[on]}) /goto :Command-BuffTargetStart
         /varset SpellNameParam ${SpellNameParam} ${Param${ParamCount}}
         /varcalc ParamCount ${ParamCount}+1
         /goto :Command-BuffSpellLoop
      }
   :Command-BuffTargetStart
   /varcalc ParamCount ${ParamCount}+1
   /if (!${Defined[Param${ParamCount}]}) {
      /varset TargetName me
   } else {
      /varset TargetName ${Param${ParamCount}}
      /varcalc ParamCount ${ParamCount}+1
      :Command-BuffTargetLoop
         /if (${Defined[Param${ParamCount}]}) {
            /varset TargetName ${TargetName} ${Param${ParamCount}}
            /varcalc ParamCount ${ParamCount}+1
            /goto :Command-BuffTargetLoop
         }
      /if (${TargetName.Equal[yourself]} || ${TargetName.Equal[${Me.CleanName}]}) {
         /varset CommandParam ${SpellNameParam}
         /call Command-SelfBuff ${CommandParam}
         /return
      }
   }
   /call AssignCastTarget "${TargetName}"
   /varset TargetName ${Macro.Return}
   /if (${TargetName.Equal[0]}) {
      /call ChatOut 5 "I don't understand who to cast that buff on."
      /return
   }
   /if (${DebugList.Find[spell]}) /echo Command-buff "${SpellNameParam}" "${TargetName}"
   /call AddCast "${SpellNameParam}" "${TargetName}" b-0
/return


Sub BuffResult(string BuffType,string BuffCast,string BuffTarget,int Ptr)
   /declare GenFor int local
   /declare GenStr string local
   /declare BuffSpell int local
   /declare BuffDuration string local 0
   | Find an available pointer for the buff and delete duplicates
   /if (${Ptr}) {
      /call ListDelbyName BuffPtrList ${Ptr} " "
      /goto :gBuffPtrFound
   }
   /for GenFor 1 to ${Math.Calc[${BuffPtrList.Count[ ]}+2]}
      /if (!${BuffPtrList.Find[ ${GenFor} ]} && !${Ptr}) {
         /varset Ptr ${GenFor}
      }
      /if (${Buff-${BuffPtrList.Arg[${GenFor}]}-Text.Equal[${BuffType};${BuffCast};${BuffTarget}]}) {
         /varset Ptr ${BuffPtrList.Arg[${GenFor}]}
         /call ListDelbyArg BuffPtrList ${GenFor} " "
         /varset ST-BuffRefresh-${Ptr} 0
         /goto :gBuffPtrFound
      }
   /next GenFor
   :gBuffPtrFound
   /if (!${Defined[Buff-${Ptr}-Text]}) /declare Buff-${Ptr}-Text string outer
   /if (!${Defined[Buff-${Ptr}-RetryNum]}) /declare Buff-${Ptr}-RetryNum int outer 0

   /if (${DebugList.Find[spell]}) /echo BuffPtr ${Ptr}

   /if (${CastLastResult.Equal[CAST_Successful]}) {
      /varset Buff-${Ptr}-RetryNum 0
      /if (${Spawn[${BuffTarget}].Name.Equal[${Me.Name}]} || ${BuffTarget.Equal[0]}) {
         /call CheckForBuffIcon ${BuffType} "${BuffCast}"
         /if (${Macro.Return}) {
            /varset GenStr |BuffSelfIconList|
         /if (!${GenStr.Find[|${BuffType};${BuffCast}|]}) {
               /call ListAppendElement BuffSelfIconList "${BuffType};${BuffCast}" |
            }
            /return
         } else {
         /call ChatOut 8 "I don't recognize the icon for ${BuffType.Arg[1,-]} ${BuffName}.  Tell me 'timebuff ${BuffType.Arg[1,-]} ${BuffName}' some time when I don't have that buff active, and I'll record the buff and time how long it lasts."
         }
      }
      /varset GenStr |${TimedBuffList}
     /if (${GenStr.Find[|${BuffSpell};]}) {
         /call ListFindStringArg TimedBuffList "|${BuffSpell};" |
         /varset BuffDuration ${TimedBuffList.Arg[${Macro.Return},|].Arg[2,;]}
         /if (${Spawn[${BuffTarget}].Name.Equal[${Me.Name}]} && ${Me.Buff[${TimedBuffList.Arg[${Macro.Return},|].Arg[3,;]}].ID}) {
            /if (!${String[|${BuffSelfList}|].Find[|${BuffType};${BuffCast}|]}) {
               /call ListAppendElement BuffSelfList "${BuffType};${BuffCast}" |
            }
            /return
         }
      }
      /if (!${BuffDuration}) {
         /if (${BuffType.Arg[1,-].Equal[spell]}) {
            /varset BuffDuration ${Spell[${BuffCast}].Duration.TotalSeconds}s
        } else /if (${BuffType.Arg[1,-].Equal[item]}) {
           /varset BuffDuration ${FindItem[${BuffCast}].Spell.Duration.TotalSeconds}s
        } else /if (${BuffType.Equal[alt]}) {
           /varset BuffDuration ${AltAbility[${BuffCast}].ReuseTime}s
        }
      }
   } else {
      /if (${CastLastResult.Equal[CAST_NoOverWrite]} || ${CastLastResult.Equal[TARGET_NOTEXIST]}) {
         /varset BuffDuration 2m
         /varset Buff-${Ptr}-RetryNum 0
      } else /if (${Buff-${Ptr}-RetryNum}<2) {
         /varcalc Buff-${Ptr}-RetryNum ${Buff-${Ptr}-RetryNum}+1
         /varset BuffDuration 15s
      } else {
         /varset BuffDuration 95s
         /varset Buff-${Ptr}-RetryNum 0
      }
   }
   /if (!${Defined[ST-BuffRefresh-${Ptr}]}) /declare ST-BuffRefresh-${Ptr} timer outer
   /varset ST-BuffRefresh-${Ptr} ${BuffDuration}
   /varcalc ST-BuffRefresh-${Ptr} ${ST-BuffRefresh-${Ptr}}-50
   /if (${DebugList.Find[spell]}) /echo ST-BuffRefresh-${Ptr} ${ST-BuffRefresh-${Ptr}} BuffDuration ${BuffDuration}

   /varset Buff-${Ptr}-Text ${BuffType};${BuffCast};${BuffTarget}
   /call ListAppendElement BuffPtrList ${Ptr} " "
/return

Sub BuffRefresh(int Ptr)
   /call AddCast "${Buff-${Ptr}-Text.Arg[1,;]};${Buff-${Ptr}-Text.Arg[2,;]}" "${Buff-${Ptr}-Text.Arg[3,;]}" b-${Ptr}
/return

Sub Command-SelfBuff
   /declare splaceholder string local
   /if (!${Defined[Param0]}) /return
   /if (${Param0.Equal[off]}) {
      /varset BuffSelfList
      /return
   }
   /if (${DebugList.Find[spell]}) /echo Command-SelfBuff ${CommandParam}
   /call RefineCast "${CommandParam}"
   /if (${Macro.Return.Equal[0]}) /return
   /varset CommandParam ${Macro.Return}
   /if (${DebugList.Find[spell]}) /echo RefineCast Return ${Macro.Return}
   /if (${CommandParam.NotEqual[0]}) {
      /call CheckForBuffIcon ${Macro.Return.Arg[1,;]} "${Macro.Return.Arg[2,;]}"
      /if (${DebugList.Find[spell]}) /echo CheckForBuffIcon Return ${Macro.Return}
      /if (${Macro.Return}) {
         /varset splaceholder |${BuffSelfIconList}|
         /if (${splaceholder.Find[|${CommandParam}|]}) {
            /call AddCast "${CommandParam}" "${Me.Name}" b-0
         } else {
            /call ListAppendElement BuffSelfIconList "${CommandParam}" |
         }
      } else {
         /call AddCast "${CommandParam}" "${Me.Name}" b-0
      }
   }
/return

sub CheckSelfBuffs
   /declare GenFor int local
   /declare BuffType string local
   /declare BuffName string local
   /declare BuffSpell string local
   /varset ST-CheckSelfBuffs 5s
   /if (${BuffSelfIconList.Length}) {
      /for GenFor 1 to ${Math.Calc[${BuffSelfIconList.Count[|]}+1]}
         /varset BuffType ${BuffSelfIconList.Arg[${GenFor},|].Arg[1,;].Arg[1,-]}
         /varset BuffName ${BuffSelfIconList.Arg[${GenFor},|].Arg[2,;]}
         |/if (${DebugList.Find[spell]}) /echo Sub CheckSelfBuffs BuffSelfIconList ${BuffSelfIconList} BuffType ${BuffType} BuffName ${BuffName}
         /call CheckForBuffIcon ${BuffType} "${BuffName}"
         |/if (${DebugList.Find[spell]}) /echo CheckForBuffIcon Return ${Macro.Return}
         /if (!${Macro.Return}) /call AddCast "${BuffType};${BuffName}" ${Me.Name} b-s
      /next GenFor
   }
/return

Sub CheckForBuffIcon(string BuffType,string BuffCast)
   /declare BuffSpell string local
   /declare splaceholder string local
   /if (${BuffType.Arg[1,-].Equal[spell]}) {
      /varset BuffSpell ${Spell[${BuffCast}].Name}
   } else /if (${BuffType.Arg[1,-].Equal[item]}) {
      /varset BuffSpell ${FindItem[${BuffCast}].Spell.Name}
   } else /if (${BuffType.Equal[alt]}) {
      /varset BuffSpell ${AltAbility[${BuffCast}].Spell.Name}
   }
   /varset splaceholder |${TimedBuffList}
   /if (${splaceholder.Find[|${BuffSpell};]}) {
      /call ListFindStringArg TimedBuffList "|${BuffSpell};" |
      /if (${Me.Buff[${TimedBuffList.Arg[${Macro.Return},|].Arg[3,;]}].ID}) {
         /return 1
      } else {
         /return 0
      }
   }
   /if (${Me.Buff[${BuffSpell}].ID}) /return 1
/return 0

Sub Command-bufflist
   /declare GenFor int local
   /call ChatOut 1 "Buffs I have on myself now:"
   /for GenFor 1 to 15
      /if (${Me.Buff[${GenFor}].ID}) {
         /call ChatOut 1 "${Me.Buff[${GenFor}].Name} with ${Me.Buff[${GenFor}].Duration.Minutes} minutes ${Me.Buff[${GenFor}].Duration.Seconds} seconds left."
      }
   /next GenFor
   /if (${BuffPtrList.Length}) {
      /call ChatOut 1 "Buffs I am timing for myself or others:"
      /for GenFor 1 to ${Math.Calc[${BuffPtrList.Count[ ]}+1]}
         /call ChatOut 1 "${GenFor}. ${Buff-${GenFor}-Text.Arg[1,;]} ${Buff-${GenFor}-Text.Arg[2,;]} for ${Spawn[${Buff-${GenFor}-Text.Arg[3,;]}]} to be cast in ${Math.Calc[${ST-BuffRefresh-${GenFor}}\600].Int} minutes ${Math.Calc[${ST-BuffRefresh-${GenFor}}%600/10].Int} seconds."
      /next GenFor
   } else {
      /call ChatOut 1 "I am keeping up no other buffs at the moment."
   }
/return


Sub Command-chainnuke
   /if (${ChainNuke.Equal[${ChainNuke-DefaultValue}]}) /return
   /declare NukeNum int local 1
   /call StandardTarget "${CommandParam}"
   :ChainNukeLoop
      /if (!${Target.ID}) /return
      /if (${Me.Gem[${ChainNuke.Arg[${NukeNum},|]}]}) /cast "${ChainNuke.Arg[${NukeNum},|]}"
      /varcalc NukeNum ${NukeNum}+1
      /if (!${ChainNuke.Arg[${NukeNum},|].Length}) /varset NukeNum 1
   /goto :ChainNukeLoop
/return

Sub Command-chainstun
   /if (${ChainStun.Equal[${ChainStun-DefaultValue}]}) /return
   /call StandardTarget "${CommandParam}"
   /if (!${Target.ID}) /return
   /varset ChainStunNum 1
   /call NextStun
/return

Sub Command-evac
   /if (${EvacSpell.Equal[${EvacSpell-DefaultValue}]}) {
      /call ChatOut 5 "Moving to you!"
   } else {
      /call ChatOut 5 "Moving to you and casting ${EvacSpell}!"
   }
   /varset CommandParam ${MasterName}
   /call Command-moveto ${MasterName}
   /call Command-anchor off
   /if (!${EvacSpell.Equal[${EvacSpell-DefaultValue}]}) {
      /if (${DebugList.Find[spell]}) /echo Command-evac "${EvacSpell}" ${Me.Name} heal
      /call AddCast "${EvacSpell}" ${Me.Name} h-com
   }
/return

Sub Command-loadlist(string Spellset)
   /if (!${Defined[Spellset]}) /return
   /memspellset ${Spellset}
/return

Sub Command-mana
   /if (!${Me.Class.CanCast}) /return
   /declare RoundMana int local ${Math.Calc[${Math.Calc[${Me.PctMana}/5].Int}*5].Int}
   /if (${RoundMana}==100) {
     /call ChatOut 2 "fm"
   } else {
     /call ChatOut 2 "${RoundMana}m"
   }

/return

Sub Command-sn(string newSpell)
   /declare snTarget string local
   /call AssignCastTarget 0
   /varset snTarget ${Macro.Return}
   /if (!${Defined[newSpell]} && ${LastSn.Equal[NA]}) /return
   /if (!${Defined[newSpell]}) /varset CommandParam "${LastSn}"
   /if (${snTarget.Equal[0]}) {
      /return
   }
   /varset LastSn ${CommandParam}
   /if (${DebugList.Find[spell]}) /echo Command-sn "${CommandParam}" "${snTarget}"
   /call AddCast "${CommandParam}" "${snTarget}"
/return

Sub Command-snt
   /if (!${Defined[Param0]}) /return
   /if (${Param0.Equal[on]} && ${LastSn.NotEqual[NA]}) /return
   /declare sntCastText string local ${Param0}
   /declare ParamCount int local 1
   /declare sntTarget string local 0
   /if (${Param0.Equal[on]}) {
      /varset sntCastText ${LastSn}
      /goto :Command-sntTargetStart
   }

   :Command-sntSpellLoop
      /if (${Defined[Param${ParamCount}]}) {
         /if (${Param${ParamCount}.Equal[on]}) /goto :Command-sntTargetStart
         /varset sntCastText ${sntCastText} ${Param${ParamCount}}
         /varcalc ParamCount ${ParamCount}+1
         /goto :Command-sntSpellLoop
      }
   :Command-sntTargetStart
   /varcalc ParamCount ${ParamCount}+1
   /if (${Defined[Param${ParamCount}]}) {
      /varset sntTarget ${Param${ParamCount}}
      /varcalc ParamCount ${ParamCount}+1
      :Command-sntTargetLoop
         /if (${Defined[Param${ParamCount}]}) {
            /varset sntTarget ${sntTarget} ${Param${ParamCount}}
            /varcalc ParamCount ${ParamCount}+1
            /goto :Command-sntTargetLoop
         }
   }
   /if (${sntTarget.Equal[0]}) {
      /if (${CombatTargetID}) {
         /varset sntTarget id ${CombatTargetID}
      } else /if (${Target.ID}) {
         /varset sntTarget ${Target.Type} id ${Target.ID}
      } else {
         /varset sntTarget 0
      }
   } else {
      /call AssignCastTarget "${sntTarget}"
      /varset sntTarget ${Macro.Return}
   }
   /if (${DebugList.Find[spell]}) /echo Command-snt ${sntCastText} ${sntTarget}
   /call AddCast "${sntCastText}" "${sntTarget}"
   /varset LastSn ${sntCastText}
/return

Sub Command-spellgem
   /if (!${Defined[Param0]}) {
      /call ChatOut 3 "I use Gem ${SpellGem} when I need to mem new spells."
      /return
   }
   /varset SpellGem ${Param0}
   /call ChatOut 3 "I will now use Gem ${SpellGem} when I need to mem new spells."
/return




|||| Called Subs

Sub AddCast(string AddCastText,string AddCastTarget,string AddCastInfo)
   /declare AddCastType string local
   /declare sTemp string local
   /if (!${Defined[AddCastTarget]}) /declare AddCastTarget string local ${Target.Name}
   /if (!${Defined[AddCastInfo]}) /declare AddCastInfo string local 0
   /varset sTemp item spell alt
   /if (!${sTemp.Find[ ${AddCastText.Lower.Arg[1,;].Arg[1,-]} ]}) {
      /if (${DebugList.Find[spell]}) /echo AddCastText ${AddCastText}
      /call RefineCast "${AddCastText}"
      /if (${Macro.Return.Equal[0]}) /return
      /varset AddCastText ${Macro.Return}
   }
   /varset sTemp |pb ae|self|ae pc v2|group v1|
   /if (${AddCastText.Arg[1,;].Arg[1,-].Equal[spell]}) {
      /if (${sTemp.Find[|${Spell[${AddCastText.Arg[2,;]}].TargetType.Lower}|]}) {
          /varset AddCastTarget 0
      }
   } else /if (${AddCastText.Arg[1,;].Arg[1,-].Equal[item]}) {
     /if (${sTemp.Find[|${FindItem[${AddCastText.Arg[2,;]}].Spell.TargetType.Lower}|]}) {
         /varset AddCastTarget 0
      }
   }
   /varset sTemp |corpse |pc |npc |pet |assist- |0
   /if (!${sTemp.Find[|${AddCastTarget.Arg[1].Lower}]}) {
      /call RefineTarget "${AddCastTarget}"
      /varset AddCastTarget ${Macro.Return}
   }
   /if (${DebugList.Find[spell]}) /echo AddCastText ${AddCastText}  AddCastTarget ${AddCastTarget} AddCastInfo ${AddCastInfo}
   /if (!${CastQueue.Find[${AddCastText};${AddCastTarget};${AddCastInfo}]}) {
      /if (${AddCastInfo.Left[1].Equal[h]}) {
         /call ListPrependElement CastQueue "${AddCastText};${AddCastTarget};${AddCastInfo}" |
      } else {
         /call ListAppendElement CastQueue "${AddCastText};${AddCastTarget};${AddCastInfo}" |
      }
   }
   /if (${DebugList.Find[spell]}) /echo CastQueue ${CastQueue}
   /return

Sub CastFromQueue
   /if (${Merchant.Open} || ${Window[BigBankWnd]}) /return
   /declare ArgNum int local 0
   /if (!${CastStep}) {
      /if (!${CastQueue.Length}) /return
      /if (${CastQueue.Find[assist-]}) {
         /call Assist ${MasterName}
         /if (${Target.ID}) {
            /call RefineTarget "${Target.Name}"
            /call StringReplaceAll CastQueue assist- "${Macro.Return}"
         } else {
            /call ChatOut 4 "Unable to assist you to find a target to cast on."
         }
      }
      :gNextinQueue
      /varcalc ArgNum ${ArgNum}+1
      /if (!${Toggle-dobuff} && ${CastQueue.Arg[${ArgNum},|].Arg[4,;].Arg[1,-].Equal}) /goto :gNextinQueue
      /if (!${CastQueue.Arg[${ArgNum},|].Length}) /return
      /varset CastType ${CastQueue.Arg[${ArgNum},|].Arg[1,;]}
      /varset CastName ${CastQueue.Arg[${ArgNum},|].Arg[2,;]}
      /varset CastTarget ${CastQueue.Arg[${ArgNum},|].Arg[3,;]}
      /varset CastInfo ${CastQueue.Arg[${ArgNum},|].Arg[4,;]}
      /if (${DebugList.Find[spell]}) /echo CastType ${CastType} CastName ${CastName} CastTarget ${CastTarget}
      /varset CastTimer 0
      /varset CastStep 1
      /varset CastOldTargetID 0
   } else /if (${Toggle-stopforheals} && ${CastQueue.Arg[1,|].Arg[4,;].Left[1].Equal[h]} && !${CastInfo.Left[1].Equal[h]}) {
      /if (${Me.Casting.ID}) /stopcast
      /varset CastStep 0
      /call ChatOut 3 "Interrupted ${CastType.Arg[1,-]}: ${CastName}.  I need to heal somebody instead!"
      /varset CastLastResult SPELL_IntentionalInterruption
      /return
   }

   |/if (${DebugList.Find[spell]}) /echo CastType CastName CastStep ${CastType} ${CastName} ${CastStep}
   /if (${CastQueue.Length}) /call Cast
   /return

Sub Cast
   /declare GenStr string local 1 2 3 4 5 6 7
   /if (${GenStr.Find[${CastStep}]}) {
     /goto :gCast-${CastStep}
   } else {
      /if (${DebugList.Find[spell]}) /echo CastStep = ${CastStep} -- No corresponding goto found.  Returning.
      /varset CastStep 5
      /return
   }
   | Wait for spell to pop up, stand up, and target correctly.
:gCast-1
   |/if (${DebugList.Find[spell]}) /echo Cast 1 ${CastName}
   /if (${CastTimer}) /return
   /varset CastLastResult CHECKING_Casting
   /if (${Me.Casting.ID}) /return

   | Check the target conditions if a target required.
   /if (!${CastTarget.Equal[0]}) {
      /if (!${Spawn[${CastTarget}].ID}) {
         /if (${CastInfo.Arg[1,-].NotEqual} || ${CastInfo.Arg[1,-].Equal[b-0]}) {
            /call ChatOut 3 "I couldn't find the target for ${CastType.Arg[1,-]} ${CastName}."
         }
         /varset CastStep 5
         /varset CastLastResult TARGET_NOTEXIST
         /return
      }
      /if (!${NearestSpawn[${CastTarget} radius ${MaxTargetRange}].ID}) {
         /call ChatOut 3 "${NearestSpawn[${CastTarget}]} is out of range of ${CastType.Arg[1,-]} ${CastName}."
         /varset CastStep 5
         /varset CastLastResult TARGET_OUTOFRANGE
         /return
      }
      /if (${Target.ID}!=${NearestSpawn[${CastTarget}].ID}) {
         /varset CastOldTargetID ${Target.ID}
         /squelch /target ${CastTarget}
         /delay 2s ${Target.ID}==${NearestSpawn[${CastTarget}].ID}
         /varset CastTimer 5
         /if (${Target.ID}!=${NearestSpawn[${CastTarget}].ID}) {
            /call ChatOut 3 "Wasn't able to target: ${CastTarget}"
            /varset CastStep 5
            /varset CastLastResult TARGET_CANNOTTARGET
            /return
         }
      }
   }

   /varset CastLastResult CHECKING_Moving
   /if (${CastType.Arg[1,-].Equal[spell]}) {
      /if (${Spell[${CastName}].MyCastTime}>0.1 && ${Me.Moving} && ${Me.Class.Name.NotEqual[Bard]}) {
         /varset CastStep 2
         /return
      }
      /varset CastLastResult CHECKING_SpellMemmed
      /if (!${Me.Gem[${CastName}]}) {
         /varset CastStep 3
         /return
      }
      /varset CastLastResult CHECKING_SpellUp
      /if (!${Me.SpellReady[${CastName}]}) /return
   } else /if (${CastType.Arg[1,-].Equal[item]}) {
      /if (${FindItem[${CastName}].CastTime}>0.1 && ${Me.Moving} && ${Me.Class.Name.NotEqual[Bard]}) {
         /varset CastStep 2
         /return
      }
   }

   /varset CastLastResult CHECKING_Standing
   /if (!${Me.Standing}) {
      /stand
   }
   /if (${Toggle-sitaftercast}) /varset SitTimer 1140m
   /varset CastLastResult CHECKING_Target
   | Not accounting for items or alt yet.

   | Announce the casting.
   /if (${CastTarget.Equal[0]}) {
      /call ChatOut 5 "Casting ${If[${CastInfo.Arg[1,-].Equal},buff ,]}${CastType.Arg[1,-]} ${CastName}."
   } else {
      /call ChatOut 5 "Casting ${If[${CastInfo.Arg[1,-].Equal},buff ,]}${CastType.Arg[1,-]} ${CastName} on ${Target.CleanName}."
   }

   | Cast the spell or item or alt.
   /if (${CastType.Arg[1,-].Equal[spell]}) {
      /cast "${CastName}"
   } else /if (${CastType.Arg[1,-].Equal[item]}) {
      /cast item "${CastName}"
   } else {
      /alt activate ${AltAbility[${spellName}].ID}
   }

   /varset CastLastResult CAST_StillCasting
   /varset CastStep 4
   /varset CastTimer 0
   /return
   |Stop moving
:gCast-2
   /if (${Me.Moving}) {
      /if (!${CastTimer}) {
         /call ChatOut 3 "Can't cast since I'm moving."
         /keypress forward
         /keypress back
         /varset CastTimer 8
      }
      /return
   }
   /varcalc CastStep 1
   /varset CastTimer 0
   /return
   | Memorize the spell
:gCast-3
   /if (!${Me.Gem["${CastName}"]}) {
      /if (!${CastTimer}) {
         /varset SpellNeedToRemem 1
         /if (${CastType.Arg[2,-].Length}) {
            /memspell ${CastType.Arg[2,-]} "${CastName}"
            /call ChatOut 6 "Memorizing spell: ${CastName} in slot ${CastType.Arg[2,-]}."
         } else {
            /memspell ${SpellGem} "${CastName}"
            /call ChatOut 6 "Memorizing spell: ${CastName} in default slot ${SpellGem}."
         }
         /varset CastTimer 5s
      }
      /return
   }
   /varset CastStep 1
   /varset CastTimer 0
   /return
   | Wait for spell to finish
:gCast-4
   /if (${Me.Casting.ID}) {
      /if (!${Me.Mount.ID} && !${Spawn[${CastTarget} radius ${MaxTargetRange}].ID} && ${CastTarget.NotEqual[0]}) {
         /stopcast
         /varset CastStep 6
         /call ChatOut 3 "Interrupted ${CastType.Arg[1,-]}: ${CastName}.  Target ${NearestSpawn[${CastTarget}].CleanName} died, poofed, or came back to life!"
         /varset CastLastResult SPELL_IntentionalInterruption
         /return
      }
      /if (${Toggle-stopifhealed} && ${CastInfo.Left[1].Equal[heal]} && ${CastTarget.NotEqual[0]}) {


         /if (${Spawn[${CastTarget}].Type.Equal[pet]}) {
            /if (${Spawn[${CastTarget}].PctHPs}>${PetPctHeal}+5) {
               /varset CastStep 6
            }
         } else /if (${TankList.Find[${Spawn[${CastTarget}].Class}]}) {
            /if (${Spawn[${CastTarget}].PctHPs}>${TankPctHeal}+5) {
               /varset CastStep 6
            }
         } else /if (${CasterList.Find[${Spawn[${CastTarget}].Class}]}) {
            /if (${Spawn[${CastTarget}].PctHPs}>${CasterPctHeal}+5) {
               /varset CastStep 6
            }
         }
         /if (${CastStep}==6) {
            /stopcast
            /call ChatOut 3 "Interrupted ${CastType.Arg[1,-]}: ${CastName}.  ${NearestSpawn[${CastTarget}].CleanName} was healed while I was casting!"
            /varset CastLastResult SPELL_IntentionalInterruption
         }
      }
      /return
   }
   /varcalc CastStep ${CastStep}+1
   /return
   | Wait for cast result
:gCast-5
   /if (${CastTimer.OriginalValue}<>2) {
      /varset CastTimer 2
      /return
   }
   /if (${CastTimer}==0) {
      /varset CastTimer 0
      /varcalc CastStep ${CastStep}+1
   }
   /return
   | Delete old spell as cast and update status to successful unless otherwise.
:gCast-6
   /if (${CastLastResult.Equal[CAST_StillCasting]}) /varset CastLastResult CAST_Successful
   /if (${CastInfo.Arg[1,-].Equal} && ${CastInfo.Arg[2,-].NotEqual}) {
      /call BuffResult ${CastType} "${CastName}" "${CastTarget}" ${CastInfo.Arg[2,-]}
   }
   /if (${CastOldTargetID}) /squelch /target id ${CastOldTargetID} radius ${MaxTargetRange}
   /if (${DebugList.Find[spell]}) /echo CastLastResult ${CastLastResult}
   /if (${Toggle-remem} && ${SpellNeedToRemem}) {
      /memspellset ${DefaultSpellSet}
      /call ChatOut 6 "Re-memorizing original spells."
      /varcalc CastStep ${CastStep}+1
      /return
   }
   /call ListDelbyName CastQueue "${CastType};${CastName};${CastTarget};${CastInfo}" |
   /varset CastStep 0
   /if (${Toggle-sitaftercast}) /varset SitTimer ${DelayBeforeSit}
   /return
   | Wait until spells are rememmed to continue
:gCast-7
   /if (${Window[SpellBookWnd].Open}) /return
   /call ChatOut 6 "Done memorizing original spells."
   /varset SpellNeedToRemem 0
   /if (${Toggle-sitaftercast}) /varset SitTimer ${DelayBeforeSit}
   /call ListDelbyName CastQueue "${CastType};${CastName};${CastTarget};${CastInfo}" |
   /varset CastStep 0
/return

Sub AssignCastTarget(string ACTarget)
   /if (!${Defined[ACTarget]} || !${ACTarget.Length} || ${ACTarget.Equal[0]}) {
      /if (${CastStep}==1 || ${Me.Casting.ID}) {
         /return assist-
      } else {
         /call Assist ${MasterName}
         /if (${Target.ID}) {
            /return id ${Target.ID}
         } else {
            /call ChatOut 4 "Unable to /assist you to find a target to cast on."
            /return 0
         }
      }
   } else /if (${ACTarget.Equal[yourself]} || ${ACTarget.Equal[${Me.CleanName}]}) {
      /return pc ${Me.CleanName}
   } else /if (${ACTarget.Equal[me]} || ${ACTarget.Equal[${MasterName}]}) {
      /return pc ${MasterName}
   }
/return ${ACTarget}

Sub CheckCann
   /if (!${Me.Moving}) {
      /if (${Me.CurrentMana}<${Me.MaxMana}-1066 && ${Me.CurrentHPs}>${Me.MaxHPs}\5+1924 && ${Me.AltAbilityReady[Cannibalization]} && ${CannTimer}<=0) {
         /alt activate 47
       /varset CannTimer 5
      }
      /if (${Me.PctHPs}<70 && !${Me.Buff[${CanniHoT}].ID} && ${Me.Book[${CanniHoT}]}) {
         /if (${DebugList.Find[spell]}) /echo CheckCann "${CanniHoT}" "${Me.Name}"
         /call AddCast "${CanniHoT}" ${Me.Name} buff
       /varset CannTimer 1
         /return
      }
      /if (${Me.PctMana}<95 && ${Me.PctHPs}>=${CanniLimit} && ${Me.SpellReady["${CanniSpell}"]} && ${CannTimer}<=0 && !${CastQueue.Length}) {
         /call AddCast "${CanniSpell}" ${Me.Name} buff
         /varset CannTimer 1
      }
   }
/return

Sub CheckMana
   /if (${LomTimer}<=0) {
      /if (${Me.PctMana}<${LomPct}) {
         /call ChatOut 5 "${LomMsg}"
         /varset LomTimer 2m
      }
   }
/return

Sub CheckYaulp
   /if (!${Me.Moving}) {
      /if ((${Me.PctMana}<95 || ${CombatTargetID}) && !${Me.Buff["${YaulpSpell}"].ID} && ${Me.SpellReady["${YaulpSpell}"]}) {
         /if (${DebugList.Find[spell]}) /echo CheckYaulp "${YaulpSpell}" "${Me.Name}"
         /call AddCast "${YaulpSpell}" ${Me.Name} buff
      }
   }
/return

Sub NextStun
   /if (!${Target.ID}) /return
   :JumpStunSpell
      /if (${Me.Gem[${ChainStun.Arg[${ChainStunNum},|]}]}) {
         /cast "${ChainStun.Arg[${ChainStunNum},|]}"
         /varset ChainStunTime 50
      } else {
         /varcalc ChainStunNum ${ChainStunNum}+1
         /goto :JumpStunSpell
      }
   /varcalc ChainStunNum ${ChainStunNum}+1
   /if (!${ChainStun.Arg[${ChainStunNum},|].Length}) /varset ChainStunNum 1
/return

Sub RefineCast(string RCText)
   /declare RCType string local ${RCText.Arg[1]}
   /declare RCName string local ${RCText.Right[-${RCType.Length}]}
   /declare GemList string local gem1 gem2 gem3 gem4 gem5 gem6 gem7 gem8 gem9
   /if (${GemList.Find[ ${RCType.Lower} ]}) {
      /varset RCType spell-${RCType.Right[1]}
      /varset RCName ${RCName.Right[-${RCName.Arg[1].Length}]}
   }
   /if (${RCType.Arg[1,-].Equal[spell]}) {
      /if (!${Int[${Me.Book[${RCName}]}]}) {
         /call ChatOut 3 "Spell: ${RCName} not found in your book."
         /return 0
      }
      /return ${RCType};${Spell[${RCName}]}
   }
   /if (${RCType.Equal[slot]}) {
      /varset RCType item-${RCName.Arg[1]}
      /varset RCName ${RCName.Right[-${RCName.Arg[1].Length}]}
   }
   /if (${RCType.Arg[1,-].Equal[item]}) {
      /if (!${FindItem[${RCName}].InvSlot}) {
         /call ChatOut 3 "Cannot find item: ${RCText} "
         /return 0
      }
      /return ${RCType};${FindItem[${RCName}]}
   }
   /if (${RCType.Equal[alt]}) {
      /if (!${AltAbility[${RCName}].ID}) {
         /call ChatOut 3 "Do not understand Alt Ability: ${RCText} "
         /return 0
      }
      /return ${RCType};${AltAbility[${RCName}]}
   }
   /if (!${Me.Book[${RCText}]}) {
      /if (${DebugList.Find[spell]}) /echo Name |${RCText}|
      /call ChatOut 3 "Spell: ${RCText} not found in your book."
      /return 0
   }
/return spell;${Spell[${RCText}]}

Sub RefineTarget(string RFTarget)
   /if (${RFTarget.Equal[assist-]}) /return assist-
   /if (${NearestSpawn[pc ${RFTarget} radius ${MaxTargetRange}].ID}) {
      /varset RFTarget pc ${NearestSpawn[pc ${RFTarget}].Name}
   } else {
      /varset RFTarget ${NearestSpawn[${RFTarget}].Type} id ${NearestSpawn[${RFTarget}].ID}
   }
/return ${RFTarget}

|||| Events
Sub Event_CastFizzle
   /if (${CastStep}) {
      /varset CastStep 0
      /varset CastLastResult CAST_Fizzled
   }
/return

Sub Event_CastInterrupt
   /if (${CastStep} && !${CastLastResult.Equal[SPELL_IntentionalInterruption]}) {
      /varset CastStep 0
      /varset CastLastResult CAST_Interrupted
   }
/return

Sub Event_CastNoMana
   /if (${CastStep}) {
      /varset CastLastResult CAST_CastNoMana
      /if (${IsPally}) {
         /varset CastLastResult CAST_CastNoMana
         /if (${CastTimer}==0) {
            /call ChatOut 5 "${MasterName} I am OOM!"
            /varset CastTimer 10s
            /return
         }
      }
      /call ChatOut 5 "OOM. Medding 13 seconds and trying again. "
      /if (!${Me.Sitting} && !${DoMelee}) /sit
      /varset CastTimer 13s
   }
/return

Sub Event_CastResist
   /if (${CastStep}) {
      /varset CastStep 6
      /if (${CastLastResult.Equal[CAST_StillCasting]}) {
         /varset CastLastResult CAST_Resisted
         /call ChatOut 3 "${Target.CleanName} resisted ${CastType} ${CastName}."
      }
   }
/return

Sub Event_CastTooFar
   /if (${CastStep}) {
      /call ChatOut 3 "${NearestSpawn[${CastTarget}]} is out of range"
      /varset CastStep 6
      /varset CastLastResult CAST_CastTooFar
   }
/return

Sub Event_Collapse
   /if (${CastStep}) {
      /varset CastStep 0
   }
/return

Sub Event_Distracted
   /if (${CastStep}) {
      /call ChatOut 5 "I can't cast. I'm too distracted. "
      /varset CastStep 6
      /varset CastLastResult CAST_Distracted
   }
/return

Sub Event_ImmuneRoot
   /if (${CastStep}) {
      /call ChatOut 3 "Cannot Root or Snare this Target!"
      /varset CastStep 6
      /varset CastLastResult CAST_ImmuneRoot
   }
/return

Sub Event_ImmuneSlow
   /if (${CastStep}) {
      /call ChatOut 3 "Cannot Slow this Target (Immune)!"
      /varset CastStep 6
      /varset CastLastResult CAST_ImmuneSlow
   }
/return

Sub Event_MissedNote
   /if (${CastStep}) {
      /varset CastStep 0
   }
/return

Sub Event_NoLOS
   /if (${CastStep} && ${CastStep}!=6) {
      /call ChatOut 3 "I can't see my target. "
      /varset CastStep 6
      /varset CastLastResult CAST_NoLOS
   }
/return

Sub Event_NoMem
   /if (${CastStep}) {
      /call ChatOut 5 "That spell is not memed. "
      /varset CastStep 0
      /varset CastLastResult CAST_NoMem
   }
/return

Sub Event_NoOverWrite
   /if (${CastStep}) {
      /call ChatOut 3 "The spell won't take hold on the target."
      /varset CastStep 6
      /varset CastLastResult CAST_NoOverWrite
   }
/return

Sub Event_NoTarget
   /if (${CastStep}) {
      /call ChatOut 3 "I don't know what target to cast on. "
      /varset CastStep 6
      /varset CastLastResult CAST_NoTarget
   }
/return

Sub Event_Recovered
      /varset CastStep 0
   /if (${CastStep}) {
      /varset CastLastResult CAST_Recovered
   }
/return

Sub Event_RootOff
   /call ChatOut 5 "Root has worn off. "
/return

Sub Event_Sitting
   /if (${CastStep}) {
      /varset CastStep 0
      /varset CastLastResult CAST_NotStanding
   }
/return

Sub Event_Stunned
   /if (${CastStep}) {
      /call ChatOut 5 "I'm STUNNED. Waiting a second to try again."
      /varset CastStep 0
      /varset CastTimer 1s
      /varset CastLastResult CAST_Stunned
   }
/return

Sub Event_WornOff(string WornOffText, string WornOffSpell, string WornOffTarget)
   
/return
 
Last edited:
Anyone Have a Working Genbot?

Users who are viewing this thread

Back
Top