Page 1 of 1

Updating/modifying Eryi's berserker macro

Posted: Thu Mar 24, 2005 2:37 pm
by 3ball
I'm modifying Eryi's macro, found at http://macroquest2.com/phpBB2/viewtopic.php?t=9147

I'm mostly just toying with macros myself, to get a better understanding of feeding parameters and some of the better approaches (and worse) towards accomplishing tasks. My error correction code is non-existent, I know. I'm still working on getting things to run if you give it the right data first! I've also looked at using the /stick command from moveutils instead of the code he's got in it. Any opinions between the two?

(stick.mac code is in Eryi's link, the /stick code can be referenced from [[MQ2MoveUtils]] )

I removed the autoloot corpse options, and tried to just move frenzy as a default option instead of a requested option. I also tried (several different ways) to implement my journeyman's boots to be clicked during combat. I know it will click em even indoors; I'll fix that later. I added the level 66 axe, "Axe of the Destroyer" to the zerker_axes.ini, same format as the others.

My problem is as follows. The macro no longer attacks NPCs, so obviously I've broken the stick code. I hit attack, and it just swings once, and ends combat mode. With that broken, I can't tell if my ability "Frenzy" works at all! Ranged combat appears to be fine. It also stopped summoning Ranged Axes, god knows why. I imagine the jboots during combat is linked to this as well.

Can anyone see why my attack stops working? and why axes are no longer summoned?
|zerker.mac
|By Eryi
|Modified by 3ball
|
| This is a Berzerker "Wrapper" Macro. This macro contains some of the Close-Combat code
| from m0nk's Stick.mac, altered slightly to work in this setting. The melee settings have
| been adjusted to always frenzy. I've yet to find a reason not to frenzy if I'm going to melee.
|
| Also modified the Stick.mac code to work with Ranged-Only attacks, with Auto-summoning of Throwing Axes if you
| run out. It should Auto-Inv the axes and continue with the combat. It does it's best to determine your highest
| level throwing axe and will use that one.
|
| Throwing range can be adjusted by the RangedDistance variable.
| Melee range can be adjusted by the DefaultMeleeDistance variable.
|
|
| USAGE: /mac zerker close <Frenzy>
|
| Example: /mac zerker close 0
| Will engage close combat, will not Frenzy
| frenzy defaults to 1 (frenzy on)
|
|
| USAGE: /mac zerker ranged <AutoFollow NPC>
|
| Example: /mac zerker ranged
| Will engage ranged combat and attempt to keep you at the RangedDistance
| Example: /mac zerker ranged 0
| Will engage ranged combat and remain stationary
|
| Will turn on the ranged attacks ONLY - Use your Auto-Attack key to toggle it Engaged/Disengaged.
| Ranged combat will stay at or near RangedDistance unless you tell it not to AutoFollow.
| Ranged AutoFollow NPC is turned *ON* by Default.
|

#turbo 40
#Event DiscInter "#*#Your Combat ability is interrupted.#*#"
#Event NoComps "#*#You are missing some #*# Axe Components"
#Event NoRanged "#*#You do not have a ranged weapon equipped#*#"
#Event slain "#*#You have slain#*#"
#Event slain "#*#has been slain by#*#"
#Event RageON "#*#has become ENRAGED.#*#"
#Event RageOFF "#*#is no longer enraged#*#"
#Event MobGate "#*# Gates.#*#"
#Event Invited "#*#To join the group, click on the 'FOLLOW' option, or 'DISBAND' to cancel#*#"
#Event StunON "#*#You are stunned#*#"
#Event StunON "#*#You lose control of yourself!#*#"
#Event StunOFF "#*#You are unstunned#*#"
#Event StunOFF "#*#You have control of yourself again.#*#"

Sub Main

/declare axeType outer
/declare pLevel int outer ${Me.Level}
/declare pMax_Level int outer 70
/declare ini_file outer
/declare newpMax_Level int outer
/declare combat_type string outer
/declare OpenCorpse outer
/declare MobID outer
/declare RangedDistance outer
/declare Use_Follow outer

| Set this to the Maximum Level you can obtain (as controlled by expansions you have)
/varset pMax_Level 70
/varset RangedDistance 120

/echo Toggling Auto-Attack on Assist Off
/assist off

/if (!${Defined[Param0]}) {
/echo Please choose your Combat Type: Ranged or Close
/echo USAGE: /macro zerker.mac Close <DoFrenzy>
/echo USAGE: /macro zerker.mac Ranged <AutoFollow NPC>
/echo NOTE: AutoFollow NPC is *ON* By Default
/endmacro
} else {
/if (${Param0.Equal["Ranged"]}) {
/echo Range Attacks selected.
/if (!${Defined[Param1]}) {
/declare ParamSet outer
/varset ParamSet 1
} else {
/declare ParamSet outer
/varset ParamSet ${Param1}
}}
/call Find_Axe
/call Ranged_Entry
} else {
/if (${Param0.Equal["Close"]}) {
/echo Close Combat selected.
/if (!${Defined[Param1]}) {
/declare ParamSet outer
/varset ParamSet 1
} else {
/declare ParamSet outer
/varset ParamSet ${Param1}
}}
/call Close_combat
}
}
/endmacro

Sub clickBoots
/if (!${Me.Buff[Bootstrutter's Blessing].ID} && !${Me.Buff[Spirit of Wolf].ID} && !${Me.Buff[Spirit of Eagle].ID}) {
/cast item "Fabled Journeyman's Boots"
/return

Sub Find_Axe
| Find the highest level throwing axe you current can both have AND use.
| Compensates for the 2 level 65 axes by seeing if you have the Tainted
| Axe of Hatred first, and if you do, will use it over the Deathfury's
| Axe This should be frontwards compatible with future expansions.

:pMax_LevelLoop
/if (${pLevel}>=${pMax_Level}) {
/if (${pMax_Level}==65) {
/if (!${Me.CombatAbility[Tainted Axe of Hatred].Equal[NULL]}) {
/varset pMax_Level 651
} else {
/varset pMax_Level 652
}

|-----------------------------------------
| Below adds the correct axe, based on zerker_axes.ini and your level.
|-----------------------------------------
}
/varset axeType ${Ini["zerker_axes.ini","Axes",${pMax_Level},1]}
/if (${axeType.Equal[NULL]}) {
/echo Problem loading the zerker_axes.ini file.
/endmacro
}

/if (${Me.CombatAbility[${axeType}]}==NULL) {
/varset newpMax_Level ${Math.Calc[${pMax_Level}-5]}
/varset pMax_Level ${newpMax_Level}
/goto :pMax_LevelLoop
}
} else {
/varset newpMax_Level ${Math.Calc[${pMax_Level}-5]}
/varset pMax_Level ${newpMax_Level}
/goto :pMax_LevelLoop
}
/echo Highest Level Axe Found was ${axeType}
/return

|-----------------------------------------
| Below is the close combat subroutine, called from the close flag when you load the macro.
|-----------------------------------------

Sub Close_Combat
:setDeclares
/declare PCini outer
/declare NPCini outer
/declare CharX outer
/declare CharY outer
/declare MOBini outer
/declare DoFrenzy outer
/declare MeleeDistance outer
/declare DefaultMeleeDistance outer

:setGenericVars
/varset PCini stick-pc.ini
/varset NPCini stick-npc.ini

:setParams
/if (${Defined[ParamSet]}) {
/if (${ParamSet}==TRUE) {
/echo Set to Frenzy when available.
/varset DoFrenzy TRUE
} else {
/echo Set to Not Frenzy.
/varset DoFrenzy FALSE
}

:setINIvalues
/varset DefaultMeleeDistance ${Ini[${PCini},${Me.Name},DefaultMeleeDistance]}
/varset DoFrenzy ${Ini[${PCini},${Me.Name},DoFrenzy]}

:StickBegin
/goto :sub_combat_loop

:NewCharacter

/ini "${PCini}" ${Me.Name} DoFrenzy 1
/ini "${PCini}" ${Me.Name} DefaultMeleeDistance 13

/ini "${PCini}" ${Me.Name} ClickItem_1 NONE
/ini "${PCini}" ${Me.Name} ClickItemSlot_1 NONE
/ini "${PCini}" ${Me.Name} ClickItemSpell_1 NONE
/ini "${PCini}" ${Me.Name} ClickItem_2 NONE
/ini "${PCini}" ${Me.Name} ClickItemSlot_2 NONE
/ini "${PCini}" ${Me.Name} ClickItemSpell_2 NONE
/ini "${PCini}" ${Me.Name} ClickItem_3 NONE
/ini "${PCini}" ${Me.Name} ClickItemSlot_3 NONE
/ini "${PCini}" ${Me.Name} ClickItemSpell_3 NONE
/ini "${PCini}" ${Me.Name} ClickItem_4 NONE
/ini "${PCini}" ${Me.Name} ClickItemSlot_4 NONE
/ini "${PCini}" ${Me.Name} ClickItemSpell_4 NONE
/ini "${PCini}" ${Me.Name} ClickItem_5 NONE
/ini "${PCini}" ${Me.Name} ClickItemSlot_5 NONE
/ini "${PCini}" ${Me.Name} ClickItemSpell_5 NONE
/ini "${PCini}" ${Me.Name} ClickItem_6 NONE
/ini "${PCini}" ${Me.Name} ClickItemSlot_6 NONE
/ini "${PCini}" ${Me.Name} ClickItemSpell_6 NONE
/ini "${PCini}" ${Me.Name} ClickItem_7 NONE
/ini "${PCini}" ${Me.Name} ClickItemSlot_7 NONE
/ini "${PCini}" ${Me.Name} ClickItemSpell_7 NONE
/ini "${PCini}" ${Me.Name} ClickItem_8 NONE
/ini "${PCini}" ${Me.Name} ClickItemSlot_8 NONE
/ini "${PCini}" ${Me.Name} ClickItemSpell_8 NONE

/ini "${PCini}" ${Me.Name} InstantClickItem_1 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSlot_1 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSpell_1 NONE
/ini "${PCini}" ${Me.Name} InstantClickItem_2 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSlot_2 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSpell_2 NONE
/ini "${PCini}" ${Me.Name} InstantClickItem_3 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSlot_3 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSpell_3 NONE
/ini "${PCini}" ${Me.Name} InstantClickItem_4 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSlot_4 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSpell_4 NONE
/ini "${PCini}" ${Me.Name} InstantClickItem_5 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSlot_5 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSpell_5 NONE
/ini "${PCini}" ${Me.Name} InstantClickItem_6 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSlot_6 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSpell_6 NONE
/ini "${PCini}" ${Me.Name} InstantClickItem_7 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSlot_7 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSpell_7 NONE
/ini "${PCini}" ${Me.Name} InstantClickItem_8 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSlot_8 NONE
/ini "${PCini}" ${Me.Name} InstantClickItemSpell_8 NONE

/echo ${Me.Name} has been added to ${PCini}. Please re-run macro (also go edit ${PCini})
/endmacro

:sub_combat_loop
/if (${Me.Combat}) /call Attack
/doevents
/goto :sub_combat_loop
/return

Sub attack
:attackCheck
/if (!${Target.Type.Equal["NPC"]}) {
/attack off
/return
}
/if (${Target.Distance}>150) /attack off

:attackSetup
/varset MobID ${Target.ID}

:attackPreFight
/call ClearReturn

/varset MeleeDistance ${Ini[${NPCini},${Zone.ShortName},${Target.CleanName}.DistanceMelee]}
/if (${MeleeDistance.Equal[NULL]}) {
/ini "${NPCini}" "${Zone.ShortName}" "${Target.CleanName}.DistanceMelee" "${DefaultMeleeDistance}"
/varset MeleeDistance ${Ini[${NPCini},${Zone.ShortName},${Target.CleanName}.DistanceMelee]}
}

:attackMeleeLoop
/doevents slain
/doevents RageOn
/doevents MobGate
/doevents StunON
/doevents clickBoots
/if (${Target.ID}!=${MobID}) /goto :attackend
/if (${Macro.Return.Equal["EndATK"]}) /goto :attackend
/if (!${Me.Combat}) /goto :attackend
/if (${Target.ID}==${MobID}) /if (!${Me.Casting.ID} && ${Me.FeetWet}) /face fast
/if (${Target.ID}==${MobID}) /if (!${Me.Casting.ID} && !${Me.FeetWet}) /face fast nolook
/if (${Target.ID}==${MobID} && !${Me.Casting.ID}) /if (${Target.Distance}>${MeleeDistance}) /keypress FORWARD HOLD
/if (${Target.ID}==${MobID} && !${Me.Casting.ID}) /if (${Target.Distance}<=${MeleeDistance}) /keypress FORWARD
/if (${Target.ID}==${MobID} && !${Me.Casting.ID}) /if (${Target.Distance}<=${Math.Calc[${MeleeDistance}-5]}) /keypress BACK HOLD
/if (!${DoFrenzy.Equal[NONE]}) /if (!${Me.Casting.ID}) /if (${Target.Distance}<=${MeleeDistance}) /if (${Me.AbilityReady[${Frenzy}]}) /doability ${Frenzy}

:attackend
/varset MobID 0
/attack off
/keypress FORWARD
/return

Sub ClearReturn
/return NULL

Sub event_slain
/if (${Target.CurrentHPs}>0) /return
/keypress FORWARD
/return EndATK

Sub event_RageOn
/if (${Target.CurrentHPs}>15) /return
/if (${Target.CurrentHPs}==0) /return
/if (${Target.ID}==${MobID}) /if (!${Me.Casting.ID}) /keypress FORWARD
/call ClearReturn
/echo Rage On
/attack off
/call ClearReturn

:waitRage
/doevents
/if (${Target.ID}!=${MobID}) /return EndATK
/if (${Macro.Return.Equal["EndATK"]}) /return EndATK
/if (${Macro.Return.Equal["RageOFF"]}) /return
/goto :waitRage

Sub event_RageOFF
/echo Rage OFF
/attack on
/return RageOFF

Sub event_MobGate
/if (${Target.Distance}<100) /return
/echo MOB GATED!
/attack off
/return EndATK

Sub event_Invited
/invite
/return

Sub event_StunON
/doevents flush StunOFF
/call ClearReturn

:LoopStunOFF
/doevents StunOFF
/if (${Macro.Return.Equal["StunOFF"]}) {
/call ClearReturn
/return
}
/goto :LoopStunOFF

Sub event_StunOFF
/return StunOFF

Sub Event_NoRanged
/declare going_back int local 1
/popup Out Of Axes - Attempting to Make ${axeType} and Carry On
/echo Attempting to Make ${axeType}
/attack off
/keypress FORWARD
/delay 1s
/disc ${axeType}
/delay 5s
/doevents NoComps
/if (${Cursor.ID}) /autoinv
/call Ranged_Attack $(going_back)
/return

Sub Ranged_Combat

:sub_combat_loop
/if (${Me.Combat}) /call Ranged_Attack
/doevents
/goto :sub_combat_loop

/return

Sub Ranged_Entry

/echo Setting Minimum Ranged Combat Distance at ${RangedDistance}
/if (${Defined[ParamSet]}) {
/if (${ParamSet}==TRUE) {
/echo Set to Auto-Follow NPC to Keep Distance
/varset Use_Follow TRUE
} else {
/echo Set to Not Auto-Follow NPC to Keep Distance
/varset Use_Follow FALSE
}


:main_ranged_loop
/if (${Me.Combat}) /goto :Call_Ranged_Attack
/goto :main_ranged_loop

:Call_Ranged_Attack
/call Ranged_Attack

/if (${Macro.Return.Equal["EndATK"]}) /goto :main_ranged_loop
/return


Sub Ranged_Attack
/if (${Defined[Param0]}) /goto :attackMeleeLoop
/attack off

:attackCheck
/if (!${Target.Type.Equal["NPC"]}) {
/attack off
/return EndATK
}
/if (${Target.Distance}>300) /return EndATK

:attackSetup
/varset MobID ${Target.ID}

:attackPreFight
/call ClearReturn

:attackMeleeLoop
/doevents StunON
/doevents NoRanged
/if (!${Target.ID}) /goto :attackend
/if (${Target.ID}!=${MobID}) /goto :attackend
/if (${Me.Combat}) {
/attack off
/goto :attackend
}
/if (${Macro.Return.Equal["EndATK"]}) /goto :attackend
/if (${Target.ID}==${MobID}) /if (!${Me.Casting.ID} && ${Me.FeetWet}) /face fast
/if (${Target.ID}==${MobID}) /if (!${Me.Casting.ID} && !${Me.FeetWet}) /face fast nolook
/if (${Use_Follow}) {
/if (${Target.ID}==${MobID} && !${Me.Casting.ID}) /if (${Target.Distance}>${RangedDistance}) /keypress FORWARD HOLD
/if (${Target.ID}==${MobID} && !${Me.Casting.ID}) /if (${Target.Distance}<=${RangedDistance}) /keypress FORWARD
/if (${Target.ID}==${MobID} && !${Me.Casting.ID}) /if (${Target.Distance}<=30) /keypress BACK HOLD
/if (${Target.ID}==${MobID} && !${Me.Casting.ID}) /if (${Target.Distance}>35 && ${Target.Distance}<${RangedDistance}) /keypress BACK
}
/if (${Me.RangedReady}) {
/face
/ranged
}
/goto :attackMeleeLoop

:attackend
/keypress FORWARD
/return EndATK

Sub Event_NoComps
/echo Out of Axe Supplies.

Posted: Thu Mar 24, 2005 2:58 pm
by fearless

Code: Select all

/doevents clickBoots
should be

Code: Select all

/call clickBoots

Re: Updating/modifying Eryi's berserker macro

Posted: Fri May 02, 2025 2:11 pm
by xyilla

Re: Updating/modifying Eryi's berserker macro

Posted: Fri May 02, 2025 2:12 pm
by xyilla

Re: Updating/modifying Eryi's berserker macro

Posted: Fri May 02, 2025 2:13 pm
by xyilla

Re: Updating/modifying Eryi's berserker macro

Posted: Fri May 02, 2025 2:14 pm
by xyilla

Re: Updating/modifying Eryi's berserker macro

Posted: Fri May 02, 2025 2:15 pm
by xyilla