WarSerker Macro

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

Moderator: MacroQuest Developers

superslam
a lesser mummy
a lesser mummy
Posts: 47
Joined: Sat Jan 22, 2005 3:34 pm

WarSerker Macro

Post by superslam » Sat Mar 18, 2006 11:43 am

I saw several people in the same position as me, looking for a good Berserker macro. I box a warrior and zerker a lot of the time, and so I decided to come up with something that would work for either situation. This macro is not an "afk"-ish macro, in terms of how the rogue helper will auto assist and auto attack, etc. This is a macro that activates all the combat features after you click auto attack. It will keep you in range, etc, at that point. Anyway, I hope it helps someone, it has been an evolution, and quite handy for me. (By the way, I put a section in here for monks, per the request of a friend of mine, but this is in NO way a monk macro, no mend or FD or anything in this one for you monks.)


Enjoy.

Code: Select all

|WarSerker.Mac 
| Adapted from Zerker.mac and RH.mac by Superslam 
| 
| This macro is the equivalent of taking two pretty kittens and tossing them into a blender, 
| with nothing but the best of intentions.  I saw things with the RH.mac and the Zerker.mac 
| that I really liked, but there were functions on each that made the other come up lacking. 
| 
| For starters, if you were used to the zerker.mac, then you probably also had a hotkey set 
| for your parameters (i.e. kick, taunt, frenzy, whatever.  I took it upon myself to 
| hardcode the parameters (sort of.) 
| 
| The macro will check your class (if you are a warrior, monk or berserker) and choose the 2 or 
| 3 most likely skills for you and spam as they pop (while in combat).  I also removed the 
| ranged combat portion of the Zerker.mac.  I didn’t see it as useful, as I’ve never used it. 
| I made this macro for me, so I get to pick! 
| 
|  If you are familiar with the RH.mac then you already know about the /iset, /iclick, and 
| /ibounce features.  I merged them into this macro, as well as weapon switching (which I 
| have found to be amazingly useful. 
| 
| USAGE: /macro warserker.mac  
| 
|  I also changed the itemini declaration to something unique if you plan to use 
|  this macro for more than one character you will have to redefine your clickies. 
|  item .ini’s.  That is of course up to you though. 
| 
|    To set up your clickies: 
|      type /iset aliasname keepup/nokeepup "full item name" 
|    example: 
|      /iset gobby keepup "shrunken goblin skull earring" 
|  
| 
|  this will dig out your shrunken goblin skull earring and click it, anytime that 
|  the buff wears off (it also puts it away after the spell casts successfully.  Also, you can 
|  type /iclick gobby and it will dig it out and click it.  The "nokeepup" parameter is for items 
|  that you would deem as situational, but do not need to keep the buff up (also works for items 
|  that do not put a buff onto you).  There are some cool things you can work out with it, but 
|  I will leave that to you. 
| 
|  /ibounce is used to keep you from clicking an item over and over that will not stack with 
|  your current buffs.  If you keep this updated, it will keep you from looking like a retard. 
|  
|   usage:  /ibounce alias "conflicting spell name" 
|   example /ibounce gobby "strength of tunare" 
| 
|  This will prevent you from clicking your shrunken goblin skull earring, if you have 
|  “strength of tunare” on as a buff. 
|  


#turbo 40 
#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 Exp             "#*#You gain#*#experience#*#" 
#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.#*#" 
#Event NoWear  "#*#Your class, deity, race and/or level may not equip#*#" 
#Event LootMyCorpse    "[MQ2] LootMyCorpse#*#" 
#Event SpellBounced    "#*#Your spell did not take hold#*#" 
#Event SwitchWeapon    "#*#|${switchtext}|#*#" 
#Event TogPause        "[MQ2] Pause#*#" 
#Event SetWeaponSwitch "[MQ2] SetWeaponSwitch#*#" 
#Event ItemSet         "[MQ2] ItemSet#*#" 
#Event ItemBounce      "[MQ2] ItemBounce#*#" 
#Event ItemCast        "[MQ2] ItemCast#*#" 

Sub Main 
    
   /declare MeleeAttack_1 string outer 
   /declare MeleeAttack_2 string outer 
   /declare MeleeAttack_3 string outer 
   /declare OpenCorpse outer 0 
   /declare MobID outer 
   /declare LDExp float outer ${Me.PctGroupLeaderExp} 
   /declare AAExp float outer ${Me.PctAAExp} 
   /declare Exp float outer ${Me.PctExp} 
   /declare PCini outer 
   /declare NPCini outer 
   /declare itemini outer 
   /declare AutoLoot outer 
   /declare MeleeDistance outer 
   /declare DefaultMeleeDistance outer 
   /declare i int outer 
   /declare ialias string outer None 
   /declare doIclick bool outer FALSE 
   /declare bouncenum int outer 1 
   /declare ibounce string outer None 
   /declare itemspellname string outer None 
   /declare clicktimer timer outer 0 
   /declare isPaused bool outer FALSE 
   /declare doSwitch string outer FALSE 
   /declare switchtext string outer +Undefined+ 
   /declare weapon1 string outer None 
   /declare weapon2 string outer None 
   /declare WeaponSpell string outer Avatar 
   /declare verbosity int outer 2 
   /declare channel string outer echo 
   /declare lastevent string outer None 
   /declare passitemstring string outer NULL 
   /declare ItemCastTime float outer 2 
   /declare doIclickincombat bool outer FALSE 
   /declare switchtype string outer Snare 

   /echo Toggling Auto-Attack on Assist Off - We Really don't Want you jumping the Gun 
   /assist off 
  
  :SetClassVariables 
    /if (${Me.Class.Name.Equal[Warrior]}) { 
       /varset MeleeAttack_1 Taunt 
       /varset MeleeAttack_2 Kick 
       /varset MeleeAttack_3 Disarm 
    } 
    /if (${Me.Class.Name.Equal[Warrior]}) { 
       /varset itemini "warserker-war-items.ini" 
       /varset PCini "warserker-war-pc.ini" 
       /varset NPCini "warserker-war-npc.ini" 
    } 
    /if (${Me.Class.Name.Equal[Berserker]}) { 
       /varset MeleeAttack_1 Frenzy 
       /varset MeleeAttack_2 Disarm 
       /varset MeleeAttack_3 NONE 
    } 
    /if (${Me.Class.Name.Equal[Berserker]}) { 
       /varset itemini "warserker-ber-items.ini" 
       /varset PCini "warserker-ber-pc.ini" 
       /varset NPCini "warserker-ber-npc.ini" 
    } 
    /if (${Me.Class.Name.Equal[Monk]}) { 
       /varset MeleeAttack_1 "Flying Kick" 
       /varset MeleeAttack_2 Disarm 
       /varset MeleeAttack_3 NONE 
    } 
    /if (${Me.Class.Name.Equal[Monk]}) { 
       /varset itemini "warserker-mnk-items.ini" 
       /varset PCini "warserker-mnk-pc.ini" 
       /varset NPCini "warserker-mnk-npc.ini" 
    } 

  :NewCharacterCheck 
    /varset OpenCorpse ${Ini[${PCini},${Me.Name},OpenCorpse]} 
    /if (${OpenCorpse.Equal[NULL]}) /goto :NewCharacter 

   :alias 
    /if (${verbosity}>=0) /${channel} Setting Aliases... 
    /squelch /alias /lootmycorpse /echo LootMyCorpse 
    /squelch /alias /iset /echo ItemSet 
    /squelch /alias /ibounce /echo ItemBounce 
    /squelch /alias /iclick /echo ItemCast 
    /squelch /alias /pause /echo Pause 
    /squelch /alias /weaponswitch /echo SetWeaponSwitch 
    /squelch /alias /channel /echo SetChannel 

|-- Reading .ini settings 
    /if (${OpenCorpse.Equal[NULL]}) /varset OpenCorpse ${Ini[${PCini},${Me.Name},OpenCorpse]} 
    /if (${AutoLoot.Equal[NULL]}) /varset AutoLoot ${Ini[${PCini},${Me.Name},AutoLoot]} 
    /varset DefaultMeleeDistance ${Ini[${PCini},${Me.Name},DefaultMeleeDistance]} 
    /if (${Ini[${PCini},General,WeaponSwitching].NotEqual[NULL]}) /varset doSwitch ${Ini[${PCini},General,WeaponSwitching]} 
   /if (${Ini[${PCini},Weapons,Weapon1].NotEqual[NULL]}) /varset weapon1 ${Ini[${PCini},Weapons,Weapon1]} 
   /if (${Ini[${PCini},Weapons,Weapon2].NotEqual[NULL]}) /varset weapon2 ${Ini[${PCini},Weapons,Weapon2]} 
   /if (${Ini[${PCini},Weapons,SwitchText].NotEqual[NULL]}) /varset switchtext ${Ini[${PCini},Weapons,SwitchText]} 
  | /varset wstype ${FindItem[${weapon1}].Spell.SpellType} 

  :StickBegin 
    /if (!${MeleeAttack_1.Equal[NONE]}) /echo Auto ${MeleeAttack_1} when available. 
    /if (!${MeleeAttack_2.Equal[NONE]}) /echo Auto ${MeleeAttack_2} when available. 
    /if (!${MeleeAttack_3.Equal[NONE]}) /echo Auto ${MeleeAttack_3} when available. 
    /if (!${OpenCorpse.Equal[0]}) /echo Auto Open Corpse 
  /goto :sub_combat_loop 
  
  :NewCharacter 
    /ini "${PCini}" ${Me.Name} AutoLoot 0 
    /ini "${PCini}" ${Me.Name} OpenCorpse 0 
    /ini "${PCini}" ${Me.Name} DefaultMeleeDistance 13 

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

    /if (${verbosity}>=0) /${channel} Setting Aliases... 
    /squelch /alias /lootmycorpse /echo LootMyCorpse 
    /squelch /alias /iset /echo ItemSet 
    /squelch /alias /ibounce /echo ItemBounce 
    /squelch /alias /iclick /echo ItemCast 
    /squelch /alias /pause /echo Pause 
    /squelch /alias /weaponswitch /echo SetWeaponSwitch 
    /squelch /alias /channel /echo SetChannel 





  
:sub_combat_loop 

 |- Service any events 
    /doevents 
 |- If stunned or paused, don't do anything 
    /if (${Me.State.Equal[STUN]} || ${isPaused}) { 
     /delay 2 
     /goto :sub_combat_loop 
   } 
 |- If fighting 
   /if (${Me.Combat}) /call Attack 
 |- If not fighting check clicky items 
   /if (!${Me.Combat}) /call item_check 
     /goto :sub_combat_loop 

/return 

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

    /if (${Target.Distance}>150) /attack off 

  :attackSetup 
    /varset MobID ${Target.ID} 

  :attackPreFight 
    /call ClearReturn 
|    /if (${Me.Casting.ID}) /keypress FORWARD 
    /if (${Me.Pet.ID}) /pet attack 
    /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]} 
      } 
    /if (${Target.ID}!=${MobID}) /goto :attackend 
    /if (${Macro.Return.Equal["EndATK"]}) /goto :attackend 
    /if (!${Me.Combat}) /goto :attackend 
    /if (${Me.Casting.ID}) /goto :attackMeleeLoop 
    /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 (${Target.ID}==${MobID} && !${Me.Casting.ID}) /if (${Target.Distance}==${MeleeDistance}) /call Combat_Item_Check 
    /if (!${MeleeAttack_1.Equal[NONE]}) /if (!${Me.Casting.ID}) /if (${Target.Distance}<=${MeleeDistance}) /if (${Me.AbilityReady[${MeleeAttack_1}]}) 

/doability ${MeleeAttack_1} 
    /if (!${MeleeAttack_2.Equal[NONE]}) /if (!${Me.Casting.ID}) /if (${Target.Distance}<=${MeleeDistance}) /if (${Me.AbilityReady[${MeleeAttack_2}]}) 

/doability ${MeleeAttack_2} 
    /if (!${MeleeAttack_3.Equal[NONE]}) /if (!${Me.Casting.ID}) /if (${Target.Distance}<=${MeleeDistance}) /if (${Me.AbilityReady[${MeleeAttack_3}]}) 

/doability ${MeleeAttack_3} 
    /if (${doSwitch.Equal[TRUE]}) /call BuffSwitch 
    /if (!${Me.Moving}) /call Combat_Item_Check 
    |- Check to see if we're mounted and dismount if so 
    /if (${Me.Buff[Summon Drogmor].ID} || ${Me.Buff[Summon Horse].ID}) /dismount 
  /goto :attackMeleeLoop 
  
    /doevents slain 
    /doevents RageOn 
    /doevents MobGate 
    /doevents StunON 
    /if (${doSwitch.Equal[TRUE]}) /call BuffSwitch 
  :attackend 
    /if (${OpenCorpse}==1) { 
    /doevents slain 
      } 
    /varset MobID 0 
    /if (${TankToggle.NotEqual[NULL]}) /varset TankToggle NULL 
    /attack off 
    /pet backoff 
    /pet hold 
    /keypress FORWARD 
/return 

Sub item_check 
     |- If we're not hiding or moving, check clicky maintained spells 
     /if (${Me.Invis} || ${Me.Moving} || ${clicktimer} || ${Me.State.Equal[BIND]}) /goto :DoneItemChecks 
     /varset i 1 
     :ItemCheckLoop 
     /doevents 
     /varset ialias ${Ini[${itemini}].Arg[${i},|]} 
     /if (${ialias.NotEqual[NULL]}) { 
       |- Obtained an itemalias from the ${itemini} file 
       |- We supposed to keep this spell up? 
       /if (${Ini[${itemini},${ialias},KeepUp].Equal[FALSE]}) /goto :NextItem 
       |- Scan the item's bounce list for the active bouncers 
       /varset bouncenum 1 
       /varset doIclick TRUE 
       :BounceCheckLoop 
       /varset ibounce ${Ini[${itemini},${ialias},BounceOff${bouncenum}]} 
       /if (${ibounce.NotEqual[NULL]}) { 
         /if (${ibounce.Equal[${Me.Buff[${ibounce}]}]}) /varset doIclick FALSE 
       } else /goto :DoneBounceChecks 
       /varcalc bouncenum ${bouncenum}+1 
       /goto :BounceCheckLoop 
       :DoneBounceChecks 
       |- By now we won't click the item if a bouncer spell is on us 
       |- Just have to check to see if the existing buff is on too 
       /varset itemspellname ${FindItem[${Ini[${itemini},${ialias},FullName]}].Spell} 
       /if (${itemspellname.Equal[${Me.Buff[${itemspellname}]}]}) /varset doIclick FALSE 
       |- Finally, do it if we should 
       /if (${doIclick} && ${itemspellname.NotEqual[Yaulp II]}) /docommand /iclick ${ialias} 
       |- Did we fail to find that previous item? (i.e. Dead and naked at bind point!) 
       /if (${clicktimer}) /goto :DoneItemChecks 
       :NextItem 
       /varcalc i ${i}+1 
     } else /goto :DoneItemChecks 
     /goto :ItemCheckLoop 
      :DoneItemChecks 
   /if (${doSwitch.Equal[TRUE]}) /call BuffSwitch 
   /if (${Ini[${itemini},${ialias},KeepUp].Equal[FALSE]}) /goto :NextItem 
  
} 
/return 

|##################################################################### 
|##################################################################### 

|- If in combat, only click items with a 1.0s cast time or lower 
Sub Combat_item_check 
     |- If we're not hiding or moving, check clicky maintained spells 
     /if (${clicktimer} || ${Me.State.Equal[BIND]}) /goto :DoneItemChecks 
     /varset i 1 
     :ItemCheckLoop 
     /doevents 
     /varset ialias ${Ini[${itemini}].Arg[${i},|]} 
     /if (${ialias.NotEqual[NULL]}) { 
       |- Obtained an itemalias from the ${itemini} file 
       |- We supposed to keep this spell up? 
       /if (${Ini[${itemini},${ialias},KeepUp].Equal[FALSE]}) /goto :NextItem 
       |- Scan the item's bounce list for the active bouncers 
       /varset bouncenum 1 
       /varset doIclick TRUE 
       :BounceCheckLoop 
       /varset ibounce ${Ini[${itemini},${ialias},BounceOff${bouncenum}]} 
       /if (${ibounce.NotEqual[NULL]}) { 
         /if (${ibounce.Equal[${Me.Buff[${ibounce}]}]}) /varset doIclick FALSE 
       } else /goto :DoneBounceChecks 
       /varcalc bouncenum ${bouncenum}+1 
       /goto :BounceCheckLoop 
       :DoneBounceChecks 
       |- By now we won't click the item if a bouncer spell is on us 
       |- Just have to check to see if the existing buff is on too 
       /varset itemspellname ${FindItem[${Ini[${itemini},${ialias},FullName]}].Spell} 
       /if (${itemspellname.Equal[${Me.Buff[${itemspellname}]}]}) /varset doIclick FALSE 
       |- Finally, do it if we should 
       /varset ItemCastTime ${FindItem[${Ini[${itemini},${ialias},FullName]}].CastTime} 
       /if (${ItemCastTime} <= 1) /varset doIclickincombat TRUE 
       /if (${doIclick} && ${doIclickincombat}) /docommand /iclick ${ialias} 
       |- Did we fail to find that previous item? (i.e. Dead and naked at bind point!) 
       /if (${clicktimer}) /goto :DoneItemChecks 
       :NextItem 
       /varcalc i ${i}+1 
       /varset doIclickincombat FALSE 
       /varset ItemCastTime 2 
     } else /goto :DoneItemChecks 
     /goto :ItemCheckLoop 
     :InstaClickOnly 
     :DoneItemChecks 
   /if (${doSwitch.Equal[TRUE]}) /call BuffSwitch 
   /if (${Ini[${itemini},${ialias},KeepUp].Equal[FALSE]}) /goto :NextItem 
  
} 
/return 

|##################################################################### 
|##################################################################### 

   |- Check on switching weapons (assuming it's a buff-weapon and buff is down) 
Sub BuffSwitch 
   /if (${switchtype.NotEqual[Buff]}) /goto :skipswitch 
   /if (${weapon1.NotEqual[None]} && ${weapon1.NotEqual[NULL]} && ${FindItem[${weapon1}].ID}!=${Cursor.ID} && ${doSwitch} && ${WeaponSpell.NotEqual[NULL]}) 

{ 
     /if (${WeaponSpell.NotEqual[${Me.Buff[${WeaponSpell}]}]} && !${FindItem[${weapon1}].InvSlot.Name.Equal[mainhand]} && 

!${FindItem[${weapon1}].InvSlot.Name.Equal[offhand]}) { 
       /if (${verbosity}>=1) /${channel} ** Beneficial proc-weapon swapping... 
       /call Weapon_Swap "${weapon1}" "${weapon2}" 
     } 
   } 
:skipswitch 
/return 

Sub Weapon_Swap(string weapon, string wieldedweapon) 
  |- Is it in a Bag? 
  /declare camefrom ${FindItem[${weapon}].InvSlot} 
  /declare goingto ${FindItem[${wieldedweapon}].InvSlot} 
  /if (${verbosity}>=2) /${channel} ** Looking for weapon: ${weapon} 
  /if (${FindItem[${weapon}].InvSlot.Pack}) { 
    :OpenPack 
    /if (!${Window[${FindItem[${weapon}].InvSlot.Pack.Name}].Open}) { 
      /itemnotify ${FindItem[${weapon}].InvSlot.Pack.Name} rightmouseup 
      /delay 2 
      /goto :OpenPack 
    } 
    :GrabItem 
    /if (!${Cursor.ID}) { 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /goto :GrabItem 
    } 
    /declare weaponID int local ${Cursor.ID} 
    :SwapIt 
    /if (${Cursor.ID}==${weaponID}) { 
      /itemnotify ${InvSlot[${goingto}]} leftmouseup 
      /delay 2 
      /goto :SwapIt 
    } 
    /delay 2 
    /if (${verbosity}>=2) /${channel} ** Swapping out: ${weapon} 
    /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
    /delay 2 
    /if (${Cursor.ID}) { 
      /if (${verbosity}>=1) /${channel} ** Failed to use existing slot, dropping to inventory! 
      /autoinv 
    } 
    :ClosePack 
    /if (${Window[${InvSlot[${camefrom}].Pack.Name}].Open}) { 
      /itemnotify ${InvSlot[${camefrom}].Pack.Name} rightmouseup 
      /delay 2 
      /goto :ClosePack 
    } 
  } else { 
    |- It's in the main inventory 
    /if (${FindItem[${weapon}].InvSlot}) { 
      /itemnotify ${FindItem[${weapon}].InvSlot} leftmouseup 
      /delay 2 
      /itemnotify ${InvSlot[${goingto}]} leftmouseup 
      /delay 2 
      /if (${verbosity}>=2) /${channel} ** Swapping out: ${weapon} 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /if (${Cursor.ID}) { 
        /if (${verbosity}>=1) /${channel} ** Failed to use existing slot, dropping to inventory! 
        /autoinv 
      } 
    } else { 
      /if (${verbosity}>=1) /${channel} ** "${weapon}" not found! 
      /if (${verbosity}>=0) /${channel} Auto Equipping of ${weapon1} when ${WeaponSpell} is not present, Turned OFF! 
    } 
  } 
/return 

Sub Event_Exp(string Line) 
  /varset lastevent Event_Exp 
  |- Ignore leadership experience event triggers (redundant trigger) 
  /if (${Line.Find[leadership]}) /return 
  |- Experience calculation and reporting 
  /if (${verbosity}>=1) /${channel} ** XP-Delta: REG (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR 

(${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%) 
  /varset LDExp ${Me.PctGroupLeaderExp} 
  /varset AAExp ${Me.PctAAExp} 
  /varset Exp ${Me.PctExp} 
/return 

Sub Event_SetWeaponSwitch(string Line) 
  /varset lastevent Event_SetWeaponSwitch 
  |- Sanity Check 
  /if (${Line.Arg[3].Equal[OFF]} || !${Line.Arg[5].Length} || ${Line.Arg[6].Length}) { 
    /varset doSwitch FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto Weapon Switching is OFF 
    /goto :SaveSwitchSettings 
  } 
  |- Set the weaponswitching information 
  /if (${Line.Arg[3].Length}) /varset weapon1 ${Line.Arg[3]} 
  /if (${Line.Arg[4].Length}) /varset switchtext ${Line.Arg[4]} 
  /if (${Line.Arg[5].Length}) /varset weapon2 ${Line.Arg[5]} 
  /varset doSwitch TRUE  
  /if (${verbosity}>=0) /${channel} ** Auto Weapon Switching is ON 
  /if (${verbosity}>=0) /${channel} ** ${weapon1} will be swapped out for ${weapon2} 
  /if (${verbosity}>=0) /${channel} ** if the text "${switchtext}" is encountered. 

  :SaveSwitchSettings 
  /doevents flush 
  /ini ${PCini} "General" "WeaponSwitching" "${doSwitch}" 
  /ini ${PCini} "Weapons" "Weapon1" "${weapon1}" 
  /ini ${PCini} "Weapons" "Weapon2" "${weapon2}" 
  /ini ${PCini} "Weapons" "SwitchText" "${switchtext}" 
 | /varset wstype ${FindItem[${weapon1}].Spell.SpellType} 
/return 

Sub Event_ItemSet(string Line) 
  /varset lastevent Event_ItemSet 
  |- Sanity check parameters 
  /if (!${Line.Arg[5].Length} || ${Line.Arg[6].Length}) { 
    /if (${verbosity}>=0) /${channel} ** Improper use of /iset 
    /if (${verbosity}>=0) /${channel} -- /iset <itemalias> keepup|nokeepup <"Item Name"> 
    /if (${verbosity}>=0) /${channel} -- For example: 
    /if (${verbosity}>=0) /${channel} -- /iset gobby keepup "Shrunken Goblin Skull Earring" 
    /return 
  } 
  /ini "${itemini}" "${Line.Arg[3]}" "FullName" "${Line.Arg[5]}"  
  /ini "${itemini}" "${Line.Arg[3]}" "KeepUp" "${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}" 
  /if (${verbosity}>=0) /${channel} ** ${Line.Arg[5]} (KeepUp=${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}) updated in INI! 
/return 

Sub Event_ItemBounce(string Line) 
  /varset lastevent Event_ItemBounce 
  |- Sanity check parameters 
  /if (!${Line.Arg[4].Length}) { 
    /if (${verbosity}>=0) /${channel} ** Improper use of /ibounce 
    /if (${verbosity}>=0) /${channel} -- /ibounce <itemalias> "Some Spell Name" 
    /if (${verbosity}>=0) /${channel} -- For example: 
    /if (${verbosity}>=0) /${channel} -- /ibounce gobby "Strength of Tunare" 
    /return 
  } 
  |- Look for that item's section, return if non-existent 
  /if (!${Ini[${itemini},${Line.Arg[3]}].Length}) { 
    /if (${verbosity}>=0) /${channel} ** [${Line.Arg[3]}] not in INI file! 
    /return 
  } 
  |- Find the next available BounceOff key number and store the spell 
  /declare bindex int local 1 
  :CheckNextKey 
  /if (${Ini[${itemini},${Line.Arg[3]},BounceOff${bindex}].Length}) { 
    |- This one is in use... 
    /varcalc bindex ${bindex}+1 
    /goto :CheckNextKey 
  } else { 
    |- This one not defined (yet).  Good. 
    /ini "${itemini}" "${Line.Arg[3]}" "BounceOff${bindex}" "${Line.Arg[4]}"  
    /if (${verbosity}>=0) /${channel} ** Added "${Line.Arg[4]}" to [${Line.Arg[3]}]'s bounce list 
  } 
/return 

Sub BaseInvClick 
  /varset lastevent Event_BaseInvClick 
  /if (${FindItem[${passitemstring}].EffectType.Equal[Click Inventory]}) /goto :BaseInvClickValid 
  /return 
:BaseInvClickValid 
  |- Is it in a Bag? 

  /if (${verbosity}>=1) /${channel} ** Attempting to use: ${passitemstring} 
  /if (${FindItem[${passitemstring}].InvSlot.Pack}) { 
    :OpenPack 
    /if (!${Window[${FindItem[${passitemstring}].InvSlot.Pack.Name}].Open}) { 
      /itemnotify ${FindItem[${passitemstring}].InvSlot.Pack.Name} rightmouseup 
      /delay 2 
      /goto :OpenPack 
    } 
    /declare camefrom ${FindItem[${passitemstring}].InvSlot} 
    :GrabItem 
    /if (!${Cursor.ID}) { 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /goto :GrabItem 
      } 
    
    /declare clickyID int local ${Cursor.ID} 
    :SwapFirst 
    /if (${Cursor.ID}==${clickyID}) { 
      /itemnotify ${InvSlot[Pack8]} leftmouseup 
      /delay 2 
      /goto :SwapFirst 
    } 
    |- Click it 
    /delay 2 
    /if (${verbosity}>=1) /${channel} ** Clicking: ${passitemstring} 
    /declare previousID ${Cursor.ID} 
    /itemnotify ${InvSlot[Pack8]} rightmouseup 
    :SwapAgain 
    /if (${Cursor.ID}==${previousID}) { 
      /itemnotify ${InvSlot[Pack8]} leftmouseup 
      /delay 2 
      /goto :SwapAgain 
    } 
    |- Put it back 
    :PutItBack 
    /if (${Cursor.ID}==${clickyID}) { 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /goto :PutItBack 
    } 
    :SummonedCheck 
    /if (${Cursor.ID}) { 
      |- Something was summoned 
      /autoinv 
      /delay 2 
      /goto :SummonedCheck 
    }    
    :ClosePack 
    /if (${Window[${InvSlot[${camefrom}].Pack.Name}].Open}) { 
      /itemnotify ${InvSlot[${camefrom}].Pack.Name} rightmouseup 
      /delay 2 
      /goto :ClosePack 
    } 
  } else { 
    |- Just click it 
    /if (${FindItem[${passitemstring}].InvSlot}) { 
      /if (${verbosity}>=1) /${channel} ** Clicking: ${passitemstring} 
      /itemnotify ${FindItem[${passitemstring}].InvSlot} rightmouseup 
      /delay 2 
    } else { 
      /if (${verbosity}>=0) /${channel} ** "${passitemstring}" not found! 
    } 
  } 
  :CastLoop 
  /delay 1 
  /if (${Me.Casting.ID}) /goto :CastLoop 
/varset passitemstring NULL 
/return 
} 
/varspassitemstring assitemstring NULL 
/return 

Sub Event_ItemCast(string Line) 
  /varset lastevent Event_ItemCast 
  |- Sanity check parameter 
  /if (!${Line.Arg[3].Length}) { 
    /if (${verbosity}>=0) /${channel} ** Improper use of /icast 
    /if (${verbosity}>=0) /${channel} -- /icast <itemalias> 
    /if (${verbosity}>=0) /${channel} -- For example: 
    /if (${verbosity}>=0) /${channel} -- /icast gobby 
    /return 
  } 
  |- Look for that item's section, return if non-existent 
  /if (!${Ini[${itemini},${Line.Arg[3]}].Length}) { 
    /if (${verbosity}>=0) /${channel} ** [${Line.Arg[3]}] not in INI file! 
    /return 
  } 
  /declare fullname string local ${Ini[${itemini},${Line.Arg[3]},FullName]} 
  /varset passitemstring ${Ini[${itemini},${Line.Arg[3]},FullName]} 
  /if (${FindItem[${fullname}].EffectType.Equal[Click Inventory]}) { 
    /call BaseInvClick 
    /return 
  } 

  |- Is it in a Bag? 

  /if (${verbosity}>=1) /${channel} ** Attempting to use: ${fullname} 
  /if (${FindItem[${fullname}].InvSlot.Pack}) { 
    :OpenPack 
    /if (!${Window[${FindItem[${fullname}].InvSlot.Pack.Name}].Open}) { 
      /itemnotify ${FindItem[${fullname}].InvSlot.Pack.Name} rightmouseup 
      /delay 2 
      /goto :OpenPack 
    } 
    /declare camefrom ${FindItem[${fullname}].InvSlot} 
    :GrabItem 
    /if (!${Cursor.ID}) { 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /goto :GrabItem 
      } 
    
    /declare clickyID int local ${Cursor.ID} 
    /declare wornat int local ${Cursor.WornSlot[1]} 
    :SwapFirst 
    /if (${Cursor.ID}==${clickyID}) { 
      /itemnotify ${InvSlot[${wornat}]} leftmouseup 
      /delay 2 
      /goto :SwapFirst 
    } 
    |- Click it 
    /delay 2 
    /if (${verbosity}>=1) /${channel} ** Clicking: ${fullname} 
    /declare previousID ${Cursor.ID} 
    /itemnotify ${InvSlot[${wornat}]} rightmouseup 
    :SwapAgain 
    /if (${Cursor.ID}==${previousID}) { 
      /itemnotify ${InvSlot[${wornat}]} leftmouseup 
      /delay 2 
      /goto :SwapAgain 
    } 
    |- Put it back 
    :PutItBack 
    /if (${Cursor.ID}==${clickyID}) { 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /goto :PutItBack 
    } 
    :SummonedCheck 
    /if (${Cursor.ID}) { 
      |- Something was summoned 
      /autoinv 
      /delay 2 
      /goto :SummonedCheck 
    }    
    :ClosePack 
    /if (${Window[${InvSlot[${camefrom}].Pack.Name}].Open}) { 
      /itemnotify ${InvSlot[${camefrom}].Pack.Name} rightmouseup 
      /delay 2 
      /goto :ClosePack 
    } 
  } else { 
    |- Just click it 
    /if (${FindItem[${fullname}].InvSlot}) { 
      /if (${verbosity}>=1) /${channel} ** Clicking: ${fullname} 
      /itemnotify ${FindItem[${fullname}].InvSlot} rightmouseup 
      /delay 2 
    } else { 
      /if (${verbosity}>=0) /${channel} ** "${fullname}" not found! 
    } 
  } 
  :CastLoop 
  /delay 1 
  /if (${Me.Casting.ID}) /goto :CastLoop 
/return 




Sub Event_LootMyCorpse 
   /varset lastevent Event_LootMyCorpse 
  |- Logic ripped off from Loot.mac and simplified somewhat 
  /declare LootTotal int local 0 
  /declare LootSlot int local 
  |- Get corpse on target and continue looting if possible 
  /squelch /target mycorpse 
  /if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) { 
    /if (${verbosity}>=0) /${channel} ** Can't target my corpse. 
    /return 
  }    
  /corpse 
  /delay 1s 
  /loot 
  /delay 1s 
  /if (${Me.State.NotEqual[BIND]}) { 
    /if (${verbosity}>=0) /${channel} ** Massive lag right now... Aborting looting. 
    /return 
  } 
  |- Get item count accurately 
  :LootLag 
  /if (${LootTotal}!=${Corpse.Items}) { 
    /varset LootTotal ${Corpse.Items} 
    /delay 5 
    /goto :LootLag 
  } 
  |- Loot Loop 
  /for LootSlot 1 to ${LootTotal} 
    :LootItem 
    /itemnotify loot${LootSlot} rightmouseup 
    /delay 3 
    /if (${Corpse.Item[${LootSlot}].ID}) { 
      /delay 2 
      /goto :LootItem 
    } 
  /next LootSlot 
  /delay 5 
  /if (${verbosity}>=0) /${channel} ** Done looting my corpse. 
  /notify LootWnd DoneButton leftmouseup 
/return 

Sub Event_SpellBounced 
  /varset lastevent Event_SpellBounced 
  /varset clicktimer 60s 
  /beep 
  /beep 
  /beep 
  /if (${verbosity}>=1) /${channel} ** Just detected a BOUNCED spell! 
  /if (${verbosity}>=1) /${channel} ** Use /ibounce to update click-item info! 
/return 

Sub Event_SwitchWeapon 
  /varset lastevent Event_SwitchWeapon 
  /if (${doSwitch}) { 
    /call Weapon_Swap "${weapon2}" "${weapon1}" 
  } 
/return 

Sub ClearReturn 
/return NULL 

Sub event_slain 
  /if (${Target.CurrentHPs}>0) /return 
  /if (${OpenCorpse}==0) /return EndATK 
  |/if (${Target.Type.NotEqual[Corpse]}) 
  /target id ${MobID} 
  /loot 
  /keypress FORWARD 
  /loot 
  /loot 
  /loot 
/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 
  /pet back off 
  /pet hold 
  /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_TogPause 
  /varset lastevent Event_TogPause 
  /beep 
  /if (${isPaused}) { 
    /varset isPaused FALSE 
    /if (${verbosity}>=0) /${channel} ** Warserker Helper is now RESUMING! 
  } else { 
    /varset isPaused TRUE 
    /if (${verbosity}>=0) /${channel} ** Warserker Helper is now PAUSED! 
  } 
/return 

Sub event_StunOFF 
/return StunOFF 

Sub event_ToggleOpenCorpse 
  /if (${OpenCorpse}==0) { 
    /varset OpenCorpse 1 
    /echo OpenCorpse On 
    /return 
    } 
  /if (${OpenCorpse}==1) { 
  /varset OpenCorpse 0 
    /echo OpenCorpse Off 
    } 
/return

Where the white womens be?

traber
decaying skeleton
decaying skeleton
Posts: 1
Joined: Tue Oct 03, 2006 1:41 am

Hmmmmmm

Post by traber » Sat Aug 23, 2008 7:29 pm

I love the idea for this macro. I have just one problem, I'm stupid.

I copied, pasted, saved as a .mac file, and placed in my macro folder inside my release folder.

When i attempt to use the macro though, I get Subroutine Main wasn't found.

What am I doing wrong?

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Post by ieatacid » Sat Aug 23, 2008 9:32 pm

Save as type "all files".