Skill_Routines.inc
Posted: Mon Aug 23, 2004 4:30 pm
I was originally writing this to actually go in a macro, but I thought it would be a lot better to just expand the scope of it and make it an .inc file.
To expound on the description in the file, this include will let you choose any of 15 skills which you'd like to auto-fire whenever they are available and the conditions are right. For instance, if you turn on Kick, then whenever you are in combat, within 15 units of your target, you are targetting something other than yourself, and the ability is ready, it will auto-kick. If any of those conditions are not met, it will wait (to save from error messages). It will not hurt you to turn them all on, if you don't have the skill but have it turned on, it will just skip it.
I included every button skill except for some obvious ones like Bind Wound and Sneak (Evade is used instead of Hide), and the lower level monk skills (if there is any interest I can add them easily).
In addition to being able to just include it in any macro you run all the time, macro coders can use this to call skills similar to Spell_Routines.inc. Just type /call [skill], and it will fire the skill if all of the conditions check out.
I could probably code this a little cleaner, but the formatting should be presentable enough that anyone who needs to can go in there and edit things how they need them. Any feedback would be appreciated on what tweaks need to be made.
As a forewarning, I play a Beastlord, so have only been able to test Begging and Kick. The rest of the skills *should* work though, but I have not been able to test them personally. I played a rogue a long time ago on a different account (sold) so I believe I've got the rogue stuff down the way it should be, but need some input.
Some things I'd like to add in is sneak attacks for rogues, and checking to see if you are stunned before doing things that, well, you can't do while stunned.
You WILL need the associated .ini file, to toggle the autofiring skills, if you want to use the autofire section of the include.
Update 1.1.1: Added more check code (added the new forage code [also added it to begging], and a stun check on many combat skills. Added the enrage code, and hitbox-changing on the fly code (obviously only runs if you use the Skill_Routines sub in an unending loop in your macro). Retweaked the entire skill check code, should run faster. As before, my preliminary testing has shown everything fine, but I can't test the rogue, monk, forage, or bash/slam code myself.
Update 1.1.2: Added check code for spell book being open on forage code. Also added an option for popups on events (enrage and hitbox change), but it defaults to FALSE in the ini - change it if you like popups all over your screen.
Without further ado -
Skill_Routines.inc
Skill_Routines.ini:
To expound on the description in the file, this include will let you choose any of 15 skills which you'd like to auto-fire whenever they are available and the conditions are right. For instance, if you turn on Kick, then whenever you are in combat, within 15 units of your target, you are targetting something other than yourself, and the ability is ready, it will auto-kick. If any of those conditions are not met, it will wait (to save from error messages). It will not hurt you to turn them all on, if you don't have the skill but have it turned on, it will just skip it.
I included every button skill except for some obvious ones like Bind Wound and Sneak (Evade is used instead of Hide), and the lower level monk skills (if there is any interest I can add them easily).
In addition to being able to just include it in any macro you run all the time, macro coders can use this to call skills similar to Spell_Routines.inc. Just type /call [skill], and it will fire the skill if all of the conditions check out.
I could probably code this a little cleaner, but the formatting should be presentable enough that anyone who needs to can go in there and edit things how they need them. Any feedback would be appreciated on what tweaks need to be made.
As a forewarning, I play a Beastlord, so have only been able to test Begging and Kick. The rest of the skills *should* work though, but I have not been able to test them personally. I played a rogue a long time ago on a different account (sold) so I believe I've got the rogue stuff down the way it should be, but need some input.
Some things I'd like to add in is sneak attacks for rogues, and checking to see if you are stunned before doing things that, well, you can't do while stunned.
You WILL need the associated .ini file, to toggle the autofiring skills, if you want to use the autofire section of the include.
Update 1.1.1: Added more check code (added the new forage code [also added it to begging], and a stun check on many combat skills. Added the enrage code, and hitbox-changing on the fly code (obviously only runs if you use the Skill_Routines sub in an unending loop in your macro). Retweaked the entire skill check code, should run faster. As before, my preliminary testing has shown everything fine, but I can't test the rogue, monk, forage, or bash/slam code myself.
Update 1.1.2: Added check code for spell book being open on forage code. Also added an option for popups on events (enrage and hitbox change), but it defaults to FALSE in the ini - change it if you like popups all over your screen.
Without further ado -
Skill_Routines.inc
Code: Select all
|Skill_Routines.inc
|By Kambic
|Version 1.1.2
|August 25th, 2004
|Required Files: Skill_Routines.inc, Skill_Routines.ini
|
|Description: Skill_Routines has two features. The first is that you
|can use it to auto-fire any skill that you like (provided it is
|in the .ini file). Edit your .ini file and mark any skill TRUE
|which you would like to fire automatically, and leave skills as
|FALSE which you do not (if you don't have the skill, obviously
|it won't try). The skills are already divided up into non-combat,
|combat, and anytime skills and will fire appropriately. All you need
|to do is include this file your macro, and somewhere in the main loop
|put "/call Skill_Routines".
|
|The second feature is the ability to manually call skills in your
|macro whenever you want. Include this file in your macro, and then
|when you want to use a skill, use "/call [Skill]" (example:
|"/call Mend"). If all of the proper conditions exist, the skill will
|fire, otherwise it will skip.
|
|You can use "/echo Hitbox [distance]" to change the hitbox check
|on the fly now.
|
|Toggle EnrageAttackOff in the .ini file to decide if you want the
|Enrage-watching code to run also.
|
|Added a toggle for popups for events (enrage on, enrage off, hitbox change).
|I hate verbosity, so the default is FALSE in the .ini.
|
|(A special thanks to Jerle69 for the backstab "behind check" code from RH.)
#event EnrageOn "#1# has become ENRAGED#*#"
#event EnrageOff "#1# is no longer enraged#*#"
#event HitboxChange "[MQ2] Hitbox #1#"
Sub Skill_Routines
/if (${Ini[Skill_Routines.ini,Skills,Backstab]}) /call AutoBackstab
/if (${Ini[Skill_Routines.ini,Skills,Bash]}) /call AutoBash
/if (${Ini[Skill_Routines.ini,Skills,Begging]}) /call AutoBegging
/if (${Ini[Skill_Routines.ini,Skills,Disarm]}) /call AutoDisarm
/if (${Ini[Skill_Routines.ini,Skills,Evade]}) /call AutoEvade
/if (${Ini[Skill_Routines.ini,Skills,FeignDeath]}) /call AutoFeignDeath
/if (${Ini[Skill_Routines.ini,Skills,FlyingKick]}) /call AutoFlyingKick
/if (${Ini[Skill_Routines.ini,Skills,Forage]}) /call AutoForage
/if (${Ini[Skill_Routines.ini,Skills,Intimidation]}) /call AutoIntimidation
/if (${Ini[Skill_Routines.ini,Skills,Kick]}) /call AutoKick
/if (${Ini[Skill_Routines.ini,Skills,Mend]}) /call AutoMend
/if (${Ini[Skill_Routines.ini,Skills,PickPockets]}) /call AutoPickPockets
/if (${Ini[Skill_Routines.ini,Skills,SenseTraps]}) /call AutoSenseTraps
/if (${Ini[Skill_Routines.ini,Skills,Slam]}) /call AutoSlam
/if (${Ini[Skill_Routines.ini,Skills,Taunt]}) /call AutoTaunt
/return
||=======================||
||-A-U-T-O---S-K-I-L-L-S-||
||=======================||
Sub AutoBackstab
/if (! ${Me.AbilityReady["Backstab"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]) /return
/if (if[${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})}]) /return
/declare BehindIt bool local FALSE
/declare Dir float local
/for i -1 to 1
/varcalc Dir (${Target.Heading.Clock}+${i})%12
/if (${Dir}<1) /varcalc Dir ${Dir}+12
/if (${Dir}>12) /varcalc Dir ${Dir}-12
/if (${Dir} == ${Me.Heading.Clock}) /varset BehindIt TRUE
/next i
/face fast nolook
/if (! ${BehindIt}) /return
/doability "Backstab"
/return
Sub AutoBash
/if (! ${Me.AbilityReady["Bash"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[$Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/if (${String[${InvSlot[offhand].Item.Type}].NotEqual["Shield"]}) /return
/if (${Me.Casting}) /return
/face fast nolook
/doability "Bash"
/return
Sub AutoBegging
/if (! ${Me.AbilityReady["Begging"]}) /return
/if (${Window[BigBankWnd].Open}) /return
/if (${Merchant.Open}) /return
/if (${Window[TradeWnd].Open}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/if (${Me.Casting}) /return
/declare CombatBefore bool local FALSE
/if (${Me.Combat}) {
/varset CombatBefore TRUE
/attack off
/delay 1
}
/doability "Begging"
/if (${CombatBefore}) /attack on
/return
Sub AutoDisarm
/if (! ${Me.AbilityReady["Disarm"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Disarm"
/if (${Cursor.ID}) /autoinv
/return
Sub AutoEvade
/if (! ${Me.AbilityReady["Hide"]}) /return
/if (! ${Me.Class["Rogue"]}) /return
/if (! ${Me.Combat}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/if (! ${Me.Speed}==0)) /return
/attack off
/delay 1
/doability "Hide"
/delay 1
/face fast nolook
/attack on
/return
Sub AutoFeignDeath
/if (! ${Me.AbilityReady["Feign Death"]}) /return
/if (! ${Me.Combat}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/delay 3s
/attack off
/delay 1
/doability "Feign Death"
/delay 1
/if (! ${Me.Standing}) /stand
/face fast nolook
/attack on
/return
Sub AutoFlyingKick
/if (! ${Me.AbilityReady["Flying Kick"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Flying Kick"
/return
Sub AutoForage
/if (! ${Me.AbilityReady["Forage"]}) /return
/if (${Window[BigBankWnd].Open}) /return
/if (${Merchant.Open}) /return
/if (${Window[TradeWnd].Open}) /return
/if (${Window[SpellBookWnd].Open}) /return
/if (${Me.Stunned}) /return
/declare SittingBefore bool local FALSE
/declare CombatBefore bool local FALSE
/if (${Me.Sitting}) {
/varset SittingBefore TRUE
/stand
}
/if (${Me.Combat}) {
/varset CombatBefore TRUE
/attack off
/delay 1
}
:emptycursor
/if (${Cursor.ID}) {
/autoinv
/goto :emptycursor
}
/doability "Forage"
|If you want some custom foraging check code, put it in between here yourself :)
/if (${Cursor.ID}) /autoinv
|If you want some custom foraging check code, put it in between here yourself :)
/if (${SittingBefore}) /sit
/if (${CombatBefore}) /attack on
/return
Sub AutoIntimidation
/if (! ${Me.AbilityReady["Intimidation"]}) /return
/if (! ${Me.Combat}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/doability "Intimidation"
/return
Sub AutoKick
/if (! ${Me.AbilityReady["Kick"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Kick"
/return
Sub AutoMend
/if (! ${Me.AbilityReady["Mend"]}) /return
/if (${Me.PctHPs}>80) /return
/doability Mend
/return
Sub AutoPickPockets
/if (! ${Me.AbilityReady["Pick Pockets"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/attack off
/delay 1
/doability "Pick Pockets"
/delay 1
/if (${Cursor.ID}) /autoinv
/face fast nolook
/attack on
/return
Sub AutoSenseTraps
/if (! ${Me.AbilityReady["Sense Traps"]}) /return
/doability "Sense Traps"
/return
Sub AutoSlam
/if (! ${Me.AbilityReady["Slam"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Slam"
/return
Sub AutoTaunt
/if (! ${Me.AbilityReady["Taunt"]}) /return
/if (! ${Me.Combat}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Taunt"
/return
||=======================||
||-C-A-L-L---S-K-I-L-L-S-||
||=======================||
Sub Backstab
/if (! ${Me.AbilityReady["Backstab"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]) /return
/if (if[${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})}]) /return
/declare BehindIt bool local FALSE
/declare Dir float local
/for i -1 to 1
/varcalc Dir (${Target.Heading.Clock}+${i})%12
/if (${Dir}<1) /varcalc Dir ${Dir}+12
/if (${Dir}>12) /varcalc Dir ${Dir}-12
/if (${Dir} == ${Me.Heading.Clock}) /varset BehindIt TRUE
/next i
/face fast nolook
/if (! ${BehindIt}) /return
/doability "Backstab"
/return
Sub Bash
/if (! ${Me.AbilityReady["Bash"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[$Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/if (${String[${InvSlot[offhand].Item.Type}].NotEqual["Shield"]}) /return
/if (${Me.Casting}) /return
/face fast nolook
/doability "Bash"
/return
Sub Begging
/if (! ${Me.AbilityReady["Begging"]}) /return
/if (${Window[BigBankWnd].Open}) /return
/if (${Merchant.Open}) /return
/if (${Window[TradeWnd].Open}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/if (${Me.Casting}) /return
/declare CombatBefore bool local FALSE
/if (${Me.Combat}) {
/varset CombatBefore TRUE
/attack off
/delay 1
}
/doability "Begging"
/if (${CombatBefore}) /attack on
/return
Sub Disarm
/if (! ${Me.AbilityReady["Disarm"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Disarm"
/if (${Cursor.ID}) /autoinv
/return
Sub Evade
/if (! ${Me.AbilityReady["Hide"]}) /return
/if (! ${Me.Class["Rogue"]}) /return
/if (! ${Me.Combat}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/if (! ${Me.Speed}==0)) /return
/attack off
/delay 1
/doability "Hide"
/delay 1
/face fast nolook
/attack on
/return
Sub FeignDeath
/if (! ${Me.AbilityReady["Feign Death"]}) /return
/if (! ${Me.Combat}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/delay 3s
/attack off
/delay 1
/doability "Feign Death"
/delay 1
/if (! ${Me.Standing}) /stand
/face fast nolook
/attack on
/return
Sub FlyingKick
/if (! ${Me.AbilityReady["Flying Kick"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Flying Kick"
/return
Sub Forage
/if (! ${Me.AbilityReady["Forage"]}) /return
/if (${Window[BigBankWnd].Open}) /return
/if (${Merchant.Open}) /return
/if (${Window[TradeWnd].Open}) /return
/if (${Window[SpellBookWnd].Open}) /return
/if (${Me.Stunned}) /return
/declare SittingBefore bool local FALSE
/declare CombatBefore bool local FALSE
/if (${Me.Sitting}) {
/varset SittingBefore TRUE
/stand
}
/if (${Me.Combat}) {
/varset CombatBefore TRUE
/attack off
/delay 1
}
:emptycursor
/if (${Cursor.ID}) {
/autoinv
/goto :emptycursor
}
/doability "Forage"
|If you want some custom foraging check code, put it in between here yourself :)
/if (${Cursor.ID}) /autoinv
|If you want some custom foraging check code, put it in between here yourself :)
/if (${SittingBefore}) /sit
/if (${CombatBefore}) /attack on
/return
Sub Intimidation
/if (! ${Me.AbilityReady["Intimidation"]}) /return
/if (! ${Me.Combat}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/doability "Intimidation"
/return
Sub Kick
/if (! ${Me.AbilityReady["Kick"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Kick"
/return
Sub Mend
/if (! ${Me.AbilityReady["Mend"]}) /return
/if (${Me.PctHPs}>80) /return
/doability Mend
/return
Sub PickPockets
/if (! ${Me.AbilityReady["Pick Pockets"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/attack off
/delay 1
/doability "Pick Pockets"
/delay 1
/if (${Cursor.ID}) /autoinv
/face fast nolook
/attack on
/return
Sub SenseTraps
/if (! ${Me.AbilityReady["Sense Traps"]}) /return
/doability "Sense Traps"
/return
Sub Slam
/if (! ${Me.AbilityReady["Slam"]}) /return
/if (! ${Me.Combat}) /return
/if (${Me.Stunned}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Slam"
/return
Sub Taunt
/if (! ${Me.AbilityReady["Taunt"]}) /return
/if (! ${Me.Combat}) /return
/if (! ${Target.ID}) /return
/if (${Target.CleanName.Equal[${Me}]}) /return
/if (${Target.Distance}>(${Ini[Skill_Routines.ini,Options,Hitbox]})) /return
/face fast nolook
/doability "Taunt"
/return
||=============||
||-E-V-E-N-T-S-||
||=============||
Sub Event_EnrageOn(ChatText,EnragedMob)
/if (! ${Ini[Skill_Routines.ini,Options,EnrageAttackOff]}) /return
/if (${Target.CurrentHPs}>10) /return
/if (${Target.CleanName} == ${EnragedMob})
/if (${Ini[Skill_Routines.ini,Options,Popus]}) /popup ${Target.CleanName} enraged :: Autoattack OFF
/attack off
/return
Sub Event_EnrageOff(ChatText,EnragedMob)
/if (! ${Ini[Skill_Routines.ini,Options,EnrageAttackOff]}) /return
/if (${Target.CurrentHPs}>10) /return
/if (${Target.CleanName} == ${EnragedMob})
/if (${Ini[Skill_Routines.ini,Options,Popus]}) /popup ${Target.CleanName} un-enraged :: Autoattack ON
/attack on
/return
Sub Event_HitboxChange(ChatText,NewHitbox)
/ini "Skill_Routines.ini" "Options" "Hitbox" "${NewHitbox}"
/echo Changed Hitbox to ${NewHitbox}.
/if (${Ini[Skill_Routines.ini,Options,Popus]}) /popup Hitbox changed to ${NewHitBox}
/returnCode: Select all
;Read the description in Skill_Routines.inc for instructions.
[Skills]
Backstab=FALSE
Bash=FALSE
Begging=FALSE
Disarm=FALSE
Evade=FALSE
FeignDeath=FALSE
FlyingKick=FALSE
Forage=FALSE
Intimidation=FALSE
Kick=FALSE
Mend=FALSE
PickPockets=FALSE
SenseTraps=FALSE
Slam=FALSE
Taunt=FALSE
[Options]
EnrageAttackOff=TRUE
HitBox=15
Popups=FALSE