Skill_Routines.inc

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

User avatar
Kambic
a lesser mummy
a lesser mummy
Posts: 74
Joined: Fri May 28, 2004 11:48 am

Skill_Routines.inc

Post by Kambic » 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

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}
/return
Skill_Routines.ini:

Code: 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
Last edited by Kambic on Thu Aug 26, 2004 2:01 am, edited 5 times in total.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Mon Aug 23, 2004 5:08 pm

Shouldn't this section be an INI?

Code: Select all

[Skills] 
;Read the description in Skill_Routines.inc for instructions. 
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
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Mon Aug 23, 2004 5:29 pm

I'm sure that's what he meant.

Just a thought but wouldn't it be better to check through the INI in this part:

Code: Select all

Sub Skill_Routines 
   /call AutoBackstab 
   /call AutoBash 
   /call AutoBegging 
   /call AutoDisarm 
   /call AutoEvade 
   /call AutoFeignDeath 
   /call AutoFlyingKick 
   /call AutoForage 
   /call AutoIntimidation 
   /call AutoKick 
   /call AutoMend 
   /call AutoPickPockets 
   /call AutoSenseTraps 
   /call AutoSlam 
   /call AutoTaunt 
/return 
Would seem to make more sense to me, and would go through it a lot quicker I think.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Mon Aug 23, 2004 6:54 pm

Yeah, that way you could just comment out the ones that you don't want, or can't use. Though I do like INI files for such things as this. Makes it easier to set things up for multiple characters so you don't have to change the macro itself each time. Just one INI file that has a section for each character. At start up, have it check for the ini, then check the ini for the character's settings. If no ini create one. If missing current character add with all skills defaulted on.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

No_Idea_At_All
a lesser mummy
a lesser mummy
Posts: 49
Joined: Sat Aug 07, 2004 11:28 pm

Post by No_Idea_At_All » Mon Aug 23, 2004 10:13 pm

Just something to note

Code: Select all

Sub Forage 
/if (${Me.Ability["Forage"]}) { 
   /if (${Me.AbilityReady["Forage"]}) { 
      /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 you want some custom foraging check code, put it in between here yourself :) 
      /if (${Cursor.ID}) { 
         /autoinv 
         /goto :emptycursor 
      } 
|If you want some custom foraging check code, put it in between here yourself :) 
   /doability "Forage" 
   /if (${Cursor.ID}) /autoinv 
   /if (${SittingBefore}) /sit 
   /if (${CombatBefore}) /attack on 
   } 
} 
/return
As I pointed out in Fabulous1's Generalstuff.mac the macro like this will cause spam and complications while casting, trading, merchant and banking.

Solution I have in my macro

Code: Select all

/if (${Me.AbilityReady["Forage"]} && !${Window[BigBankWnd].Open} && !${Merchant.Open} && !${Window[TradeWnd].Open}) { 
Also

Code: Select all

        /if (${Me.Casting}) { 
            /return
         } 
Although ${Me.Casting} doesn't solve the problem with AA ability casting times, you manage to get rid of most problems.

No_Idea_At_All
a lesser mummy
a lesser mummy
Posts: 49
Joined: Sat Aug 07, 2004 11:28 pm

Post by No_Idea_At_All » Tue Aug 24, 2004 10:28 am

After running my macro (customised forage with the same basis as this one) I've now changed the if to look like this.

Code: Select all

/if (${Me.AbilityReady["Forage"]} && !${Window[BigBankWnd].Open} && !${Merchant.Open} && !${Window[TradeWnd].Open} && !${Window[SpellBookWnd].Open}) {
Added the spellbook window part in becuase I found it very annoying to be sitting down to switch out some spells and suddenly stand up and have the book dissappear (sometimes 1/2 way through memming the spell)

User avatar
Kambic
a lesser mummy
a lesser mummy
Posts: 74
Joined: Fri May 28, 2004 11:48 am

Post by Kambic » Wed Aug 25, 2004 1:39 am

New code posted. If anyone has a complete list of skills that cannot be used while stunned, I'll implement it. For now, I just added it to every skill I knew wouldn't work while stunned, but generally left in the ones I wasn't sure about. If there are any other spam-generating calls, let me know and we'll tidy them up also :)

EDIT: Bah, I missed the spell book window part on forage. I got to hit the sack (3am) but will get it in there tomorrow.

Fabolous1
a ghoul
a ghoul
Posts: 134
Joined: Sun Jun 27, 2004 12:44 am

Post by Fabolous1 » Fri Jul 01, 2005 7:53 pm

Hmm maybe you could add tracking training, should be easy :)
[url=http://www.macroquest2.com/phpBB2/viewtopic.php?t=16277]CastingBuilderMulti.mac (2.2)[/url]
[url=http://www.macroquest2.com/phpBB2/viewtopic.php?p=143350#143350]Generalstuff.mac (6.0)[/url]

Bigguy70
a ghoul
a ghoul
Posts: 85
Joined: Tue Sep 27, 2005 9:08 am

Your slam code won't work

Post by Bigguy70 » Fri Jan 06, 2006 6:50 pm

I haven't tested your script but the format you used doesn't work with slam ability here is code that will work:

Code: Select all

	/if (${Me.Race.Name.Equal[Barbarian]}||${Me.Race.Name.Equal[Troll]}||${Me.Race.Name.Equal[Ogre]}) {
   		/if (${Me.Combat}&&${Me.AltTimerReady}&&!${Me.Casting.ID}&&${Target.ID}&&!${Me.Stunned}&& ${Target.Distance}<15) /doability "111"
   	}
AltTimerReady is the flag for slam and the other skills/abilities that are on the
same cycle.

/doability "111" is the call for doing slam.

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

Post by fearless » Fri Jan 06, 2006 8:20 pm

You can shorten that first like up to something like

Code: Select all

${Select[${Me.Race.ShortName},BAR,TRO,OGR]}
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]

jacensolo
a snow griffon
a snow griffon
Posts: 427
Joined: Wed Feb 14, 2007 8:51 am
Location: Right behind you

redundancy?

Post by jacensolo » Tue Apr 24, 2007 5:48 pm

If I'm reading the code right, the "call" subs are identical to their matching "autoskill" subs. Couldn't you just delete the "autoskill" Subs and have the macro call the skills like this:

Code: Select all

Sub Skill_Routines
/if (${Ini[${Me.CleanName}.ini,Skills,Backstab]}) /call Backstab
/if (${Ini[${Me.CleanName}.ini,Skills,Bash]}) /call Bash
/if (${Ini[${Me.CleanName}.ini,Skills,Begging]}) /call Begging
/if (${Ini[${Me.CleanName}.ini,Skills,Disarm]}) /call Disarm
/if (${Ini[${Me.CleanName}.ini,Skills,Evade]}) /call Evade
/if (${Ini[${Me.CleanName}.ini,Skills,FeignDeath]}) /call FeignDeath
/if (${Ini[${Me.CleanName}.ini,Skills,FlyingKick]}) /call FlyingKick
/if (${Ini[${Me.CleanName}.ini,Skills,Forage]}) /call Forage
/if (${Ini[${Me.CleanName}.ini,Skills,Intimidation]}) /call Intimidation
/if (${Ini[${Me.CleanName}.ini,Skills,Kick]}) /call Kick
/if (${Ini[${Me.CleanName}.ini,Skills,Mend]}) /call Mend
/if (${Ini[${Me.CleanName}.ini,Skills,PickPockets]}) /call PickPockets
/if (${Ini[${Me.CleanName}.ini,Skills,SenseTraps]}) /call SenseTraps
/if (${Ini[${Me.CleanName}.ini,Skills,Slam]}) /call Slam
/if (${Ini[${Me.CleanName}.ini,Skills,Taunt]}) /call Taunt
/return
It seems to me that doing it that way cuts your file size in half, saves you from having to update 2 subs for each skill, and still lets it run the same way. Or is there some coding problem that this would cause?

daw4888
orc pawn
orc pawn
Posts: 15
Joined: Tue Mar 20, 2007 8:40 pm

Post by daw4888 » Thu Nov 15, 2007 2:55 pm

wrong post

aamlord
a lesser mummy
a lesser mummy
Posts: 35
Joined: Wed Feb 07, 2007 3:56 pm

Re: redundancy?

Post by aamlord » Sun Dec 02, 2007 2:09 am

jacensolo wrote:If I'm reading the code right, the "call" subs are identical to their matching "autoskill" subs. Couldn't you just delete the "autoskill" Subs and have the macro call the skills like this:

Code: Select all

Sub Skill_Routines
/if (${Ini[${Me.CleanName}.ini,Skills,Backstab]}) /call Backstab
/if (${Ini[${Me.CleanName}.ini,Skills,Bash]}) /call Bash
/if (${Ini[${Me.CleanName}.ini,Skills,Begging]}) /call Begging
/if (${Ini[${Me.CleanName}.ini,Skills,Disarm]}) /call Disarm
/if (${Ini[${Me.CleanName}.ini,Skills,Evade]}) /call Evade
/if (${Ini[${Me.CleanName}.ini,Skills,FeignDeath]}) /call FeignDeath
/if (${Ini[${Me.CleanName}.ini,Skills,FlyingKick]}) /call FlyingKick
/if (${Ini[${Me.CleanName}.ini,Skills,Forage]}) /call Forage
/if (${Ini[${Me.CleanName}.ini,Skills,Intimidation]}) /call Intimidation
/if (${Ini[${Me.CleanName}.ini,Skills,Kick]}) /call Kick
/if (${Ini[${Me.CleanName}.ini,Skills,Mend]}) /call Mend
/if (${Ini[${Me.CleanName}.ini,Skills,PickPockets]}) /call PickPockets
/if (${Ini[${Me.CleanName}.ini,Skills,SenseTraps]}) /call SenseTraps
/if (${Ini[${Me.CleanName}.ini,Skills,Slam]}) /call Slam
/if (${Ini[${Me.CleanName}.ini,Skills,Taunt]}) /call Taunt
/return
It seems to me that doing it that way cuts your file size in half, saves you from having to update 2 subs for each skill, and still lets it run the same way. Or is there some coding problem that this would cause?
While that would result in a smaller file, not everyone wants to train all skills (especially in public). For example, you'd get suspicious of a monk who constantly falls down while in combat, gets up quickly and turn around quickly. Also some skills like taunt or bash can cause problem if it goes off while you're with a "good" npc (ie hometown npc) and you'd either have to run or risk blowing faction.

The alternative is to simply use only the skill you want by editing the above sub routines or to use the INI file and let the original macro script handle it.

jacensolo
a snow griffon
a snow griffon
Posts: 427
Joined: Wed Feb 14, 2007 8:51 am
Location: Right behind you

Post by jacensolo » Sun Dec 02, 2007 10:20 am

Um.... The original snippet called the same skills, with the same Do I Do This checks. Here's the Bash Subs:

Code: Select all

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 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
They look the same to me. From what I could tell, all the SKILL and AutoSKILL subs were identical. Then the Skill_Routines sub called the Auto subs and you could manually call the normal ones. My change just deleted one set of duplicate subs, and replacing the AutoSKILL names in the Skill_Routines sub with the SKILLNAME subs. All the same checks were in place. You could also leave the Skill_Routines sub the same, and just delete the SKILLNAME subs. My logic was that /call Bash was faster to type than /call AutoBash. Not by much, but worth the 2 seconds to swap the calls in Skill_Routines.

If there is a difference between the AutoSKILL and SKILL subs, can you point it out for me, because I'm missing it. But to me, they looked identical.

Sailor
orc pawn
orc pawn
Posts: 27
Joined: Sun Jul 26, 2009 9:06 pm

Post by Sailor » Tue Aug 11, 2009 8:44 pm

I'm having trouble w/ the backstab part.


I'm using this w/ generalstuff.mac


When I turn backstab on in the ini and run it, i get

Unparsable in calculation: $


Also pickpockets is not putting stuff in inventory

Wish I knew how to fix these myself.

Code: Select all

/if (${Target.CleanName.Equal[${Me}]) /return 
That's missing a } easy fix

I've fixed a few lines of typo in the autobackstab section by copying others in the inc. But there is a part /for i -1 to 1 and thats not working. No clue what it needs to be.