Bsthelper based off RH mac (Updated 7/06/05)

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

Moderator: MacroQuest Developers

mystikule
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jul 17, 2004 9:23 pm

Bsthelper based off RH mac (Updated 7/06/05)

Post by mystikule » Sat Apr 02, 2005 7:42 pm

I realize that there are tons of beastlord macros out there these days, but none seemed to fit my needs. I only post this as another choice for people and an opportunity for me to learn marco'ing. This macro is intended to be a beastlord version of RH.mac, in which a full group is present (ie a Tank,Healer,DPS, whathaveyou). Would it work for a soloing bst? possibly. Is it intended as such? no. Alot of this code is directly from RH and therefore, alot of similarities will be noticed (All credit for RH coding herewithin is awarded to another besides myself). Please share your thoughts, advice, wishes, and requests! My beasty is a twink and not many AA's, so I've tested and based this macro off him. Advanced AA's and such may not be present only because of the above mentioned "excuse", but please feel free to administer such critism.

Features:
-Autoassist
-Autoslow
-Auto selfbuff
-Auto buff requests
-Leash to a home point
-Autoloot
-Auto summon and buff pet

Update(v5.8.1a):
-Buffing midfight was hosed, should be corrected now
-Also posted ini and Spell_routines.inc (yes u need this or edit this macro or the inc to get things working). Only change i made to this somewhat old version of Spellroutines was that I added CAST_NOTHOLD and use it within this mac.

Update(v5.8.1):
-Added pet AA buff
-Added pet clky buffs (ie. Epic 1.5)
-Added swapping for pet focus items
-Changed spell block detection for self buffing (Other way I did it was retarded and bad coding)
-Added command for paragon
-Added clky buffs (ie. Fabled Shrunken Goblin Skull Earring)
-Added /pet back off for enraged targets and /pet hold whenever /pet back off is used
-Changed some issues with /sit /stand
-If has mob aggro won't try to get behind it (spin) or cast spells (uses HoTT for this)
-Changed Fero rotation to continue mid fight. Good for those extra long fights.
-Added autopet healing

Bugs:
-Due to bound.id structure change the death sequence needs to be revamped to adhere to the new changes

Future changes:
-Autoslow: needs to made to remember which mobs have been slowed. (I've tried and failed and maybe im just too tired atm (or too retarded), but if anyone can help me out here it'd be much appreciated. My failed coding is included :roll: , but not used. I'm not so concerned about maintaining slow on a mob since most mobs that take longer than 3minutes to kill are pseudo raid mobs and a shm/enc is most likely present. My concern is 2 mobs in a group scenario and the tank is switching targets to keep aggro on both, as code sits now, the mobs will be reslowed every time the tank targets them, even tho they don't need it.
-Disc's: add an option to make disc's command activated through either group or tells.
-Revamp death sequence to accomodate new changes and delete some unneeded coding.
-Incorporate weapon switching to use bandolier instead of hard coding.
-Make weapon switching command activated
-Autoheal the toons health? (dont see a need in my particular situation, can see how this would be a benefit tho)
-Clean up coding up to make easier for reading

Required:
-Spell_Routines.inc (by rusty)

************ USAGE ************

/BSThelp - Display this information!
/status - Display status of all RH modes
/pause - Suspends the operations of RH
/stopfight <%> - Set % of your health to stop attacking
/endfloor <%> - Set % of your endurance needed to strike
/autostick - Toggle autosticking to NPCs while attacking
/stickdist <range_target> <range_tank> - Set stick thresholds
/closeness <%> - Set % of max hit range while autosticking
/autoassist <main_assist> <%health> - Activate autoassist
/autoassist off - Disable autoassisting
/autoassist on - Turn on autoassist w/existing tank info
/mainassist <player> - Sets main assist to <player>
/secondassist <player> - Sets secondary assist to <player>
/thirdassist <player> - Sets third assist to <player>
/dynaggro - Toggle dynamic management of assist health %
/leash <distance> - Activate leash with <distance> ft.
/leash <distance> <master> - Activate leash w/a master
/leash off - Disable leashing
/drag <body1> <body2> ... <bodyN> - Drag corpses
/lootmycorpse - Loot your own corpse completely
/iset <itemalias> keepup|nokeepup <"Item Name"> - Item settings
/ibounce <itemalias> <"Spell Name"> - Add bounce-off spell
/iclick <itemalias> - Click cast item defined in <itemalias>
/autoninja <mode> [<range>] - Automatic NPC corpse looting
/autofollow [<name>] [<distance>] - Follow <name> at <distance>
/weaponswitch <weapon1> <"switch text"> <weapon2> - weapon swap
/targetswitch - Toggle autoswitching of targets in autoassist
/autochicken [ON|OFF|<nimble%>]
/autodisc1 "Discipline Name"|ON|OFF <end%> <reuse> - Auto disc 1
/autodisc2 "Discipline Name"|ON|OFF <end%> <reuse> - Auto disc 2
/addmaster <name> - Add a master to remote control users
/remmaster <name> - Remove a master from remote control users
/autopet [ON|OFF] - Automatically Summon a pet
/buffpet [ON|OFF] - Automatically buff your pet
/verbose [ON|OFF] - Announce to group
/autoslow [ON|OFF] - Toggle performing slow debuff
/autobuff [ON|OFF] - Toggle autobuffing
/autofero [ON|OFF] - Toggle auto Ferocity rotation
/healpet [ON|OFF] - Toggle auto pet healing

-All spell names and activation of clky buffs (including pet) are maintained within the macro itself. Change True values to false if use is not wanted. Such editing is noted with the macro itself and should be self evident.

/Group and/or /tell commands (these are commands to recieve buffs from the beastlord running the macro):

-sv = Spiritual Vitality
-sa = Spiritual Ascendance
-pos = Paragon of Spirit
-focus = Focus of Alladnu
-ios = Infusion of Spirit
-sow = Spirit of Wolf
-shrink = Shrink
-fero = Ferocity
-regen = Feral Vigor
-haste = Celerity
-heal = Muada's Mending
-rgc = Abolish Pioson
-curepoison = Counteract Poison
-slow = slow's target

(note: that these commands are currently what is setup with bst.mac itself, changes will incure with the changing of spell names.)

Disclaimer:
-I don't claim to be an expert macro'r and this is my most serious project that I've undertaken. Please feel free to correct any "bad" coding and offer advice. A learner in progress I consider myself :wink: .
Last edited by mystikule on Thu Jul 14, 2005 6:19 pm, edited 5 times in total.

mystikule
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jul 17, 2004 9:23 pm

Post by mystikule » Sat Apr 02, 2005 7:50 pm

part 1 of 2

Code: Select all

| 
|--------------------------------------------------------------------------------- 
| 
| BST Syntax: 
| 
| Usage: /mac BST 
| 
| Default settings can be changed by their respective controlling /command
|
| Type /BSThelp for help or /status to see current settings!
| 
|--------------------------------------------------------------------------------- 
| Quick list for equipment slot info
|
|	0 charm 
|	1 leftear 
|	2 head 
|	3 face 
|	4 rightear 
|	5 neck 
|	6 shoulder 
|	7 arms 
|	8 back 
|	9 leftwrist 
|	10 rightwrist 
|	11 ranged 
|	12 hands 
|	13 mainhand 
|	14 offhand 
|	15 leftfinger 
|	16 rightfinger 
|	17 chest 
|	18 legs 
|	19 feet 
|	20 waist 
|	21 ammo 
|
|---------------------------------------------------------------------------------




#Chat group
#Chat tell 
#Event AttackOn        "#*#Auto attack is on#*#" 
#Event AttackOff       "#*#Auto attack is off#*#" 
#Event Enraged         "#*#|${Target.CleanName}| has become ENRAGED#*#" 
#Event NLEnraged       "#*#|${Target.CleanName}| is no longer enraged#*#" 
#Event Exp             "#*#You gain#*#experience#*#" 
#Event Slain           "#*# slain#*#"
#Event Zoned           "#*#You have entered#*#"
#Event GotHit          "#*#hits YOU#*#"
#Event GotMissed       "#*#hit YOU#*#"
#Event SpellBounced    "#*#Your spell did not take hold#*#"
#Event SwitchWeapon    "#*#|${switchtext}|#*#"
#Event Invited         "#*#invites you to join a group#*#"
#Event ImDead          "You have been slain by#*#"  
#Event TogStick        "[MQ2] Autostick#*#" 
#Event TogLeash        "[MQ2] Leash#*#" 
#Event TogAuto         "[MQ2] Autoassist#*#" 
#Event TogDynaggro     "[MQ2] Dynaggro#*#" 
#Event TogPause        "[MQ2] Pause#*#"
#Event TogTSwitch      "[MQ2] AutoTargetSwitch#*#"
#Event SetStopFighting "[MQ2] SetStopFighting#*#"
#Event SetEndFloor     "[MQ2] SetEndFloor#*#"
#Event SetCloseness    "[MQ2] SetCloseness#*#"
#Event SetFirstassist  "[MQ2] SetMainassist#*#"
#Event SetSecondassist "[MQ2] SetSecondassist#*#"
#Event SetThirdassist  "[MQ2] SetThirdassist#*#"
#Event SetAutoNinja    "[MQ2] SetAutoNinja#*#"
#Event SetWeaponSwitch "[MQ2] SetWeaponSwitch#*#"
#Event SetStickDist    "[MQ2] SetStickDist#*#"
#Event SetChicken      "[MQ2] SetChicken#*#"
#Event SetDisc1        "[MQ2] SetDisc1#*#"
#Event SetDisc2        "[MQ2] SetDisc2#*#"
#Event DragBodies      "[MQ2] DragBodies#*#"
#Event LootMyCorpse    "[MQ2] LootMyCorpse#*#"
#Event AutoFollow      "[MQ2] AutoFollow#*#"
#Event AddMaster       "[MQ2] AddMaster#*#"
#Event RemMaster       "[MQ2] RemoveMaster#*#"
#Event ItemSet         "[MQ2] ItemSet#*#"
#Event ItemBounce      "[MQ2] ItemBounce#*#"
#Event ItemCast        "[MQ2] ItemCast#*#"
#Event TogBuff	       "[MQ2] AutoBuff#*#"
#Event TogPet	       "[MQ2] Autopet#*#"
#Event TogPetBuff      "[MQ2] BuffPet#*#"
#Event TogPetHeal      "[MQ2] HealPet#*#"
#Event TogVerbose      "[MQ2] Verbose#*#"
#Event TogAutoslow     "[MQ2] Autoslow#*#"
#Event TogFerorot      "[MQ2] Autofero#*#"
#Event HelpInfo        "[MQ2] BST Help#*#"
#Event StatInfo        "[MQ2] -------=======(Current Status)=======--------"


#include Spell_Routines.inc

Sub Main


| The spell will be memmed in the listed order. 
| Gem1 = Pet/PetHeal 
| Gem2 = Pet buff 
| Gem3 = Pet Haste
| Gem4 = Mana Regen 
| Gem5 = Slow 
| Gem6 = Hp buff....SV
| Gem7 = Sow, misc. buffs
| Gem8 = Atk buff


  /echo Loading Beastlord Helper... Please Wait!

| *******Edit spells here*******

   /declare SpellSlow          outer "Sha's Revenge" 
   /declare SpellDoT         outer "Chimera Blood" 
   /declare SpellPet           outer "Spirit of Alladnu" 
   /declare SpellHeal          outer "Muada's Mending" 
   /declare SpellNuke         outer "Glacier Spear" 
   /declare SpellATK          outer "Ferocity" 
   /declare SpellPetBuff       outer "Spirit of Irionu"
   /declare SpellPetHeal       outer "Healing of Mikkily"
   /declare SpellPetHaste	outer "Growl of the Beast"
   /declare SpellManaRegen       outer "Spiritual Ascendance"
   /declare SpellHPBuff	      outer "Spiritual Vitality"
   /declare SpellMiscBuff	outer "Spirit of Wolf"
   /declare SpellStaBuff	outer "Infusion of Spirit"
   /declare SpellSHMHPBuff	outer "Focus of Alladnu"
   /declare SpellShrink		outer "Shrink"
   /declare SpellHaste		outer "Celerity"
   /declare SpellRegen		outer "Feral Vigor"
   /declare SpellCurePoison	outer "Counteract Poison"
   /declare SpellRGC		outer "Abolish Disease"

| *******Edit Spell Blocking here*******
    /declare SpellHasteBlock	string outer |Hastening of Salik|Speed of Salik|Vallon's Quickening|Speed of Vallon|Talisman of Alacrity|
    /declare SpellHPBlock	string outer |Brell's Brawny Bulwark|Brell's Stalwart Shield|Strength of the Hunter|Strength of Tunare|
    /declare SpellSHMHPBlock	string outer |Talisman of Wunshi|Wunshi's Focusing|Focus of the Seventh|Focus of Soul|

| *******Edit Spell Clky Buffs/Blocking here*******
    /declare SpellBuffClkyUse	bool outer TRUE
    /declare SpellBuffClkyBlock	string outer |Strength of the Hunter|Strength of Tunare|Spiritual Vitality|Spiritual Vigor|
    /declare SpellBuffClkyItem 	outer "Fabled Shrunken Goblin Skull Earring"
    /declare SpellBuffClky	outer "Aura of Rage"

| *******Edit Pet spells here*******

    /declare SpellPetBuffs[2] string outer
    /varset SpellPetBuffs[1] "Spirit of Irionu"
    /varset SpellPetBuffs[2] "Growl of the Beast"
|    /varset SpellPetBuff[3] "Ferocity" 

|-  *******Edit Pet AA's here*******
    /declare SpellPetAAUse	bool outer TRUE
    /declare SpellPetBuffAA	outer "Hobble of Spirits"

|-  *******Edit Pet Clky Buffs here (ie epic 1.5)*******
    /declare SpellPetClky	bool outer TRUE
    /declare SpellPetBuffClky	outer "Savage Wildcaller's Blessing"
    /declare SpellPetBuffClkyItem	outer "Savage Lord's Totem"
    /declare SpellPetBuffClkySlot	int outer 13
    /declare SpellPetBuffClkyRecast	int outer 3600

|-  *******Edit Pet Focus swapping here (ie epic 1.5)*******

    /declare PetFocusON		bool outer FALSE
    /declare PetFocusItem	outer "Sphere of Swirling Flame"
    /declare PetFocusOld	string outer

|-  *******Edit Pet Healing here (Note: toggled within game using /Healpet [ON/OFF])*******
    /declare HealPetAt	int outer	40

| *******End Edit*******

  /declare StopFightingHealth int outer 30 
  /declare MinEndurance int outer 80 
  /declare isEnraged bool outer FALSE 
  /declare LDExp float outer ${Me.PctGroupLeaderExp} 
  /declare AAExp float outer ${Me.PctAAExp} 
  /declare Exp float outer ${Me.PctExp} 
  /declare doStick bool outer TRUE 
  /declare X float outer 
  /declare Y float outer 
  /declare behindTarget bool outer FALSE 
  /declare n int outer 
  /declare dir int outer 
  /declare delta int outer 
  /declare strafedir string outer 
  /declare closeness int outer 70
  /declare doLeash bool outer FALSE 
  /declare leashlength int outer 0
  /declare stakeX int outer 
  /declare stakeY int outer 
  /declare leashholder string outer Nobody
  /declare doAutoassist bool outer FALSE 
  /declare mainassist string outer Nobody
  /declare firstassist string outer Nobody
  /declare secondassist string outer Nobody
  /declare thirdassist string outer Nobody
  /declare assistpct int outer 98 
  /declare oldtargetID int outer ${Target.ID}
  /declare assisttimer timer outer 0
  /declare doDynaggro bool outer FALSE
  /declare gotHit bool outer FALSE
  /declare aggrotimer timer outer 0
  /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 ninjamode string outer TRUE
  /declare ninjadist int outer 300
  /declare doSwitch bool outer FALSE 
  /declare switchtext string outer +Undefined+
  /declare weapon1 string outer None
  /declare weapon2 string outer None
  /declare wstype string outer Detrimental
  /declare doTSwitch bool outer TRUE
  /declare lastevent string outer None
  /declare rngtarget int outer 200
  /declare rngtank int outer 100
  /declare useMU bool outer FALSE
  /declare oldheading string outer Default
  /declare doChicken bool outer FALSE
  /declare nimblehealth int outer 20
  /declare nimbletimer timer outer 0
  /declare nimbleactive timer outer 0
  /declare chickentimer timer outer 0
  /declare doDisc1 bool outer FALSE
  /declare disc1 string outer Bestial Fury
  /declare disc1end int outer 60
  /declare disc1reuse int outer 5
  /declare disc1reusetimer timer outer 
  /declare doDisc2 bool outer FALSE
  /declare disc2 string outer Kinesthetics
  /declare disc2end int outer 60
  /declare disc2reuse int outer 5
  /declare disc2reusetimer timer outer 0
  /declare discactive timer outer 0
  /declare doSummonPet bool outer FALSE 
  /declare doBuffPet bool outer FALSE
  /declare doHealPet bool outer FALSE 
  /declare Verbose bool outer FALSE
  /declare MobSlowed bool outer TRUE
  /declare Autoslow bool outer FALSE
  /declare AutoBuff bool outer FALSE
  /declare LOMon bool outer TRUE
  /declare AutoFero bool outer FALSE
  /declare SpellPetBuffClkyTimer timer outer 0
  /declare slowDuration int outer 3100
  /declare DebuffTimers[10] int outer 
  /declare midfightcast bool outer FALSE

   /declare ATKBuffed0 timer outer 0 
   /declare ATKBuffed1 timer outer 0 
   /declare ATKBuffed2 timer outer 0 
   /declare ATKBuffed3 timer outer 0 
   /declare ATKBuffed4 timer outer 0 
   /declare ATKBuffed5 timer outer 0 

   /declare FeroDelay       outer 5350

  /squelch /alias /status /echo -------=======(Current Status)=======--------
  /squelch /alias /BSThelp /echo BST Help
  /squelch /alias /stopfight /echo SetStopFighting
  /squelch /alias /autostick /echo Autostick 
  /squelch /alias /leash /echo Leash 
  /squelch /alias /autoassist /echo Autoassist 
  /squelch /alias /dynaggro /echo Dynaggro
  /squelch /alias /closeness /echo SetCloseness
  /squelch /alias /mainassist /echo SetMainassist
  /squelch /alias /secondassist /echo SetSecondassist
  /squelch /alias /thirdassist /echo SetThirdassist
  /squelch /alias /drag /echo DragBodies
  /squelch /alias /lootmycorpse /echo LootMyCorpse
  /squelch /alias /autofollow /echo AutoFollow
  /squelch /alias /iset /echo ItemSet
  /squelch /alias /ibounce /echo ItemBounce
  /squelch /alias /iclick /echo ItemCast
  /squelch /alias /pause /echo Pause
  /squelch /alias /autoninja /echo SetAutoNinja
  /squelch /alias /addmaster /echo AddMaster
  /squelch /alias /remmaster /echo RemoveMaster
  /squelch /alias /weaponswitch /echo SetWeaponSwitch
  /squelch /alias /targetswitch /echo AutoTargetSwitch
  /squelch /alias /stickdist /echo SetStickDist
  /squelch /alias /autochicken /echo SetChicken
  /squelch /alias /autodisc1 /echo SetDisc1
  /squelch /alias /autodisc2 /echo SetDisc2
  /squelch /alias /autopet /echo AutoPet
  /squelch /alias /BuffPet /echo BuffPet
  /squelch /alias /Verbose /echo Verbose
  /squelch /alias /Autoslow /echo Autoslow 
  /squelch /alias /AutoBuff /echo AutoBuff
  /squelch /alias /AutoFero /echo AutoFero 
  /squelch /alias /HealPet /echo HealPet

  |-- Read in INI settings, if defined...  Leashing is only stored TRUE if there is a Leash-holding Master!

  /if (${Ini[BSTSettings.ini,General,StopFightingHealth].NotEqual[NULL]}) /varset StopFightingHealth ${Ini[BSTSettings.ini,General,StopFightingHealth]}
  /if (${Ini[BSTSettings.ini,General,MinEndurance].NotEqual[NULL]}) /varset MinEndurance ${Ini[BSTSettings.ini,General,MinEndurance]}    
  /if (${Ini[BSTSettings.ini,General,AutoStick].NotEqual[NULL]}) /varset doStick ${Ini[BSTSettings.ini,General,AutoStick]} 
  /if (${Ini[BSTSettings.ini,General,Closeness].NotEqual[NULL]}) /varset closeness ${Ini[BSTSettings.ini,General,Closeness]} 
  /if (${Ini[BSTSettings.ini,General,Leashing].NotEqual[NULL]}) /varset doLeash ${Ini[BSTSettings.ini,General,Leashing]} 
  /if (${Ini[BSTSettings.ini,General,LeashHolder].NotEqual[NULL]}) /varset leashholder ${Ini[BSTSettings.ini,General,LeashHolder]} 
  /if (${Ini[BSTSettings.ini,General,LeashLength].NotEqual[NULL]}) /varset leashlength ${Ini[BSTSettings.ini,General,LeashLength]} 
  /if (${Ini[BSTSettings.ini,General,AutoAssist].NotEqual[NULL]}) /varset doAutoassist ${Ini[BSTSettings.ini,General,AutoAssist]} 
  /if (${Ini[BSTSettings.ini,General,AssistPercentage].NotEqual[NULL]}) /varset assistpct ${Ini[BSTSettings.ini,General,AssistPercentage]} 
  /if (${Ini[BSTSettings.ini,General,MainAssist].NotEqual[NULL]}) /varset mainassist ${Ini[BSTSettings.ini,General,MainAssist]} 
  /if (${Ini[BSTSettings.ini,General,MainAssist].NotEqual[NULL]}) /varset firstassist ${Ini[BSTSettings.ini,General,MainAssist]}
  /if (${Ini[BSTSettings.ini,General,SecondAssist].NotEqual[NULL]}) /varset secondassist ${Ini[BSTSettings.ini,General,SecondAssist]} 
  /if (${Ini[BSTSettings.ini,General,ThirdAssist].NotEqual[NULL]}) /varset thirdassist ${Ini[BSTSettings.ini,General,ThirdAssist]} 
  /if (${Ini[BSTSettings.ini,General,DynamicAggro].NotEqual[NULL]}) /varset doDynaggro ${Ini[BSTSettings.ini,General,DynamicAggro]} 
  /if (${Ini[BSTSettings.ini,General,AutoNinjaMode].NotEqual[NULL]}) /varset ninjamode ${Ini[BSTSettings.ini,General,AutoNinjaMode]} 
  /if (${Ini[BSTSettings.ini,General,AutoNinjaDistance].NotEqual[NULL]}) /varset ninjadist ${Ini[BSTSettings.ini,General,AutoNinjaDistance]} 
  /if (${Ini[BSTSettings.ini,General,WeaponSwitching].NotEqual[NULL]}) /varset doSwitch ${Ini[BSTSettings.ini,General,WeaponSwitching]}
  /if (${Ini[BSTSettings.ini,General,TargetSwitching].NotEqual[NULL]}) /varset doTSwitch ${Ini[BSTSettings.ini,General,TargetSwitching]}
  /if (${Ini[BSTSettings.ini,General,StickRangeToTarget].NotEqual[NULL]}) /varset rngtarget ${Ini[BSTSettings.ini,General,StickRangeToTarget]}
  /if (${Ini[BSTSettings.ini,General,StickRangeToTank].NotEqual[NULL]}) /varset rngtank ${Ini[BSTSettings.ini,General,StickRangeToTank]}
  /if (${Ini[BSTSettings.ini,General,AutoChicken].NotEqual[NULL]}) /varset doChicken ${Ini[BSTSettings.ini,General,AutoChicken]}
  /if (${Ini[BSTSettings.ini,General,NimbleHealth].NotEqual[NULL]}) /varset nimblehealth ${Ini[BSTSettings.ini,General,NimbleHealth]}
  /if (${Ini[BSTSettings.ini,General,AutoDisc1].NotEqual[NULL]}) /varset doDisc1 ${Ini[BSTSettings.ini,General,AutoDisc1]}
  /if (${Ini[BSTSettings.ini,General,Disc1].NotEqual[NULL]}) /varset disc1 ${Ini[BSTSettings.ini,General,Disc1]}
  /if (${Ini[BSTSettings.ini,General,Disc1Endurance].NotEqual[NULL]}) /varset disc1end ${Ini[BSTSettings.ini,General,Disc1Endurance]}
  /if (${Ini[BSTSettings.ini,General,Disc1Reuse].NotEqual[NULL]}) /varset disc1reuse ${Ini[BSTSettings.ini,General,Disc1Reuse]}
  /if (${Ini[BSTSettings.ini,General,AutoDisc2].NotEqual[NULL]}) /varset doDisc2 ${Ini[BSTSettings.ini,General,AutoDisc2]}
  /if (${Ini[BSTSettings.ini,General,Disc2].NotEqual[NULL]}) /varset disc2 ${Ini[BSTSettings.ini,General,Disc2]}
  /if (${Ini[BSTSettings.ini,General,Disc2Endurance].NotEqual[NULL]}) /varset disc2end ${Ini[BSTSettings.ini,General,Disc2Endurance]}
  /if (${Ini[BSTSettings.ini,General,Disc2Reuse].NotEqual[NULL]}) /varset disc2reuse ${Ini[BSTSettings.ini,General,Disc2Reuse]}
  /if (${Ini[BSTSettings.ini,General,AutoPet].NotEqual[NULL]}) /varset doSummonPet ${Ini[BSTSettings.ini,General,AutoPet]}
  /if (${Ini[BSTSettings.ini,General,BuffPet].NotEqual[NULL]}) /varset doBuffPet ${Ini[BSTSettings.ini,General,BuffPet]}
  /if (${Ini[BSTSettings.ini,General,HealPet].NotEqual[NULL]}) /varset doHealPet ${Ini[BSTSettings.ini,General,HealPet]}
  /if (${Ini[BSTSettings.ini,General,AutoFero].NotEqual[NULL]}) /varset AutoFero ${Ini[BSTSettings.ini,General,AutoFero]}
  /if (${Ini[BSTSettings.ini,General,Verbose].NotEqual[NULL]}) /varset Verbose ${Ini[BSTSettings.ini,General,Verbose]}
  /if (${Ini[BSTSettings.ini,General,Autoslow].NotEqual[NULL]}) /varset Autoslow ${Ini[BSTSettings.ini,General,Autoslow]}
  /if (${Ini[BSTSettings.ini,General,AutoBuff].NotEqual[NULL]}) /varset AutoBuff ${Ini[BSTSettings.ini,General,AutoBuff]}
  /if (${Ini[BSTSettings.ini,Weapons,Weapon1].NotEqual[NULL]}) /varset weapon1 ${Ini[BSTSettings.ini,Weapons,Weapon1]}
  /if (${Ini[BSTSettings.ini,Weapons,Weapon2].NotEqual[NULL]}) /varset weapon2 ${Ini[BSTSettings.ini,Weapons,Weapon2]}
  /if (${Ini[BSTSettings.ini,Weapons,SwitchText].NotEqual[NULL]}) /varset switchtext ${Ini[BSTSettings.ini,Weapons,SwitchText]}
  /varset wstype ${FindItem[${weapon1}].Spell.SpellType}

  |- Build Empty master list in BSTSettings.ini file if it doesn't exist
  /if (!${Ini[BSTSettings.ini,Masters,Controller1].Length}) {
    |- It's not in there yet
    /declare i int local
    /for i 1 to 34
      /ini "BSTSettings.ini" "Masters" "Controller${i}" "Nobody"
    /next i
  }

  /varset MobSlowed FALSE
  /varset LOMon FALSE


  /echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 
  /echo Mystikule's Hacked up Beastlord Helper Macro (v5.8.1a) Starting... 
  /echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 
  /echo Use "/BSThelp" to display help information
  /echo -------=======(Current Status)=======--------  

  /call MemSpells
  
  :ForeverLoop 

   |- Service any events 

   /call CheckGM
   /doevents 
   /if (${Me.SpellReady[${SpellATK}]} && ${AutoFero} && ${Me.PctMana}>50) /call Cast_Fero
   /if (${doHealPet}  && ${Me.Pet.ID}) /call Heal_Pet
         /if (${Autoslow}) /call CheckDebuffTimers

   |- If we're stunned or RH is paused, just service events 

   /if (${Me.State.Equal[STUN]} || ${isPaused}) {
     /delay 2
     /goto :ForeverLoop 
   }

   |- While fighting or not fighting...

   |- Turn attacking back on if enraged target, and no longer facing it
   /if (${isEnraged} && ${Target.ID} && ${doAutoassist} && !${Me.Combat}) {
     /call Check_Behind
     /varset behindTarget ${Macro.Return} 
     /if (${Target.ID} && ${behindTarget}) {
       /attack on
	   /if (${Me.Sitting} && ${Me.Combat}) /stand
       /echo ** Attack re-started (No Enrage Risk): ${Target.CleanName}
     }  
   }

   |- Check if we should chicken out
   /if (${doChicken} && (${Me.PctHPs}<=${nimblehealth}) && !${chickentimer}) {
     /echo Autochicken to the rescue!
     /if (!${nimbletimer}) {
       /disc Protective Spirit
       /echo Nimble mode activated!
       /varset nimbletimer 4m
       /varset nimbleactive 12s
     }  else {
       /echo ... or not! Can't escape, can't nimble... Farewell!
       /varset chickentimer 4s
     }
   }

   |- Stop fighting if we lose our target
   /if (${Me.Combat} && !${Target.ID}) {
      /attack off 
      /pet back off
      /pet hold
      }
   |- Are we suposed to stick to a target?
   /if (${Me.Combat} || ${Target.ID} && ${doStick} && (${Target.PctHPs}<=${assistpct}) && (${Target.Distance}<${rngtarget}) && ${Target.Type.Equal[NPC]} && !${aggrotimer.Value} && !${Me.TargetOfTarget.Name.Equal[${Me}]}) { 
     
     |- Check to see if we're too far from our tank (if applicable)
     /if (${doAutoassist} && (${Spawn[${mainassist}].Distance}>${rngtank})) {
       /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
       /goto :DoneSticking
     }

     |- Use MQ2MoveUtils ? If so, start sticking and bypass RH movement tools
     /if (${useMU} && ${Stick.Status.Equal[OFF]}) {
       /if (${Me.Underwater}) {
         /squelch /stick ${closeness}% mpause uw 
       } else {
         /squelch /stick ${closeness}% mpause
       }
       /goto :DoneSticking
     }

     /if (${Target.ID}) /face ${If[${Me.Underwater},,nolook]} 

     |- If we're too far away to hit it, get 1 second closer, unless we can hit it in less time 
     /if (${Target.Distance}>${Math.Calc[${Target.MaxRangeTo}*${closeness}/100]}) { 

       |- Set current position first before potentially moving (in case we get stuck) 
       /varset X ${Me.X} 
       /varset Y ${Me.Y}  

       /if (!${Target.ID}) /goto :Foreverloop 

       |- Move
       /keypress forward hold 
       /delay 1s ${Target.Distance}<${Math.Calc[${Target.MaxRangeTo}*${closeness}/100]} 
       /keypress forward 

       |- Check to see if we got stuck trying that 
       /if ((${Me.X}==${X}) && (${Me.Y}==${Y})) { 
         |- We're stuck, back off a second, move left or right (randomly) for .5 seconds 
         /echo We're STUCK on something, backing up... 
         /keypress back hold 
         /delay 1s 
         /keypress back 
         /if (${Math.Rand[2]}) { 
           /varset strafedir STRAFE_LEFT 
         } else { 
           /varset strafedir STRAFE_RIGHT 
         } 
         /echo Unsticking: Strafing ${strafedir} a half-second... 
         /keypress ${strafedir} hold 
         /delay 5 
         /keypress ${strafedir} 
       } 
     } 

     /if (!${Target.ID}) /goto :Foreverloop 

     |- If we are close enough to hit it, lets try to get behind it a little bit at a time 

     /if (${Target.Distance}<=${Target.MaxRangeTo}) { 
        
       /call Check_Behind
       /varset behindTarget ${Macro.Return}    

       |- If we're not behind it, strafe around it a little 
       /if (!${behindTarget} && ${Me.TargetOfTarget.Name.NotEqual[${Me}]}) { 
         |- Which way do we strafe? 
         /varcalc delta ${Me.Heading.Clock}-${Target.Heading.Clock} 
         /if (${delta}>6) /varcalc delta ${delta}-12 
         /if (${delta}<-6) /varcalc delta ${delta}+12 
         /if (${delta}<0) { 
           /varset strafedir STRAFE_LEFT 
         } else { 
           /varset strafedir STRAFE_RIGHT 
         } 
         |- Set current position first before moving (in case we get stuck) 
         /varset X ${Me.X} 
         /varset Y ${Me.Y}    
 
         /if (!${Target.ID}) /goto :Foreverloop  

         |- Execute a strafe in the correct direction 
         /keypress ${strafedir} hold 
         /delay 2
         /keypress ${strafedir} 
         /if (${Target.ID}) /face fast ${If[${Me.Underwater},,nolook]} 
         |- Check if we're stuck and warn if so (go through target to fix it)
         /if ((${Me.X}==${X}) && (${Me.Y}==${Y})) { 
           /echo We're STUCK trying to get behind target!
           /delay 1s
         } 
       } 
     } 
   } else {
     /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
   }
   :DoneSticking

   |- Check on switching weapons (assuming it's a buff-weapon and buff is down)

   /if (${doSwitch} && ${wstype.Equal[Beneficial]}) {
     /varset itemspellname ${FindItem[${weapon1}].Spell}
     /if (${itemspellname.NotEqual[${Me.Buff[${itemspellname}]}]} && !${FindItem[${weapon1}].InvSlot.Name.Equal[mainhand]} && !${FindItem[${weapon1}].InvSlot.Name.Equal[offhand]}) {
       /echo ** Beneficial proc-weapon swapping...
       /call Weapon_Swap "${weapon1}" "${weapon2}"
     }
   }

    |- Are we fighting? 

    /if (${Me.Combat}) { 
     |- ** We are fighting ** 

     |- Respond to enraged targets
     /if (${isEnraged} && ${Target.ID}) {
         /pet back off
	 /pet hold
       /call Check_Behind
       /varset behindTarget ${Macro.Return} 
       /if (${Target.ID} && !${behindTarget}) {
         /attack off
         /echo ** Attack ceased (Enrage Risk): ${Target.CleanName}
       }  
     }

  
     |- Check up on tank(s) health/presence, update main assist as needed
     /if (${doAutoassist} && ${mainassist.Equal[Main]}) /goto :BypassTanks
     /if (${doAutoassist} && (!${Spawn[${mainassist}].ID} || !${mainassist.Equal[${firstassist}]})) {
       /if (${Spawn[${firstassist}].ID}) {
         /varset mainassist ${firstassist}
         /echo ** Main assist *SWITCHED* to: ${mainassist}
       } else /if (${Spawn[${secondassist}].ID}) {
         /varset mainassist ${secondassist}
         /echo ** Main assist *SWITCHED* to: ${mainassist}
       } else /if (${Spawn[${thirdassist}].ID}) {
         /varset mainassist ${thirdassist}
         /echo ** Main assist *SWITCHED* to: ${mainassist}
       } else {
         |- Uh oh, all set tanks are dead, zoned or otherwise missing
         /varset doAutoassist FALSE 
         /echo ** All assists are dead or missing!
         /echo ** Autoassist is now OFF! 
         /if (!${leashholder.Equal[Nobody]}) /tell ${leashholder} ACK! All tanks are dead or missing!
       }
     }
     :BypassTanks

     |- Check up on our autoassist targets if applicable, and switch if MA switches (1 second checks)
     /if (${doTSwitch} && ${doAutoassist} && ${Target.ID} && !${assisttimer}) {
       /varset oldtargetID ${Target.ID}
       /assist ${mainassist}
       /varset assisttimer 1s
     }

     |- Did we just switch targets?  If so, turn off attack and start the loop over!
     /if (${doAutoassist} && ${Target.ID}!=${oldtargetID}) {
       /echo --> *SWITCH* target to: ${Target.CleanName}
       /varset oldtargetID ${Target.ID}
       /attack off
       /pet back off
       /pet hold
       /delay 2
       /goto :ForeverLoop
     }

     |- Check for leash tugging and move back to stake some if so 
     /if (${doLeash}) { 
       /if (${leashholder.Equal[Nobody]} && (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>${leashlength})) {
         /echo CHOKE! We're at the leash's length! (${leashlength} ft.) 
         /face ${If[${Me.Underwater},,nolook]} loc ${stakeY},${stakeX} 
         /keypress forward hold 
         /delay 1s ${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<10 
         /keypress forward         
         |- Slow 180degree turns take time, and we may have turned off attack, so...
         /goto :Foreverloop
       }
       /if (!${leashholder.Equal[Nobody]} && ${Spawn[${leashholder}].ID} && (${Spawn[${leashholder}].Distance}>${leashlength})) {
         /echo CHOKE! Tugging on ${leashholder}'s leash! (${leashlength} ft.) 
         /squelch /face ${If[${Me.Underwater},,nolook]} id ${Spawn[${leashholder}].ID}
         /keypress forward hold 
         /delay 1s ${Spawn[${leashholder}].Distance}<10 
         /keypress forward         
         |- Slow 180degree turns take time, and we may have turned off attack, so...
         /goto :Foreverloop
       }
       |- Broken leash check
       /if (!${leashholder.Equal[Nobody]} && !${Spawn[${leashholder}].ID}) {
         /echo ** Master DEAD or ZONED! Leash is BROKEN! 
         /varset doLeash FALSE
         /varset leashholder Nobody
         /ini "BSTSettings.ini" "General" "Leashing" "${doLeash}" 
         /ini "BSTSettings.ini" "General" "LeashHolder" "${leashholder}" 
         /goto :Foreverloop
       }
     } 

     |- Are we standing, have a target, have Kick ready and can we stick it in the back? 

     /call Check_Behind
     /varset behindTarget ${Macro.Return} 
     /if (${Target.ID} && ${Me.Standing} && ${behindTarget} && (${Target.Distance}<${Math.Calc[${Target.MaxRangeTo}*${closeness}/100]})) { 
       /if (${Me.AbilityReady["Kick"]}) { 
         /doability "Kick"
	 /echo Kicking: ${Target.CleanName} 
       } 
     } 

     |- Are we tanking?  If so, just Kick it in the face if we can! 

     /if (${Target.ID} && ${Me.Standing} && (${aggrotimer.Value} || ${Me.TargetOfTarget.Name.Equal[${Me}]})) { 
       /if (${Me.AbilityReady["Kick"]}) { 
         /doability "Kick" 
         /echo Tanking -> Kicking: ${Target.CleanName} 
       } 
     } 

   
     |- Are we so hurt we should stop fighting for a bit? 

     /if (${Me.PctHPs}<=${StopFightingHealth}) { 
       /attack off 
       /echo Getting my ass kicked, ceasing combat! 
     } 

     |- Shall we do our optional discs?

     /if (${doDisc1} && !${disc1reusetimer} && !${discactive} && !${strikeTimer} && ${Me.PctEndurance}>=${disc1end}) {
       /disc ${disc1}
       /echo Disc #1: ${disc1} activated
       /varset disc1reusetimer ${disc1reuse}m
       /varset discactive 1m
     }

     /if (${doDisc2} && !${disc2reusetimer} && !${discactive} && !${strikeTimer} && ${Me.PctEndurance}>=${disc2end}) {
       /disc ${disc2}
       /echo Disc #2: ${disc2} activated
       /varset disc2reusetimer ${disc2reuse}m
       /varset discactive 1m
     }

    } else { 
     |- ** We are not fighting

     |- If we're not hiding or moving, check clicky maintained spells
     /if (${Me.Invis} || ${Me.Moving} || ${clicktimer}) /goto :DoneItemChecks
     /varset n 1
     :ItemCheckLoop
     /varset ialias ${Ini[RHItems.ini].Arg[${n},|]}
     /if (${ialias.NotEqual[NULL]}) {
       |- Obtained an itemalias from the RHItems.ini file
       |- We supposed to keep this spell up?
       /if (${Ini[RHItems.ini,${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[RHItems.ini,${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[RHItems.ini,${ialias},FullName]}].Spell}
       /if (${itemspellname.Equal[${Me.Buff[${itemspellname}]}]}) /varset doIclick FALSE
       |- Finally, do it if we should
       /if (${doIclick}) /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 n ${n}+1
     } else /goto :DoneItemChecks
     /goto :ItemCheckLoop
     :DoneItemChecks

  |- Buffs
   /if (${AutoBuff} && ${Me.PctMana}>25 && !${Me.Combat}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.TargetOfTarget.Name.Equal[${Me}]}) /goto :nobuffs
	/call GroupBuffs  
	/call SelfBuffs
	}

  |- Pet 
   /if (!${Me.Pet.ID} && ${doSummonPet} && ${Spell[${SpellPet}].Mana} <= ${Me.CurrentMana}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.TargetOfTarget.Name.Equal[${Me}]}) /goto :nobuffs
	/attack off
	/if (${PetFocusON}) {
        	/call EquipItem ${PetFocusItem}
		/varset PetFocusOld ${Macro.Return} 
		}
		:recastpet
		/call cast ${SpellPet} gem1 9s
         	 /if (${Macro.Return.NotEqual["CAST_SUCCESS"]}) /goto :recastpet
	/if (${PetFocusON}) /call EquipItem ${PetFocusOld}
	}
   /if (${Me.Pet.ID} && ${doBuffPet} && ${Me.PctMana}>35) {
	/if (${Target.Type.Equal[NPC]} && ${Me.TargetOfTarget.Name.Equal[${Me}]}) /goto :nobuffs
   	/if ( !${Me.Gem[${SpellPetHeal}]} && ${doHealPet}) { 
		/memspell 1 ${SpellPetHeal}
		/delay 45
		}
	/call BuffPet 
	}


  |- ManaCheck
	/if (!${LOMon}) {
	/if (${Me.PctMana} < 25) {
	/if (${Verbose}) /gsay lom atm sigh.....
	/varset LOMon TRUE
	} else {
	/varset LOMon FALSE
	}
	}
	

  |- Fero rot
   /if (${Me.SpellReady[${SpellATK}]} && ${AutoFero} && ${Me.PctMana}>50) /call Cast_Fero

:nobuffs   
  |- It's possible we're poised for attack, check and fight if so 

     /call Check_Behind
     /varset behindTarget ${Macro.Return} 
     /if (${Target.ID} && ${Target.Type.Equal[NPC]} && ${Me.Standing} && (${Target.PctHPs}<=${assistpct})) { 
	 /if ( ${Me.Mount.ID} ) /dismount
           /echo --> Assisting ${mainassist} on ${Target.CleanName} @ (${Target.PctHPs}%) HPs  
         /if (${Autoslow}) {
	 /call CheckDebuffTimers
	 /call Slow
	 }
         /if (${Me.AbilityReady["Kick"]}) {
	 /doability "Kick" 
         /attack on
	   /if (${Me.Sitting} && ${Me.Combat}) /stand
         /pet attack 
       } 
     } 
  
     |- If we're set to autoassist, lets monitor the main tank's target 
     /if (${doAutoassist} && !${isEnraged}) { 
       |- Is main assist alive/in-zone? 
       /if ((${Spawn[pc ${mainassist}].ID} || ${mainassist.Equal[Main]}) && !${assisttimer}) { 
         |- Main tank is alive 
         /assist ${mainassist} 
         /varset oldtargetID ${Target.ID}
         /varset assisttimer 1s
         |- Do we have an NPC targeted and is it hurt enough to attack? 
         /if (${Target.ID} && ${Target.Type.Equal[NPC]} && !${Me.Combat} && (${Target.PctHPs}<=${assistpct})) { 
           /echo --> Assisting ${mainassist} on ${Target.CleanName} @ (${Target.PctHPs}%) HPs 
           /goto :Foreverloop      
         } 
       } 
     } 

 
     |- We could be on a leash, if so move 1s closer to our stake point (or master)
     /if (${doLeash} && !${Target.Type.Equal[NPC]} && !${Me.Combat}) { 
       /if (${leashholder.Equal[Nobody]} && (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>10)) {
         /echo Moving closer to the Stake... ${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]} ft. away 
         /face ${If[${Me.Underwater},,nolook]} loc ${stakeY},${stakeX} 
         /keypress forward hold 
         /delay 1s ${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<10 
         /keypress forward 
         /if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<10) {
           /echo Arrived near the Stake. 
           /face fast ${If[${Me.Underwater},,nolook]} away loc ${stakeY},${stakeX}
	   /if (${Me.PctMana} < 25 && ${Me.Standing} && !${Me.Combat} && !${Me.Casting}) /sit
         }
       }
       /if (!${leashholder.Equal[Nobody]} && ${Spawn[${leashholder}].ID} && (${Spawn[${leashholder}].Distance}>10)) {
         /echo Moving closer to ${leashholder}... ${Spawn[${leashholder}].Distance} ft. away 
         /if (${Target.ID}!=${Spawn[${leashholder}].ID}) /target id ${Spawn[${leashholder}].ID}
         /if (${Me.Combat}) {
	    /attack off
	    /pet bak
	    }
         /face ${If[${Me.Underwater},,nolook]}
         /keypress forward hold 
         /delay 1s ${Spawn[${leashholder}].Distance}<10  
         /keypress forward 
         /if (${Spawn[${leashholder}].Distance}<10) /echo Arrived near Master (${leashholder}). 
       }
       |- Broken leash check
       /if (!${leashholder.Equal[Nobody]} && !${Spawn[${leashholder}].ID}) {
         /echo ** Master DEAD or ZONED! Leash is BROKEN! 
         /varset doLeash FALSE
         /varset leashholder Nobody
         /ini "BSTSettings.ini" "General" "Leashing" "${doLeash}" 
         /ini "BSTSettings.ini" "General" "LeashHolder" "${leashholder}" 
       }
     } 
   } 

  /goto :ForeverLoop 
/return 

|---- SUBROUTINES

Sub Check_Behind
  /declare behindIt FALSE 
  |- Are we behind our target? 
  /for n -1 to 1 
    /varcalc dir (${Target.Heading.Clock}+${n})%12 
    /if (${dir}<1) /varcalc dir ${dir}+12 
    /if (${dir}>12) /varcalc dir ${dir}-12 
    /if (${dir} == ${Me.Heading.Clock}) /varset behindIt TRUE 
  /next n    
/return ${behindIt}

Sub Weapon_Swap(string weapon, string wieldedweapon)
  |- Is it in a Bag?
  /declare camefrom ${FindItem[${weapon}].InvSlot}
  /declare goingto ${FindItem[${wieldedweapon}].InvSlot}
  /echo ** 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
    /echo ** Swapping out: ${weapon}
    /itemnotify ${InvSlot[${camefrom}]} leftmouseup
    /delay 2
    /if (${Cursor.ID}) {
      /echo ** 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
      /echo ** Swapping out: ${weapon}
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup
      /delay 2
      /if (${Cursor.ID}) {
        /echo ** Failed to use existing slot, dropping to inventory!
        /autoinv
      }
    } else {
      /echo ** "${weapon}" not found!
    }
  }
/return

Sub NinjaLoot
  |- Ninja the corpse's loot, if applicable
  /if (${ninjamode.NotEqual[OFF]}) {
    /declare LootTotal int local -1
    /declare LootSlot int local
    |- Get NPC corpse on target and continue if possible
    /squelch /target npc corpse radius ${ninjadist} 
    /if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) { 
      /echo ** NPC corpse out of range or already looted! 
      /return
    }   
    |- Get 5 seconds (max) closer; warning, no detecting being stuck!
    /face ${If[${Me.Underwater},,nolook]} fast
    /keypress forward hold 
    /delay 5s ${Target.Distance}<5 
    /keypress forward 
    |- Open up the loot window
    /loot 
    /delay 1s
    /if (${Me.State.NotEqual[BIND]}) {
      /echo ** Massive lag or error getting to corpse.  Aborting!
      /return
    }
    /echo ** Looting ${Target.CleanName}  
    |- Get item count accurately  
    :LootLag 
    /if (${LootTotal}!=${Corpse.Items}) { 
      /varset LootTotal ${Corpse.Items} 
      /delay 5 
      /goto :LootLag 
    } 
    /if (!${LootTotal}) {
      /echo ** Empty corpse!
      /goto :DoneLooting
    }
    |- Loot Loop
    /for LootSlot 1 to ${LootTotal} 
      |- Check for full inventory
      /if (!${Me.FreeInventory}) {
        /beep
        /echo ** INVENTORY FULL !
        /varset ninjamode OFF
        /echo ** AutoNinja is now OFF!
        /goto :DoneLooting
      }
      |- Loot item if we should, skip it if not
      /if (${Corpse.Item[${LootSlot}].ID}) {
        /if (!${Corpse.Item[${LootSlot}].NoDrop}) /goto :LootItem
        /if (${Corpse.Item[${LootSlot}].NoDrop} && ${ninjamode.Equal[ALL]}) {
          /echo ** Looting NODROP Item: ${Corpse.Item[${LootSlot}].Name}
          /goto :LootItem
        }
      }
      /echo ** Skipping Item: ${Corpse.Item[${LootSlot}].Name}
      /goto :SkipIt
      :LootItem 
      /itemnotify loot${LootSlot} rightmouseup 
      /delay 3
      /if (${Corpse.Item[${LootSlot}].ID}) { 
        /delay 2
        /goto :LootItem
      } 
      :SkipIt
    /next LootSlot
    /echo ** Done looting ${Target.CleanName}
    :DoneLooting
    /delay 5
    /notify LootWnd DoneButton leftmouseup 
    /delay 5
  }
/return

|---- EVENTS



Sub Event_AttackOn 
  /varset lastevent Event_AttackOn
  /echo Autoattack activated! Target: ${Target.CleanName}
/return 

Sub Event_AttackOff 
  /varset lastevent Event_AttackOff
  /echo Autoattack turned off! Target: ${Target.CleanName} 
/return 

Sub Event_Enraged 
  /varset lastevent Event_Enraged
  /echo Enrage detected! Target: ${Target.CleanName} 
  /pet back off
  /pet hold
  /varset isEnraged TRUE 
/return 

Sub Event_NLEnraged 
  /varset lastevent Event_NLEnraged
  /echo Enrage done! Target: ${Target.CleanName} 
  /varset isEnraged FALSE 
  /if (${Target.ID} && ${doAutoassist}) {
	/attack on
	   /if (${Me.Sitting} && ${Me.Combat}) /stand 
	/pet attack
	}
/return 

Sub Event_Exp(string Line)
  /varset lastevent Event_Exp
  |- Ignore leadership experience event triggers (redundant trigger)
  /if (${Line.Find[leadership]}) /return

  |- Manage aggro control here optionally
  /if (${doDynaggro} && ${doAutoassist}) {
    /if (${gotHit}) {
      |- Got hurt that fight, drop it 1%
      /if (${assistpct}>1) /varcalc assistpct ${assistpct}-1
      /varset gotHit FALSE
      /echo ** Had Aggro! Reducing assist% to ${assistpct}%
    } else {
      |- Did not get hurt that fight, raise it 1%
      /if (${assistpct}<99) /varcalc assistpct ${assistpct}+1
      /echo ** No Aggro! Raising assist% to ${assistpct}%
    }
  }

  |- Experience calculation and reporting
  /echo ** 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} 

  |- If target died while enraged, reset it so autoassist isn't broken...
  /varset isEnraged FALSE 

  |- Reset Slow debuff
  /varset MobSlowed FALSE

  |- Do weapon swapping (back to weapon1), if applicable
  /if (${doSwitch} && ${wstype.Equal[Detrimental]}) {
    /call Weapon_Swap "${weapon1}" "${weapon2}"
  } 
/return 

Sub Event_Slain
  /varset lastevent Event_Slain
  /call NinjaLoot
/return

Sub Event_Zoned
  /varset lastevent Event_Zoned
  /echo ** Zoned... Setting Leash and Autoassist to OFF!
  /varset doLeash FALSE
  /varset doAutoassist FALSE
  /varset MobSlowed FALSE
  /ini "BSTSettings.ini" "General" "AutoAssist" "${doAutoassist}"
  /ini "BSTSettings.ini" "General" "Leashing" "${doLeash}" 
/return 


Sub Event_SetStopFighting(string Line)
  /varset lastevent Event_SetStopFighting
  /if (${Line.Arg[3].Length}) /varset StopFightingHealth ${Line.Arg[3]}
  /if ((${StopFightingHealth}<0) || (${StopFightingHealth}>100)) {
    /echo Whacko stopfighting percentage input! Defaulting...
  }
  /echo ** Cease Combat when at: ${StopFightingHealth}% HP 
  /ini "BSTSettings.ini" "General" "StopFightingHealth" "${StopFightingHealth}"
/return


Sub Event_SetEndFloor(string Line)
  /varset lastevent Event_SetEndFLoor
  /if (${Line.Arg[3].Length}) /varset MinEndurance ${Line.Arg[3]}
  /if ((${MinEndurance}<0) || (${StopFightingHealth}>101)) {
    /echo Whacko endurance percentage input! Defaulting...
  }
  /echo ** Endurance Floor: ${MinEndurance}% 
  /ini "BSTSettings.ini" "General" "MinEndurance" "${MinEndurance}"
/return

Sub Event_TogStick 
  /varset lastevent Event_TogStick
  /if (${doStick}) { 
    /varset doStick FALSE 
    /echo ** Auto-Sticking target is now OFF! 
  } else { 
    /varset doStick TRUE 
    /echo ** Auto-Sticking target is now ON! 
  } 
  /ini "BSTSettings.ini" "General" "AutoStick" "${doStick}"
/return 


Sub Event_TogLeash(string Line) 
  /varset lastevent Event_TogLeash
  /if (${Line.Arg[3].Equal[OFF]} || (${Int[${Line.Arg[3]}]}<=0)) { 
    /varset doLeash FALSE 
    /varset leashholder Nobody
    /echo ** Leashing is now OFF!
    /ini "BSTSettings.ini" "General" "Leashing" "${doLeash}" 
  } else { 
    /if (${Line.Arg[4].Length}) {
      /varset leashholder ${Line.Arg[4]}
      /if (${Spawn[${leashholder}].ID}) {
        /varset doLeash TRUE
        /varset leashlength ${Int[${Line.Arg[3]}]}
        /echo ** Leashing is now ON! Leashlength: ${leashlength} ft. 
        /echo ** Leash-holding master is: ${leashholder}
        /ini "BSTSettings.ini" "General" "Leashing" "${doLeash}" 
      } else {
        |- This spawn/thing/target doesn't exist
        /echo ** Can't find "${leashholder}" -- Who is that?!
        /echo ** Leashing is now OFF! 
        /varset doLeash FALSE 
        /varset leashholder Nobody
      }
    } else {
      /varset doLeash TRUE 
      /varset leashholder Nobody
      /varset leashlength ${Int[${Line.Arg[3]}]} 
      /varset stakeX ${Me.X} 
      /varset stakeY ${Me.Y} 
      /echo ** Leashing is now ON! Leashlength: ${leashlength} ft. 
      /echo ** Stake planted at X:${stakeX}, Y:${stakeY} 
    }
  } 
  /ini "BSTSettings.ini" "General" "LeashHolder" "${leashholder}" 
  /ini "BSTSettings.ini" "General" "LeashLength" "${leashlength}" 
/return 

Sub Event_TogAuto(string Line) 
  /varset lastevent Event_TogAuto
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doAutoassist FALSE 
    /echo ** Autoassist is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doAutoassist TRUE 
    /echo ** Autoassist is now ON! 
  } else { 
    /varset doAutoassist TRUE 
    /if (${Line.Arg[3].Length}) /varset firstassist ${Line.Arg[3]} 
    /varset mainassist ${firstassist} 
    /if (${Line.Arg[4]} > 0) /varset assistpct ${Line.Arg[4]} 
    /echo ** Autoassist is now ON! 
    /echo ** Assisting: ${mainassist} @${assistpct}% target health 
    /echo ** SA is ${secondassist} & TA is ${thirdassist}
  } 
  /ini "BSTSettings.ini" "General" "AutoAssist" "${doAutoassist}"
  /ini "BSTSettings.ini" "General" "MainAssist" "${firstassist}"
  /ini "BSTSettings.ini" "General" "AssistPercentage" "${assistpct}"
/return 

Sub Event_TogPause 
  /varset lastevent Event_TogPause
  /beep
  /if (${isPaused}) { 
    /varset isPaused FALSE 
    /echo ** Beastlord Helper is now RESUMING! 
  } else { 
    /varset isPaused TRUE 
    /echo ** Beastlord Helper is now PAUSED!
  } 
/return 


Sub Event_TogTSwitch 
  /varset lastevent Event_TogTSwitch
  /if (${doTSwitch}) { 
    /varset doTSwitch FALSE 
    /echo ** Auto-Target Switching is now OFF! 
  } else { 
    /varset doTSwitch TRUE 
    /echo ** Auto-Target Switching is now ON! 
  } 
  /ini "BSTSettings.ini" "General" "TargetSwitching" "${doTSwitch}"
/return 


Sub Event_SetCloseness(string Line)
  /varset lastevent Event_SetCloseness
  /if (${Line.Arg[3].Length}) /varset closeness ${Line.Arg[3]}
  /if ((${closeness}<1) || (${closeness}>100)) {
    /echo Whacko closeness percentage input! Defaulting...
  }
  /echo ** AutoStick: ${doStick}, Closeness: ${closeness}
  /ini "BSTSettings.ini" "General" "Closeness" "${closeness}"
/return

Sub Event_SetFirstassist(string Line)
  /varset lastevent Event_SetFirstassist
  /if (${Line.Arg[3].Length}) /varset firstassist ${Line.Arg[3]}
  /varset mainassist ${firstassist}
  /echo ** Assisting: ${mainassist} @${assistpct}% target health 
  /echo ** SA is ${secondassist} & TA is ${thirdassist}
  /ini "BSTSettings.ini" "General" "MainAssist" "${firstassist}"
/return

Sub Event_SetSecondassist(string Line)
  /varset lastevent Event_SetSecondassist
  /if (${Line.Arg[3].Length}) /varset secondassist ${Line.Arg[3]}
  /echo ** Assisting: ${mainassist} @${assistpct}% target health 
  /echo ** SA is ${secondassist} & TA is ${thirdassist}
  /ini "BSTSettings.ini" "General" "SecondAssist" "${secondassist}"
/return

Sub Event_SetThirdassist(string Line)
  /varset lastevent Event_SetThirdassist
  /if (${Line.Arg[3].Length}) /varset thirdassist ${Line.Arg[3]}
  /echo ** Assisting: ${mainassist} @${assistpct}% target health 
  /echo ** SA is ${secondassist} & TA is ${thirdassist}
  /ini "BSTSettings.ini" "General" "ThirdAssist" "${thirdassist}"
/return

Sub Event_SetAutoNinja(string Line) 
  /varset lastevent Event_SetAutoNinja
  |- Set the new ninja distance, if supplied
  /if (${Line.Arg[4].Length}) /varset ninjadist ${Line.Arg[4]}
  |- Set the mode, toggle off if unknown
  /if (${Line.Arg[3].Equal[ALL]}) { 
    /varset ninjamode ALL
    /echo ** AutoNinja ON - Will loot ALL items 
    /docommand /lootnodrop never
  } else /if ((${Line.Arg[3].Equal[DROP]}) || (${Line.Arg[3].Equal[DROPABLE]})) { 
    /varset ninjamode DROPABLE
    /echo ** AutoNinja ON - Will loot only DROPABLE items
    /docommand /lootnodrop never
  } else {
    /varset ninjamode OFF
    /echo ** AutoNinja is now OFF!
  }
  /echo ** AutoNinja distance is ${ninjadist} ft.
  /ini "BSTSettings.ini" "General" "AutoNinjaMode" "${ninjamode}"
  /ini "BSTSettings.ini" "General" "AutoNinjaDistance" "${ninjadist}"
/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
    /echo ** 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  
  /echo ** Auto Weapon Switching is ON
  /echo ** ${weapon1} will be swapped out for ${weapon2}
  /echo ** if the text "${switchtext}" is encountered.

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

Last edited by mystikule on Thu Jul 14, 2005 6:03 pm, edited 6 times in total.

mystikule
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jul 17, 2004 9:23 pm

Post by mystikule » Sat Apr 02, 2005 7:52 pm

part 2 of 2

Code: Select all


Sub Event_SetStickDist(string Line) 
  /varset lastevent Event_SetStickDist
  |- Sanity Check
  /if (!${Line.Arg[3].Length} || !${Line.Arg[4].Length}) { 
    /echo ** What? Bad Syntax.
    /echo Syntax:
    /echo /stickdist <range_to_target> <range_to_tank>
    /return
  }
  |- Set the weaponswitching information
  /varset rngtarget ${Line.Arg[3]}
  /varset rngtank ${Line.Arg[4]}
  /echo ** Auto Stick: ${doStick}, Closeness: ${closeness}% MaxRange
  /echo ** -- Range to Target: ${rngtarget} -- Range to Tank: ${rngtank}
  /ini "BSTSettings.ini" "General" "StickRangeToTarget" "${rngtarget}"
  /ini "BSTSettings.ini" "General" "StickRangeToTank" "${rngtank}"
/return 

Sub Event_SetChicken(string Line) 
  /varset lastevent Event_SetChicken
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doChicken FALSE 
    /echo ** Autochicken is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doChicken TRUE 
    /echo ** Autochicken is now ON! 
  } else { 
    /varset doChicken TRUE 
    /if (${Line.Arg[3].Length}) /varset nimblehealth ${Line.Arg[3]} 
    /echo ** Auto Chicken: ${doChicken} -- Nimble: ${nimblehealth}% 
  } 
  /ini "BSTSettings.ini" "General" "AutoChicken" "${doChicken}"
  /ini "BSTSettings.ini" "General" "NimbleHealth" "${nimblehealth}"
/return 

Sub Event_SetDisc1(string Line) 
  /varset lastevent Event_SetDisc1
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doDisc1 FALSE 
    /echo ** Autodisc #1 is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doDisc1 TRUE 
    /echo ** Autodisc #1 is now ON! 
  } else { 
    /varset doDisc1 TRUE 
    /if (${Line.Arg[3].Length}) /varset disc1 ${Line.Arg[3]} 
    /if (${Line.Arg[4]} > 0) /varset disc1end ${Line.Arg[4]} 
    /if (${Line.Arg[5]} > 0) /varset disc1reuse ${Line.Arg[5]} 
    /echo ** Auto Disc #1: ${doDisc1} -> ${disc1}/${disc1reuse} mins - End: ${disc1end}
  } 
  /ini "BSTSettings.ini" "General" "AutoDisc1" "${doDisc1}"
  /ini "BSTSettings.ini" "General" "Disc1" "${disc1}"
  /ini "BSTSettings.ini" "General" "Disc1Endurance" "${disc1end}"
  /ini "BSTSettings.ini" "General" "Disc1Reuse" "${disc1reuse}"
/return

Sub Event_SetDisc2(string Line) 
  /varset lastevent Event_SetDisc2
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doDisc2 FALSE 
    /echo ** Autodisc #2 is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doDisc2 TRUE 
    /echo ** Autodisc #2 is now ON! 
  } else { 
    /varset doDisc2 TRUE 
    /if (${Line.Arg[3].Length}) /varset disc2 ${Line.Arg[3]} 
    /if (${Line.Arg[4]} > 0) /varset disc2end ${Line.Arg[4]} 
    /if (${Line.Arg[5]} > 0) /varset disc2reuse ${Line.Arg[5]} 
    /echo ** Auto Disc #2: ${doDisc2} -> ${disc2}/${disc2reuse} mins - End: ${disc2end}
  } 
  /ini "BSTSettings.ini" "General" "AutoDisc2" "${doDisc2}"
  /ini "BSTSettings.ini" "General" "Disc2" "${disc2}"
  /ini "BSTSettings.ini" "General" "Disc2Endurance" "${disc2end}"
  /ini "BSTSettings.ini" "General" "Disc2Reuse" "${disc2reuse}"
/return

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

Sub Event_TogPet(string Line)
   /varset lastevent Event_TogPet
   /if (${Line.Arg[3].Equal[ON]}) { 
      /varset doSummonPet TRUE 
      /echo ** AutoSummon Pet:  ON
      /ini "BSTSettings.ini" "General" "AutoPet" "${doSummonPet}"
   } else /if (${Line.Arg[3].Equal[OFF]}) { 
      /varset doSummonPet FALSE 
      /echo ** AutoSummon Pet:  Off
      /ini "BSTSettings.ini" "General" "AutoPet" "${doSummonPet}"
   }    
/return

Sub Event_TogPetBuff(string Line)
   /varset lastevent Event_TogPetBuff
   /if (${Line.Arg[3].Equal[ON]}) { 
      /varset doBuffPet TRUE 
      /echo ** AutoBuff Pet:   ON 
      /ini "BSTSettings.ini" "General" "BuffPet" "${doBuffPet}"
   } else /if (${Line.Arg[3].Equal[OFF]}) { 
      /varset doBuffPet FALSE 
      /echo ** AutoBuff Pet:   OFF
      /ini "BSTSettings.ini" "General" "BuffPet" "${doBuffPet}"
   } 
/return

Sub Event_TogPetHeal(string Line)
   /varset lastevent Event_TogPetHeal
   /if (${Line.Arg[3].Equal[ON]}) { 
      /varset doHealPet TRUE 
      /echo ** AutoHealing Pet:   ON 
      /ini "BSTSettings.ini" "General" "HealPet" "${doHealPet}"
   } else /if (${Line.Arg[3].Equal[OFF]}) { 
      /varset doHealPet FALSE 
      /echo ** AutoHealing Pet:   OFF
      /ini "BSTSettings.ini" "General" "HealPet" "${doHealPet}"
   } 
/return

Sub Event_TogFerorot(string Line)
   /varset lastevent Event_TogFerorot
   /if (${Line.Arg[3].Equal[ON]}) { 
      /varset AutoFero TRUE 
      /echo ** AutoFero:   ON 
      /ini "BSTSettings.ini" "General" "AutoFero" "${AutoFero}"
   } else /if (${Line.Arg[3].Equal[OFF]}) { 
      /varset AutoFero FALSE 
      /echo ** AutoFero:   OFF
      /ini "BSTSettings.ini" "General" "AutoFero" "${AutoFero}"
   } 
/return

Sub Event_TogVerbose(string Line)
   /varset lastevent Event_TogVerbose
   /if (${Line.Arg[3].Equal[ON]}) { 
      /varset Verbose TRUE 
      /echo ** Verbose:   ON 
      /ini "BSTSettings.ini" "General" "Verbose" "${Verbose}"
   } else /if (${Line.Arg[3].Equal[OFF]}) { 
      /varset Verbose FALSE 
      /echo ** Verbose:   OFF 
      /ini "BSTSettings.ini" "General" "Verbose" "${Verbose}"
   } 
/return

Sub Event_TogAutoslow(string Line)
   /varset lastevent Event_TogAutoslow
   /if (${Line.Arg[3].Equal[ON]}) { 
      /varset Autoslow TRUE 
      /echo ** Autoslow:   ON 
      /ini "BSTSettings.ini" "General" "Autoslow" "${Autoslow}"
   } else /if (${Line.Arg[3].Equal[OFF]}) { 
      /varset Autoslow FALSE 
      /echo ** Autoslow:   OFF 
      /ini "BSTSettings.ini" "General" "Autoslow" "${Autoslow}"
   } 
/return

Sub Event_TogBuff(string Line)
   /varset lastevent Event_TogBuff
   /if (${Line.Arg[3].Equal[ON]}) { 
      /varset AutoBuff TRUE 
      /echo ** AutoBuff:   ON 
      /ini "BSTSettings.ini" "General" "AutoBuff" "${AutoBuff}"
   } else /if (${Line.Arg[3].Equal[OFF]}) { 
      /varset AutoBuff FALSE 
      /echo ** AutoBuff:   OFF 
      /ini "BSTSettings.ini" "General" "AutoBuff" "${AutoBuff}"
   } 
/return

Sub Event_GotHit
  /varset lastevent Event_GotHit
  /if (!${aggrotimer}) /echo ** AGGRO Detected (struck) **
  /varset gotHit TRUE
  /varset aggrotimer 5s
/return 

Sub Event_GotMissed
  /varset lastevent Event_GotMissed
  /if (!${aggrotimer}) /echo ** AGGRO Detected (whiff) **
  /varset gotHit TRUE
  /varset aggrotimer 5s
/return 

Sub Event_SpellBounced
  /varset lastevent Event_SpellBounced
  /varset clicktimer 60s
  /echo ** Just detected a BOUNCED spell!
  /echo ** Use /ibounce to update click-item info!
/return 

Sub Event_TogDynaggro 
  /varset lastevent Event_TogDynaggro
  /if (${doDynaggro}) { 
    /varset doDynaggro FALSE 
    /echo ** Dynamic Aggro Control is now OFF! 
  } else { 
    /varset doDynaggro TRUE 
    /echo ** Dynamic Aggro Control is now ON! 
  } 
  /ini "BSTSettings.ini" "General" "DynamicAggro" "${doDynaggro}"
/return 

Sub Event_DragBodies(string Line)
  /varset lastevent Event_DragBodies
  /declare ArgNum int local 3
  /declare bodycount int local

  :CountCorpses
  /if (${Line.Arg[${ArgNum}].Length}) {
    |- There's a body name for this argument
    /varcalc ArgNum ${ArgNum}+1
    /goto :CountCorpses
  }  
  /varcalc ArgNum ${ArgNum}-1

  /if (${ArgNum}==2) { 
    /echo ** No corpse names supplied!
    /return
  } else {
    /echo ** Target self (F1) to stop dragging!
  }
  :DragLoop 
  /for bodycount 3 to ${ArgNum} 
    /if (${Target.CleanName.Equal[${Me.Name}]}) {
      /echo ** Body dragging ceased.
      /goto :CeaseDragging
    }
    /target ${Line.Arg[${bodycount}]}'s 
    /corpse
    |- Lower this delay at your own risk; too many /corpse commands too fast = cheater!
    /delay 4
  /next bodycount
  /goto :DragLoop
  :CeaseDragging
/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}) { 
    /echo ** Can't target my corpse. 
    /return
  }   
  /corpse 
  /delay 1s
  /loot 
  /delay 1s
  /if (${Me.State.NotEqual[BIND]}) {
    /echo ** 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
  /echo ** Done looting my corpse.
  /notify LootWnd DoneButton leftmouseup 
/return

Sub Event_AutoFollow(string Line)
  /varset lastevent Event_AutoFollow
  /declare distance int local 30
  /if (${Ini[BSTSettings.ini,General,FollowDistance].NotEqual[NULL]}) /varset distance ${Ini[BSTSettings.ini,General,FollowDistance]} 
  /if (${Line.Arg[3].Length}) /target ${Line.Arg[3]}
  /if (${Line.Arg[4].Length}) /varset distance ${Line.Arg[4]}
  /if (${distance}<10) /varset distance 10
  /ini "BSTSettings.ini" "General" "FollowDistance" "${distance}" 
  /if (${Target.ID}) {
    /echo ** Autofollow on: ${Target.CleanName} (${distance} ft.)
    /echo ** Change targets to stop autofollowing.
  } else {
    /echo ** Can't activate Autofollow -- no valid target!
    /return
  }
  /declare followID int local ${Target.ID}
  :FollowingLoop
  |- Look for new events
  /doevents
  /if (!${lastevent.Equal[Event_AutoFollow]}) {
    /echo ** Autofollow blocked by: ${lastevent}
    /goto :StopFollowing
  }
  /if (${Target.ID}==${followID}) {
    /if (${Target.ID}) /face fast
    /if (${Target.Distance}>${distance}) {
      /keypress forward hold 
      /delay 1s ${Target.Distance}<=${distance} 
      /keypress forward 
    }
    /goto :FollowingLoop
  }
  :StopFollowing
  /echo ** Autofollow ended.
/return

Sub Event_ItemSet(string Line)
  /varset lastevent Event_ItemSet
  |- Sanity check parameters
  /if (!${Line.Arg[5].Length} || ${Line.Arg[6].Length}) {
    /echo ** Improper use of /iset
    /echo -- /iset <itemalias> keepup|nokeepup <"Item Name">
    /echo -- For example:
    /echo -- /iset gobby keepup "Shrunken Goblin Skull Earring"
    /return 
  }
  /ini "RHItems.ini" "${Line.Arg[3]}" "FullName" "${Line.Arg[5]}"  
  /ini "RHItems.ini" "${Line.Arg[3]}" "KeepUp" "${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}"
  /echo ** ${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}) {
    /echo ** Improper use of /ibounce
    /echo -- /ibounce <itemalias> "Some Spell Name"
    /echo -- For example:
    /echo -- /ibounce gobby "Strength of Tunare"
    /return 
  }
  |- Look for that item's section, return if non-existent
  /if (!${Ini[RHItems.ini,${Line.Arg[3]}].Length}) {
    /echo ** [${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[RHItems.ini,${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 "RHItems.ini" "${Line.Arg[3]}" "BounceOff${bindex}" "${Line.Arg[4]}"  
    /echo ** Added "${Line.Arg[4]}" to [${Line.Arg[3]}]'s bounce list
  }
/return

Sub Event_ItemCast(string Line)
  /varset lastevent Event_ItemCast
  |- Sanity check parameter
  /if (!${Line.Arg[3].Length}) {
    /echo ** Improper use of /icast
    /echo -- /icast <itemalias>
    /echo -- For example:
    /echo -- /icast gobby
    /return 
  }
  |- Look for that item's section, return if non-existent
  /if (!${Ini[RHItems.ini,${Line.Arg[3]}].Length}) {
    /echo ** [${Line.Arg[3]}] not in INI file!
    /return
  }
  /declare fullname string local ${Ini[RHItems.ini,${Line.Arg[3]},FullName]}
  |- Is it in a Bag?
  /echo ** 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
    /echo ** 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}) {
      /echo ** Clicking: ${fullname}
      /itemnotify ${FindItem[${fullname}].InvSlot} rightmouseup
      /delay 2
    } else {
      /echo ** "${fullname}" not found!
    }
  } 
  :CastLoop 
  /delay 1 
  /if (${Me.Casting.ID}) /goto :CastLoop
/return

Sub Event_AddMaster(string Line)
  /varset lastevent Event_AddMaster
  /declare index int local
  /if (${Line.Arg[3].Length}) {
    /for index 1 to 20
      /if (${Ini[BSTSettings.ini,Masters,Controller${index}].Equal[Nobody]}) {
        /ini "BSTSettings.ini" "Masters" "Controller${index}" "${Line.Arg[3]}"
        /echo ** ${Line.Arg[3]} added as a controller...
        /goto :FallOut
      }
    /next index
    /echo ** Master controller slots all filled! Get rid of some!
  } else {
    /echo ** Huh?
  }
  :FallOut
/return

Sub Event_RemMaster(string Line)
  /varset lastevent Event_RemMaster
  /declare index int local
  /if (${Line.Arg[3].Length}) {
    /for index 1 to 20
      /if (${Ini[BSTSettings.ini,Masters,Controller${index}].Equal[${Line.Arg[3]}]}) {
        /ini "BSTSettings.ini" "Masters" "Controller${index}" "Nobody"
        /echo ** ${Line.Arg[3]} removed from controller list...
        /goto :FallOut
      }
    /next index
    /echo ** Can't find ${Line.Arg[3]} in access list!
  } else {
    /echo ** Huh?
  }
  :FallOut
/return

Sub Event_Chat(ChatType, Sender, ChatText)
  /varset lastevent Event_Chat

     /if (${Target.Type.Equal[NPC]} && ${Me.TargetOfTarget.Name.Equal[${Me}]}) /return
  
/if (${ChatText.Equal[SV]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /target pc ${Sender}
	 /if (${Verbose}) /tell ${Sender} SV inc!
	:svwait 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellHPBuff} gem6 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :svdone
	 /goto :svwait
	:svdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 }
      } 

/if (${ChatText.Equal[sa]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /target pc ${Sender} 
	 /if (${Verbose}) /tell ${Sender} SA inc!
	:sawait
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellManaRegen} gem4 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :sadone
	 /goto :sawait
	:sadone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[ios]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /target pc ${Sender}
	 /if (${Verbose}) /tell ${Sender} IOS inc!
	:ioswait 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellStaBuff} gem7 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :iosdone
	 /goto :ioswait
	:iosdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[fero]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /target pc ${Sender}
	 /if (${Verbose}) /tell ${Sender} Fero inc!
	:ferowait 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellATK} gem8 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :ferodone
	 /goto :ferowait
	:ferodone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[sow]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /target pc ${Sender}
	 /if (${Verbose}) /tell ${Sender} Sow inc!
	:sowwait 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellMiscBuff} gem7 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :sowdone
	 /goto :sowwait
	:sowdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[focus]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /target pc ${Sender}
	 /if (${Verbose}) /tell ${Sender} Kragg inc! 
	:focuswait
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellSHMHPBuff} gem6 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :focusdone
	 /goto :focuswait
	:focusdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[shrink]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
	 /target pc ${Sender}
         /if (${Verbose}) /tell ${Sender} Shrink inc! 
	:shrinkwait 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellShrink} gem7 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :shrinkdone
	 /goto :shrinkwait
	:shrinkdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[heal]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
	 /target pc ${Sender}
         /if (${Verbose}) /tell ${Sender} Heal inc!
	:healwait 
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellHeal} gem1 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :healdone
	 /goto :healwait
	:healdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[haste]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
	 /target pc ${Sender}
	 /if (${Verbose}) /tell ${Sender} Haste inc! 
	:hastewait
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellHaste} gem7 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :hastedone
	 /goto :hastewait
	:hastedone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[rgc]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
	 /target pc ${Sender}
         /if (${Verbose}) /tell ${Sender} RGC inc! 
	:rgcwait
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellRGC} gem7 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :rgcdone
	 /goto :rgcwait
	:rgcdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[regen]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /target pc ${Sender}
         /if (${Verbose}) /tell ${Sender} Regen inc! 
	:regenwait
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellRegen} gem7 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :regendone
	 /goto :regenwait
	:regendone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[curepoison]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /target pc ${Sender}
	 /if (${Verbose}) /tell ${Sender} Cure poison inc! 
	:curepoisonwait
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call cast ${SpellCurePoison} gem7 9s
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :curepoisondone
	 /goto :curepoisonwait
	:curepoisondone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[slow]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 } 
         /assist ${Sender}
	:tellslowwait 
         /if (${Target.Type.Equal[NPC]} && ${Target.Distance}<=100) { 
            /call cast ${SpellSlow} gem5 6s 
            /if (${Verbose}) /tell ${ChatSender} %T is SLOWED
         } 
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]}) /goto :tellslowdone
	 /goto :tellslowwait
	:tellslowdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }

/if (${ChatText.Equal[pos]}) {
     /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
	 /target pc ${Sender}
	 /if (${Verbose}) /tell ${Sender} PoS inc! 
	:poswait
         /if (${Target.Type.Equal[PC]} && ${Target.Distance}<=100) /call Cast "Paragon of Spirit" "alt"
	 /if (${Macro.Return.Equal["CAST_SUCCESS"]} || ${Macro.Return.Equal["CAST_NOTHOLD"]} || ${Macro.Return.Equal["CAST_NOTREADY"]}) /goto :posdone
	 /goto :poswait
	:posdone
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      }
  |- Authenticate if valid controller
  /declare authorized bool local FALSE
  /declare i int local
  /for i 1 to 34
    /if (${Ini[BSTSettings.ini,Masters,Controller${i}].Equal[${Sender}]}) /varset authorized TRUE
  /next i
  /if (${authorized} && ${ChatText.Left[1].Equal[/]}) {
    /echo ** User ${Sender} Authenticated!
    /echo Action --> "${ChatText}"
    /if (${Me.AFK}) /delay 2s
    /tell ${Sender} Command received, performing: ${ChatText}
    /docommand ${ChatText}
  }
/return 

Sub Event_HelpInfo 
  /varset lastevent Event_HelpInfo
  /echo --------=========(RH Help)=========---------- 
  /echo /BSThelp - Display this information!
  /echo /status - Display status of all RH modes
  /echo /pause - Suspends the operations of RH
  /echo /stopfight <%> - Set % of your health to stop attacking
  /echo /endfloor <%> - Set % of your endurance needed to strike
  /echo /autostick - Toggle autosticking to NPCs while attacking
  /echo /stickdist <range_target> <range_tank> - Set stick thresholds
  /echo /closeness <%> - Set % of max hit range while autosticking
  /echo /autoassist <main_assist> <%health> - Activate autoassist
  /echo /autoassist off - Disable autoassisting
  /echo /autoassist on - Turn on autoassist w/existing tank info
  /echo /mainassist <player> - Sets main assist to <player>
  /echo /secondassist <player> - Sets secondary assist to <player>
  /echo /thirdassist <player> - Sets third assist to <player>
  /echo /dynaggro - Toggle dynamic management of assist health %
  /echo /leash <distance> - Activate leash with <distance> ft.
  /echo /leash <distance> <master> - Activate leash w/a master
  /echo /leash off - Disable leashing
  /echo /drag <body1> <body2> ... <bodyN> - Drag corpses
  /echo /lootmycorpse - Loot your own corpse completely
  /echo /iset <itemalias> keepup|nokeepup <"Item Name"> - Item settings
  /echo /ibounce <itemalias> <"Spell Name"> - Add bounce-off spell
  /echo /iclick <itemalias> - Click cast item defined in <itemalias>
  /echo /autoninja <mode> [<range>] - Automatic NPC corpse looting
  /echo /autofollow [<name>] [<distance>] - Follow <name> at <distance>
  /echo /weaponswitch <weapon1> <"switch text"> <weapon2> - weapon swap
  /echo /targetswitch - Toggle autoswitching of targets in autoassist
  /echo /autochicken [ON|OFF|<nimble%>] 
  /echo /autodisc1 "Discipline Name"|ON|OFF <end%> <reuse> - Auto disc 1
  /echo /autodisc2 "Discipline Name"|ON|OFF <end%> <reuse> - Auto disc 2
  /echo /addmaster <name> - Add a master to remote control users
  /echo /remmaster <name> - Remove a master from remote control users
  /echo /autopet [ON|OFF] - Automatically Summon a pet
  /echo /buffpet [ON|OFF] - Automatically buff your pet
  /echo /verbose [ON|OFF] - Announce to group
  /echo /autoslow [ON|OFF] - Toggle performing slow debuff
  /echo /autobuff [ON|OFF] - Toggle autobuffing
  /echo /autofero [ON|OFF] - Toggle auto Ferocity rotation
  /echo /healpet [ON|OFF] - Toggle auto pet healing
/return

Sub Event_StatInfo 
  /varset lastevent Event_StatInfo
  |- Check for the presense of MQ2MoveUtils plugin
  /if (${Stick.Status.Length}) {
    /varset useMU TRUE
    /echo ** MQ2MoveUtils ENABLED (Enhanced Movement ON)
  } else {
    /varset useMU FALSE
    /echo ** MQ2MoveUtils NOT FOUND (Enhanced Movement OFF)
  }
  /echo ** Auto Stick: ${doStick}, Closeness: ${closeness}% MaxRange
  /echo ** -- Range to Target: ${rngtarget} -- Range to Tank: ${rngtank}
  /echo ** Auto Chicken: ${doChicken} -- Chicken: ${nimblehealth}%
  /echo ** Auto Ninja: ${ninjamode}, Distance: ${ninjadist} ft.
  /echo ** Auto TargetSwitching: ${doTSwitch}, Auto Traps: ${doTraps}
  /echo ** Auto Assist: ${doAutoassist}, Assist at ${assistpct}% HP 
  /echo ** MA: ${firstassist}, SA: ${secondassist}, TA: ${thirdassist}
  /echo ** Leashing: ${doLeash} (${leashlength} ft.), Master: ${leashholder}
  /echo ** Auto Disc #1: ${doDisc1} -> ${disc1} / ${disc1reuse} mins - End: ${disc1end}%
  /echo ** Auto Disc #2: ${doDisc2} -> ${disc2} / ${disc2reuse} mins - End: ${disc2end}%
  /echo ** Dynamic Aggro Control: ${doDynaggro}
  /echo ** WeaponSwitching: ${doSwitch}, ${weapon1}->${weapon2} (${switchtext})
  /echo ** AutoFero: ${AutoFero}
  /echo ** Autobuff: ${AutoBuff}
  /echo ** Verbose: ${Verbose}
  /echo ** Autoslow: ${Autoslow}
  /echo ** Authorized remote controllers:
  /declare i int local
  /for i 1 to 35
    /if (${Ini[BSTSettings.ini,Masters,Controller${i}].NotEqual[Nobody]}) /echo ---- ${Ini[BSTSettings.ini,Masters,Controller${i}]} allowed...
  /next i
  /doevents flush
/return 

Sub MemSpells 
   /echo Memming spells. Hang on. 
   /if ( !${Me.Gem[${SpellPet}]} ) { 
      /memspell 1 ${SpellPet} 
      /delay 45 
   } 
   /if ( !${Me.Gem[${SpellPetBuff}]} ) { 
      /memspell 2 ${SpellPetBuff} 
      /delay 40
   } 
   /if ( !${Me.Gem[${SpellPetHaste}]} ) { 
      /memspell 3 ${SpellPetHaste} 
      /delay 40
   } 
   /if ( !${Me.Gem[${SpellManaRegen}]} ) { 
      /memspell 4 ${SpellManaRegen} 
      /delay 40 
   } 
   /if ( !${Me.Gem[${SpellSlow}]} ) { 
      /memspell 5 ${SpellSlow} 
      /delay 40 
   } 
   /if ( !${Me.Gem[${SpellHPBuff}]} ) { 
      /memspell 6 ${SpellHPBuff} 
      /delay 40 
   } 
   /if ( !${Me.Gem[${SpellMiscBuff}]} ) { 
      /memspell 7 ${SpellMiscBuff} 
      /delay 40 
   } 
   /if ( !${Me.Gem[${SpellATK}]} ) { 
      /memspell 8 ${SpellATK} 
      /delay 40 
   } 
 |  /windowstate SpellBookWnd close 
   /echo Spells are memmed.
   /if (${Me.PctMana} < 25 && ${Me.Standing} && !${Me.Combat} && !${Me.Casting}) /sit
/return 

Sub BuffPet 

   /declare l int local 
   /for l 1 to ${SpellPetBuffs.Size} 
      /if (!${Me.PetBuff[${SpellPetBuffs[${l}]}]} && ${Spell[${SpellPetBuffs[${l}]}].Mana} <= ${Me.CurrentMana}) { 
         /call cast ${SpellPetBuffs[${l}]} gem2 9s 
	} 
   /next l

      /if (${SpellPetAAUse}) {
      /if (!${Me.PetBuff[${SpellPetBuffAA}]} && ${Me.AltAbilityReady[${SpellPetBuffAA}]}) /call Cast ${SpellPetBuffAA} "alt"
      }

      /if (${SpellPetClky}) {
      /if (!${Me.PetBuff[${SpellPetBuffClky}]} && ${Spell[${SpellPetBuffClky}].RecastTime}<=0 && ${SpellPetBuffClkyTimer}<=0) /call Cast ${SpellPetBuffClkyItem} "item"
      /if (${Macro.Return.Equal["CAST_NOTREADY"]}) /varset SpellPetBuffClkyTimer ${SpellPetBuffClkyRecast}
      }

/return 

Sub Slow
    /if (${Me.CurrentMana}<${Spell[${SpellSlow}].Mana}) { 
         /echo Shit!! I don't have mana to Slow %T 
      } else { 
:Slow_Loop 
	/if (!${MobSlowed}) {
         /call cast ${SpellSlow} gem5 6s 
         /if (${Macro.Return.Equal["CAST_INTERRUPTED"]}) /goto :Slow_Loop 
         /if (${Macro.Return.Equal["CAST_IMMUNE"]}) { 
            /if (${Verbose}) /gsay !!!!>>>> %T <<<<!!!! is IMMUNE to slow ! 
          
            /varset MobSlowed TRUE 
         } 
         /if (${Macro.Return.Equal["CAST_RESISTED"]}) { 
             { 
               /if (${Verbose}) /gsay !!!!>>>> %T <<<<!!!! RESISTED slow ! Trying again asap 
               /goto :Slow_Loop 
             } 
            /varset MobSlowed TRUE 
          } 
         /if (${Macro.Return.Equal["CAST_SUCCESS"]}) { 
            /if (${Verbose}) /gsay !!!!>>>> %T <<<<!!!! is SLOWED 
            /varset MobSlowed TRUE 
          } 
	}
      } 
   } 
/return 

Sub GroupBuffs
   |- ManaRegen Spell
      /if (!${Me.Buff[${SpellManaRegen}].ID} && ${Spell[${SpellManaRegen}].Mana} <= ${Me.CurrentMana}) { 
         /target myself
         /delay 1s ${Me.ID}==${Target.ID} 
         /if (${Verbose}) {
		 /gsay SD inc, get near me slackers!!
		}
         /call cast ${SpellManaRegen} gem4 9s 
     }

 /declare i int local
  /for i 1 to 20 
   /if (${SpellHPBlock.Find[${Me.Buff[${i}].Spell}]}) /return
  /next i

   |- HPBuff Spell
     /if (!${Me.Buff[${SpellHPBuff}].ID} && ${Spell[${SpellHPBuff}].Mana} <= ${Me.CurrentMana}) { 
         /target myself
         /delay 1s ${Me.ID}==${Target.ID} 
         /if (${Verbose}) {
		 /gsay SV inc, get near me slackers!!
		}
         /call cast ${SpellHPBuff} gem6 9s
      } 

/return 

Sub SelfBuffs


 /declare l int local
  /for l 1 to 20 
   /if (${SpellSHMHPBlock.Find[${Me.Buff[${l}].Spell}]}) /goto :nextselfbuff
  /next l

   |- Infusion of Spirit Spell
      /if (!${Me.Buff[${SpellStaBuff}].ID} && ${Spell[${SpellStaBuff}].Mana} <= ${Me.CurrentMana}) { 
         /target myself
         /delay 1s ${Me.ID}==${Target.ID} 
         /call cast ${SpellStaBuff} gem7 9s 
     }

   |- SHMHP Buff Spell
      /if (!${Me.Buff[${SpellSHMHPBuff}].ID} && ${Spell[${SpellSHMHPBuff}].Mana} <= ${Me.CurrentMana}) { 
         /target myself
         /delay 1s ${Me.ID}==${Target.ID} 
         /call cast ${SpellSHMHPBuff} gem7 9s 
     }
 
:nextselfbuff
 /declare i int local
  /for i 1 to 20 
   /if (${SpellHasteBlock.Find[${Me.Buff[${i}].Spell}]}) /goto :nextselfbuff1
  /next i
   |- Haste Spell
      /if (!${Me.Buff[${SpellHaste}].ID} && ${Spell[${SpellHaste}].Mana} <= ${Me.CurrentMana}) { 
         /target myself
         /delay 1s ${Me.ID}==${Target.ID} 
         /call cast ${SpellHaste} gem7 9s 
     }

:nextselfbuff1
 /declare m int local
  /for m 1 to 20 
   /if (${SpellBuffClkyBlock.Find[${Me.Buff[${m}].Spell}]}) /return
  /next m
   |- Clky Buff
      /if (!${Me.Buff[${SpellBuffClky}].ID} && ${SpellBuffClkyUse}) { 
         /call cast ${SpellBuffClkyItem} "item"
     }

/return

Sub Event_Invited 
   /invite 
/return 

Sub Event_ImDead 

   /echo Bummer ! 
:Zone_Loop 
   /if ( ${Me.Bound} != ${Zone} ) /goto :Zone_Loop 
   /delay 5s 
   /consent group 
   /delay 5
   /call MemSpells
   /if (${Verbose}) /gsay Im ready for rez 
   /call Wait4Rez 
   /delay 20 
   /call cast "White Chain Bridle" item
   /call MemSpells 
   /if (${Me.PctMana} < 25 && ${Me.Standing} && !${Me.Combat} && !${Me.Casting}) /sit

| We do some short meditate before we start again. 
:Meditate 
   /delay 1s 
   /if (${Me.CurrentMana} < ${Spell[${SpellManaRegen}].Mana}) /goto :Meditate
 
   |- ManaRegen Spell
:rezrebuff
    /if (${ManaRegenbuffon}) {   
      /if (!${Me.Buff[${SpellManaRegen}].ID} && ${Spell[${SpellManaRegen}].Mana} <= ${Me.CurrentMana}) { 
         /target myself
         /delay 1s ${Me.ID}==${Target.ID} 
         /if (${Verbose}) {
		 /gsay SD inc, get near me slackers!!
		}
         /call cast ${SpellManaRegen} gem4 20s 
         /if (${Macro.Return.Equal["CAST_NOTHOLD"]}) {
         /varset ManaRegenBuffon FALSE
	 /echo ManaRegen spell blocked disabling buff
	 }
     	}
	/if (!${Macro.Return.Equal["CAST_SUCCESS"]}) /goto :rezrebuff
|	/echo autoassist on
|	/echo leash 200
    } 
    
/return 


|- This part is taken from wait4res. 

Sub Wait4Rez 

:waitforrez 
   /if (!${Window[ConfirmationDialogBox].Open}) { 
      /delay 5s ${Window[ConfirmationDialogBox].Open} 
      /goto :waitforrez 
   } 
   /if (${Window[ConfirmationDialogBox].Open}) /notify ConfirmationDialogBox Yes_Button leftmouseup 
:zonein 
   /delay 5 
   /squelch /target mycorpse 
   /delay 5 
   /if (${Target.CleanName.NotEqual[${Me}'s corpse]}) /goto :zonein 
   /if (${Target.CleanName.Equal[${Me}'s corpse]}) { 
      /delay 3s 
      /call Loot_Corpse 
   } else /goto :zonein 

/return 

Sub Loot_Corpse 

  /declare LootTotal int local 0 
  /declare LootSlot int local 

  /squelch /target mycorpse 
  /if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) { 
    /echo ** Can't target my corpse. 
    /return 
  }    
  /corpse 
  /delay 1s 
  /loot 
  /delay 1s 
  /if (${Me.State.NotEqual[BIND]}) { 
    /echo ** Massive lag right now... Aborting looting. 
    /return 
  } 

  :LootLag 
  /if (${LootTotal}!=${Corpse.Items}) { 
    /varset LootTotal ${Corpse.Items} 
    /delay 5 
    /goto :LootLag 
  } 

  /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 
  /echo ** Done looting my corpse. 
  /notify LootWnd DoneButton leftmouseup 

/return 

Sub CheckGM
   /if (${Spawn[gm].ID}) {
      /echo Waiting on GM to leave zone.
      /keypress forward
      /keypress esc
      /attack off
      /pet back off
      /pet hold
	/if (${Verbose}) /gsay I see a GM~
       /delay 4
:gmcheck
      /if (${Spawn[gm].ID}) {
           /delay 10
            /goto :gmcheck
         } else /return
   }
/return

Sub Cast_Fero

   /declare f int local 0
   /for f 0 to ${Group} 
   /if (${Group.Member[${f}].ID}) { 
      /if (${ATKBuffed${f}}==0) /if (${Group.Member[${f}].Class.Name.Equal[Beastlord]} || ${Group.Member[${f}].Class.Name.Equal[Shadow Knight]} || ${Group.Member[${f}].Class.Name.Equal[Bard]} || ${Group.Member[${f}].Class.Name.Equal[Ranger]} || ${Group.Member[${f}].Class.Name.Equal[Rogue]} || ${Group.Member[${f}].Class.Name.Equal[Paladin]} || ${Group.Member[${f}].Class.Name.Equal[Monk]} || ${Group.Member[${f}].Class.Name.Equal[Warrior]}) { 
         /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
	 /target pc ${Group.Member[${f}]} 
         /delay 1s ${Group.Member[${f}].ID}==${Target.ID} 
         /if (${Me.CurrentMana}>${Spell[${SpellATK}].Mana} && ${Target.Type.Equal[PC]}) { 
            /call cast ${SpellATK} gem8 4s 
            /if (${Macro.Return.Equal["CAST_OUTOFRANGE"]}) /varset ATKBuffed${f} 200 
            /if (${Macro.Return.Equal["CAST_SUCCESS"]}) /varset ATKBuffed${f} ${FeroDelay}´ 
	    /if (${Macro.Return.Equal["CAST_NOTHOLD"]}) /varset ATKBuffed${f} ${FeroDelay}´ 
         } 
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
      } 
   } 
   /next f
   /assist ${mainassist}
/return 

Sub Heal_Pet

      /if (${Me.Pet.Distance}<=200 && ${Me.Pet.PctHPs}<=${HealPetAt} && ${Me.CurrentMana}>${Spell[${SpellPetHeal}].Mana}) {
         /if (${Target.Type.Equal[NPC]} && ${Me.Combat}) {
         /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off
	 /attack off
	 /varset midfightcast TRUE
	 /varset oldtargetID ${Target.ID}
	 }
         /call cast ${SpellPetHeal} gem1 10s
	 /if (${midfightcast}) {
	 /varset midfightcast FALSE
	 /target id ${oldtargetID}
	 /if (${Target.ID}==${oldtargetID} && ${Target.Type.NotEqual[CORPSE]}) {
	 /if (${useMU}) /squelch /stick on
	 /attack on
	 }
	 } 
	} 

/return 


Last edited by mystikule on Thu Jul 14, 2005 6:06 pm, edited 4 times in total.

Warauinu
a snow griffon
a snow griffon
Posts: 377
Joined: Fri Apr 15, 2005 9:21 am

Post by Warauinu » Tue Apr 19, 2005 10:49 am

Thanks, I've been getting a lot of use from this.

mystikule
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jul 17, 2004 9:23 pm

Post by mystikule » Wed Jul 06, 2005 4:47 pm

Updated 7/06/05

mystikule
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jul 17, 2004 9:23 pm

Post by mystikule » Thu Jul 14, 2005 6:17 pm

BSTSettings.ini

Code: Select all

[Masters]
Controller1=Nobody
Controller2=Nobody
Controller3=Nobody
Controller4=Nobody
Controller5=Nobody
Controller6=Nobody
Controller7=Nobody
Controller8=Nobody
Controller9=Nobody
Controller10=Nobody
Controller11=Nobody
Controller12=Nobody
Controller13=Nobody
Controller14=Nobody
Controller15=Nobody
Controller16=Nobody
Controller17=Nobody
Controller18=Nobody
Controller19=Nobody
Controller20=Nobody
[General]
MainAssist=
AutoAssist=TRUE
AssistPercentage=97
TargetSwitching=FALSE
LeashHolder=Nobody
LeashLength=150
Leashing=FALSE
AutoNinjaMode=OFF
AutoNinjaDistance=300
Closeness=50
AutoBuff=TRUE
Verbose=FALSE
Autoslow=TRUE
AutoPet=TRUE
BuffPet=TRUE
AutoDisc1=TRUE
Disc1=Bestial Fury
Disc1Endurance=60
Disc1Reuse=25
AutoFero=TRUE
SecondAssist=
ThirdAssist=
AutoChicken=TRUE
NimbleHealth=60
HealPet=TRUE
Spell_routines.inc

Code: Select all

| spell_routines.inc 
| 
| Written by Rusty~ 
| Last Modified 11/07/2004 
| 
| Features: 
| - Casts spells, clicks items, or uses AA abilities for you 
| - Allows back to back casting without waiting on spell gems to pop all the way up 
| - Will interrupt spell if target dies while casting. If on a mount, it will dismount and duck if the time left 
|   is greater than 7 seconds, else it will move forward a bit to interrupt, then move you back 
|    ** IMPORTANT: if you don't want to interrupt a spell while mounted, put this at the top of your macro: ** 
|    **   /declare noInterrupt int outer 1                                                                  ** 
| - Allows you to use items in bags. Equips item, clicks it, then returns it to its previous location 
| - Lets you set how long you want to keep trying to cast the spell (defaults to 0) 
|   If the spell is interrupted before the given time, it will recast, else it will return CAST_INTERRUPTED 
| - Lets you call a custom subroutine while waiting for spell to finish casting 
|   Try to keep custom subroutines very small. A common use would be to interrupt the spell if a certain condition is true 
| - This file also includes a sub named Interrupt. You can call this to interrupt any spell you're casting instantly. 
| - You can also use the SwapItem sub included in this to swap items to certain slots 
| - Added EquipItem sub to easily equip items in your main Inventory slots. 
| - Note: if you don't want this to cast spells while you're invis, in your main macro have this at the top: 
|      /declare noInvis int outer 1 
|   This will make it return CAST_INVIS if you're invis 
| 
|  Below is a list of outer scope variables you can access in your macros: 
|      refreshTime        - How much time is left till you're done recovering from casting 
|      castEndTime        - How much time left till you're done casting the current spell... usable in custom spell Subs 
|      spellRecastTime1-9 - How much time left till that spell is back up 
| 
|====================================================================================================================== 
|  EquipItem:  An easier way to equip items you have in bags ( useful for weapons or focus items ) 
|              slot name is optional. If not given, it will equip it in the first possible spot 
| 
|    Usage:    
|        /call EquipItem "item name|slotname" 
| 
|        Returns: "old item name|slotname" 
|    Examples: 
|    
|    To Equip Sharp Ended Broken Lever when you have Serpent of Vindication equiped: 
|        /call EquipItem "Sharp Ended Broken Lever" 
|    It will return "Staff of Vindication|mainhand" 
|    To reequip the original item, you can save the return in a variable, and then use it later like this: 
|       /varset oldPrimary ${Macro.Return} 
|       | ... do stuff here with your new item equiped 
|       /call EquipItem ${oldPrimary} 
| 
|====================================================================================================================== 
|  SwapItem:  a subroutine which is used in the Cast sub itself. You don't need to do this to cast an item in a bag 
|             but you can call it in your macro to SwapItems (such as weapons or focus items) 
|    Usage:    
|        /call SwapItem "item name" slotname|slotID 
|    Examples: 
|    
|    To swap Darkblade of the Warlord to your main hand: 
|        /call SwapItem "Darkblade of the Warlord" mainhand 
| 
|    To swap stat food in one bag with other food in another bag: 
|        /call SwapItem "Bristlebanes Party Platter" ${FindItem[halas 10lb meat pie].InvSlot} 
| 
|====================================================================================================================== 
|  Cast: the main subroutine that casts spells or items for you 
|     Usage: 
|        /call Cast "spellname|itemname|AAname|AA#" [item|alt|gem#] [give up time][s|m] [custom subroutine name] 
|     Examples: 
| 
|     To cast Howl of Tashan and mem it in slot 3 if not memmed: 
|       /call Cast "Howl of Tashan" gem3 
| 
|     To cast Arcane Rune and keep trying for 7 seconds, in case of interrupts. 
|       /call Cast "Arcane Rune" gem5 7s 
| 
|     To click Grim Aura earring that's in a bag: 
|       /call Cast "Shrunken Goblin Skull Earring" item 
| 
|     To use AA ability Eldritch Rune: 
|       /call Cast "Eldritch Rune" alt 
|         or 
|       /call Cast "173" alt 
| 
|     To call a subroutine that interrupts CH if target gets healed before it lands: 
|       /call Cast "Complete Healing" gem1 0 CheckHP 
|     Then in your macro have somewhere: 
|       Sub CheckHP 
|          /if ( ${Target.PctHPs}>=80 ) /call Interrupt 
|       /return 
| 
| Returns these values: 
|----------------------+----------------------------------------------------------------------+ 
| CAST_CANCELLED       | Spell was cancelled by ducking (either manually or because mob died) | 
| CAST_CANNOTSEE       | You can't see your target                                            | 
| CAST_IMMUNE          | Target is immune to this spell                                       | 
| CAST_INTERRUPTED     | Casting was interrupted and exceeded the given time limit            | 
| CAST_INVIS           | You were invis, and noInvis is set to true                           | 
| CAST_NOTARGET        | You don't have a target selected for this spell                      | 
| CAST_NOTMEMMED       | Spell is not memmed and you gem to mem was not specified             | 
| CAST_NOTREADY        | AA ability or spell is not ready yet                                 | 
| CAST_OUTOFMANA       | You don't have enough mana for this spell!                           | 
| CAST_OUTOFRANGE      | Target is out of range                                               | 
| CAST_RESISTED        | Your spell was resisted!                                             | 
| CAST_SUCCESS         | Your spell was cast successfully! (yay)                              | 
| CAST_UNKNOWNSPELL    | Spell/Item/Ability was not found 				      |
| CAST_NOTHOLD         | Spell woundn't take hold on target                                   |
|----------------------+----------------------------------------------------------------------+ 

#event BeginCast "You begin casting#*#" 
#event Collapse "Your gate is too unstable, and collapses.#*#" 
#event FDFail "#1# has fallen to the ground.#*#" 
#event Fizzle "Your spell fizzles#*#" 
#event Immune "Your target is immune to changes in its attack speed#*#" 
#event Immune "Your target is immune to changes in its run speed#*#" 
#event Immune "Your target cannot be mesmerized#*#" 
#event Interrupt "Your casting has been interrupted#*#" 
#event Interrupt "Your spell is interrupted#*#" 
#event NoLOS "You cannot see your target.#*#" 
#event NoTarget "You must first select a target for this spell!#*#" 
#event NotReady "Spell recast time not yet met.#*#" 
#event OutOfMana "Insufficient Mana to cast this spell!#*#" 
#event OutOfRange "Your target is out of range, get closer!#*#" 
#event Recover "You haven't recovered yet...#*#" 
#event Recover "Spell recovery time not yet met#*#" 
#event Resisted "Your target resisted the #1# spell#*#" 
#event Resisted2 "You resist the #1# spell#*#" 
#event Standing "You must be standing to cast a spell#*#" 
#event Stunned "You are stunned#*#" 
#event Stunned "You can't cast spells while stunned!#*#" 
#event Stunned "You *CANNOT* cast spells, you have been silenced!#*#"
#event Nothold "Your spell would not have taken hold#*#"
#event Nothold "Your spell did not take hold#*#"  


Sub Cast(string spellName,string spellType,timer giveUpTimer,string mySub) 
   /declare castTime float local 
   /if ( ${spellType.Equal[item]} ) { 
      /varset castTime ${FindItem[${spellName}].CastTime} 
   } else /if ( ${spellType.Equal[alt]} ) { 
      /varset castTime ${AltAbility[${spellName}].Spell.MyCastTime} 
   } else { 
      /varset castTime ${Spell[${spellName}].MyCastTime} 
   } 
   /if ( ${Me.Invis} && ${noInvis} ) { 
      /return 
   } 
   :wait_for_stop 
   /if ( !${Defined[spellType]} ) /declare spellType string local spell 
   /if ( ${Me.Casting.ID} ) { 
      /if ( ${Defined[mySub]} ) /call ${mySub} 
      /goto :wait_for_stop 
   }  
   /if ( ${Me.Speed} ) { 
   :wait_for_stop2 
      /if ( ${Defined[mySub]} ) /call ${mySub} 
      /if ( ${Me.Moving} && ${castTime}>0.1 ) /goto :wait_for_stop2 
   } 
   /if ( !${Defined[giveUpTimer]} ) /declare giveUpTimer timer local 0 
   /if ( !${Defined[spellRecastTime1]} ) { 
      /if ( !${Defined[noInterrupt]} ) /declare noInterrupt int outer 0 
      /declare moveBack bool outer false 
      /declare selfResist int outer 
      /declare selfResistSpell string outer 
      /declare castEndTime timer outer 
      /declare refreshTime timer outer 0 
      /declare itemRefreshTime float outer 0 
      /declare startCastingLoc string outer 
      /declare i int local 
      /declare castReturn string outer 
      /delay 5 
      /for i 1 to 9 
         /declare spellRecastTime${i} timer outer 
         /if ( ${Me.SpellReady[${i}]} ) { 
            /varset spellRecastTime${i} 0 
         } else { 
            /varcalc spellRecastTime${i} 10*${Me.Gem[${i}].RecastTime} 
         } 
      /next i 
   } 
   /varset selfResist 0 
   /declare delayTime timer local 
   /declare swapItemBack bool local false 
   /declare slotName int local 
   /declare oldItemName string local 
   /declare slotID int local 
   /declare oldSlotID int local 
   /declare spellID int local 
   /declare charges int local 

   /if ( ${Window[SpellBookWnd].Open} ) /keypress spellbook 
   /if ( ${Me.Ducking} ) /keypress duck 
   /if ( !${Me.Standing} ) /stand 

   /doevents Recover 
   /doevents BeginCast 
   /doevents Fizzle 
   /doevents Interrupt 
   /doevents Standing 
   /doevents FDFail 
   /doevents OutOfRange 
   /doevents OutOfMana 
   /doevents NoLOS 
   /doevents Resisted2 
   /doevents Resisted 
   /doevents Immune 
   /doevents Stunned 
   /doevents Collapse 
   /doevents NoTarget 
   /doevents NotReady
   /doevents Nothold  
   /varset castReturn CAST_SUCCESS 
    
      /if ( ${spellType.Equal[item]} ) /goto :cast_item 
   /if ( ${spellType.Equal[alt]} ) /goto :cast_alt 

:cast_spell 
   /if ( !${Int[${Me.Book[${spellName}]}]} ) { 
      /echo Spell: "${spellName}" was not found in your book 
      /return CAST_UNKNOWNSPELL 
   } 
   /if ( !${Me.Gem[${spellName}]} ) { 
   :mem_spell 
      /if ( ${Cursor.ID} ) { 
         /autoinventory 
         /delay 5 
         /goto :mem_spell  
      } 
      /if ( ${spellType.Left[3].Equal[gem]} ) { 
         /memspell ${spellType.Right[1]} "${spellName}" 
      } else { 
         /return CAST_NOTMEMMED 
      } 
      /delay 6s ${Me.Gem[${spellName}]} 
      /if ( !${Me.Gem[${spellName}]} ) { 
         /echo Spell mem interrupted... 
         /return CAST_INTERRUPTED 
      } 
      :wait_for_mem 
      
      /delay 15s ${Me.SpellReady[${spellName}]} 
      /if ( !${Me.SpellReady[${spellName}]} ) { 
         /if ( ${giveUpTimer} ) /goto :wait_for_mem 
         /return CAST_NOTREADY 
      } 
   } 
   /varset spellType spell 
   /if ( ${spellName.Find[illusion: ]} && ${Me.AltAbilityReady[project illusion]} ) /call Cast "project illusion" alt 

   /varset giveUpTimer ${giveUpTimer.OriginalValue} 
   /declare recoverWaitTime timer local 30 

:cast_spell_loop 
:wait_for_spell 
   /if ( ${Me.SpellReady[${spellName}]} ) { 
      /varset spellRecastTime${Me.Gem[${spellName}]} 0 
      /goto :skip_delay  
   } 
   /if ( ${spellRecastTime${Me.Gem[${spellName}]}}  ) { 
      /if ( !${giveUpTimer} ) /return CAST_NOTREADY 
      /if ( ${Defined[mySub]} ) /call ${mySub} 
      /goto :wait_for_spell 
   } 
   /if ( !${refreshTime} ) /goto :skip_delay 
:wait_on_refresh 
   /if ( ${Me.SpellReady[${spellName}]} ) /varset refreshTime 0 
   /if ( ${refreshTime}>0 ) { 
      /if ( ${Defined[mySub]} ) /call ${mySub} 
      /goto :wait_on_refresh 
   } 
   /varcalc delayTime 10*(1.5-${Spell[${spellName}].MyCastTime}) 
:cast_delay_loop 
   /if ( ${delayTime}>0 ) { 
      /if ( ${Defined[mySub]} ) /call ${mySub} 
      /goto :cast_delay_loop 
   } 
:skip_delay 
   /varset startCastingLoc ${Me.X} ${Me.Y} ${Me.Z} 
   /cast "${spellName}" 

   /if ( ${Me.Casting.ID} ) { 
      /varset spellID ${Me.Casting.ID} 
      /varcalc castEndTime ${Me.Casting.MyCastTime}*10 
      /if ( ${castEndTime}<${Math.Calc[${Me.Casting.CastTime}*5]} ) /varcalc castEndTime ${Me.Casting.CastTime}*5 
      /echo Casting: ${Me.Casting.Name}${If[!${Me.Casting.TargetType.Equal[PB AE]} && !${Me.Casting.TargetType.Equal[self]} && ${Target.ID}, on >> ${Target.CleanName} <<,]} 
   } 

   /varset moveBack false 

   /call WaitCast ${mySub} 

   /if ( ${moveBack} ) { 
      /keypress back hold 
      /delay 4 
      /keypress back 
      /delay 15 !${Me.Moving} 
   } 

   /if ( ${castReturn.Equal[CAST_CANCELLED]} ) { 
      /echo Spell was cancelled... 
      /return CAST_CANCELLED 
   } 

   /doevents Recover 
   /doevents BeginCast 
   /doevents Fizzle 
   /doevents Interrupt 
   /doevents Standing 
   /doevents FDFail 
   /doevents OutOfRange 
   /doevents OutOfMana 
   /doevents NoLOS 
   /doevents Resisted2 
   /doevents Resisted 
   /doevents Immune 
   /doevents Stunned 
   /doevents Collapse 
   /doevents NoTarget 
   /doevents NotReady
   /doevents Nothold  
    
   /if ( !${spellID} ) /varset spellID ${Spell[${spellName}].ID} 
   /if ( !${castReturn.Equal[CAST_SUCCESS]} ) { 
      /if ( ${castReturn.Equal[CAST_NOTREADY]} ) /return CAST_NOTREADY 
      /if ( ${castReturn.Equal[CAST_FIZZLE]} ) { 
         /echo Spell Fizzled. Recasting... 
         /goto :cast_spell_loop 
      } 
      /if ( ${castReturn.Equal[CAST_RECOVER]} ) { 
         /if ( !${recoverWaitTime} ) { 
            /varcalc spellRecastTime${Me.Gem[${spellName}]} 10*${Spell[${spellID}].RecastTime} 
            /if ( !${giveUpTimer} ) /return CAST_NOTREADY 
         } 
         /goto :cast_spell_loop 
      } 
      /if ( ${castReturn.Equal[CAST_RESTART]} ) /goto :cast_spell_loop 
      /if ( ${castReturn.Equal[CAST_STUNNED]} ) { 
         /if ( ${Me.Stunned} ) { 
            /delay 3s !${Me.Stunned} 
         } else { 
            /delay 7 
         } 
         /goto :cast_spell_loop 
      } 
      /if ( ${castReturn.Equal[CAST_INTERRUPTED]} ) { 
         /if ( ${giveUpTimer} ) { 
            /echo Spell was interrupted. Recasting... 
            /goto :cast_spell_loop 
         } 
         /echo Spell was interrupted... 
         /return CAST_INTERRUPTED 
      } 
   } 
   /if ( !${castReturn.Equal[CAST_CANNOTSEE]} && !${castReturn.Equal[CAST_OUTOFRANGE]} && !${castReturn.Equal[CAST_OUTOFMANA]} && !${castReturn.Equal[CAST_NOTARGET]} ) { 
      /varcalc refreshTime 10*${Spell[${spellID}].RecoveryTime} 
      /varcalc spellRecastTime${Me.Gem[${spellName}]} 10*${Spell[${spellID}].RecastTime} 
   } 
   /if ( ${castReturn.Equal[CAST_COLLAPSE]} ) { 
      /varset giveUpTimer 200 
      /goto :cast_spell_loop 
   } 
/return ${castReturn} 


:cast_item 
   /if ( !${FindItem[${spellName}].InvSlot} ) { 
      /echo Cannot find item: ${spellName} 
      /return CAST_UNKNOWNSPELL 
   }  
   /if ( ${FindItem[${spellName}].InvSlot}>21 ) { 
      /varset swapItemBack true 
      /if ( ${FindItem[${spellName}].WornSlot[1]} && ${FindItem[${spellName}].EffectType.Find[worn]} ) { 
         /varset slotName ${FindItem[${spellName}].WornSlot[1]} 
      } else /if ( ${FindItem[${spellName}].InvSlot}>29 ) { 
         /varset slotName 29 
      } else { 
         /varset slotName ${FindItem[${spellName}].InvSlot} 
      } 
      /varset slotID ${InvSlot[${slotName}].ID}      
      /varset oldSlotID ${FindItem[${spellName}].InvSlot.ID} 
      /varset oldItemName ${InvSlot[${slotID}].Item.Name} 
      /call SwapItem "${spellName}" ${slotID} 
   } 
:cast_item_loop 
:wait_item_loop 
   /if ( ${itemRefreshTime} > ${MacroQuest.Running} ) { 
      /delay 1 
      /goto :wait_item_loop 
   } 
   /varset itemRefreshTime ${Math.Calc[${MacroQuest.Running}+000]} 
   /varset charges ${FindItem[${spellName}].Charges} 
   /varset startCastingLoc ${Me.X} ${Me.Y} ${Me.Z} 
   /cast item "${spellName}" 
   /if ( ${Me.Casting.ID} ) { 
      /varcalc castEndTime ${FindItem[${spellName}].CastTime}*10 
      /echo Casting: ${FindItem[${spellName}].Spell.Name}${If[!${FindItem[${spellName}].Spell.TargetType.Equal[PB AE]} && !${FindItem[${spellName}].Spell.TargetType.Equal[self]} && ${Target.ID}, on >> ${Target.CleanName} <<,]} 
   } 
   /if ( ${charges}>0 ) /delay 1s ${FindItem[${spellName}].Charges}!=${charges} 

   /call WaitCast ${mySub} 
    
   /if ( ${swapItemBack} ) { 
      /if ( ${FindItem[${spellName}].ID} ) { 
         /call SwapItem "${spellName}" ${oldSlotID} 
      } else /if ( ${FindItem[${oldItemName}].ID} ) { 
         /call SwapItem "${oldItemName}" ${slotID}          
      } 
      /if ( ${Cursor.Container} ) /autoinventory 
   } 

   /if ( ${castReturn.Equal[CAST_CANCELLED]} ) { 
      /echo Spell was cancelled... 
      /return CAST_CANCELLED 
   } 

   /doevents BeginCast 
   /doevents Interrupt 
   /doevents Standing 
   /doevents FDFail 
   /doevents OutOfRange 
   /doevents NoLOS 
   /doevents Resisted2 
   /doevents Resisted 
   /doevents Immune 
   /doevents Stunned 
   /doevents Collapse 
   /doevents NoTarget 
   /doevents NotReady
   /doevents Nothold  

   /if ( !${castReturn.Equal[CAST_SUCCESS]} ) { 
      /if ( ${castReturn.Equal[CAST_NOTREADY]} ) /return CAST_NOTREADY 
      /if ( ${castReturn.Equal[CAST_RESTART]} ) /goto :cast_item 
      /if ( ${castReturn.Equal[CAST_STUNNED]} ) { 
         /if ( ${Me.Stunned} ) { 
            /delay 3s !${Me.Stunned} 
         } else { 
            /delay 7 
         } 
         /goto :cast_item 
      } 
      /if ( ${castReturn.Equal[CAST_INTERRUPTED]} ) { 
         /if ( ${giveUpTimer} ) { 
            /echo Spell was interrupted. Recasting... 
            /goto :cast_item 
         } 
         /echo Spell was interrupted... 
         /return CAST_INTERRUPTED 
      } 
   } 
   /if ( ${castReturn.Equal[CAST_COLLAPSE]} ) { 
      /varset giveUpTimer 200 
      /goto :cast_item 
   } 
/return ${castReturn} 


:cast_alt 
   /if ( !${Me.AltAbilityReady[${spellName}]} ) /return CAST_NOTREADY 
   /echo Using AA Ability: ${AltAbility[${spellName}].Name} 
   /alt activate ${AltAbility[${spellName}].ID} 
   /if ( ${AltAbility[${spellName}].Spell.MyCastTime}>=0.5 ) /delay 1s ${Me.Casting.ID} 
   /call WaitCast ${mySub} 
    
   /if ( ${castReturn.Equal[CAST_CANCELLED]} ) { 
      /echo Spell was cancelled... 
      /return CAST_CANCELLED 
   } 
    
   /doevents BeginCast 
   /doevents Interrupt 
   /doevents Standing 
   /doevents FDFail 
   /doevents OutOfRange 
   /doevents NoLOS 
   /doevents Resisted2 
   /doevents Resisted 
   /doevents Immune 
   /doevents Stunned 
   /doevents NoTarget 
   /doevents Nothold 
      
   /if ( !${castReturn.Equal[CAST_SUCCESS]} ) { 
      /if ( ${castReturn.Equal[CAST_RESTART]} ) /goto :cast_alt 
      /if ( ${castReturn.Equal[CAST_STUNNED]} ) { 
         /if ( ${Me.Stunned} ) { 
            /delay 3s !${Me.Stunned} 
         } else { 
            /delay 7 
         } 
         /goto :cast_alt 
      } 
      /if ( ${castReturn.Equal[CAST_INTERRUPTED]} ) { 
         /if ( ${giveUpTimer} ) { 
            /echo Spell was interrupted. Recasting... 
            /goto :cast_alt 
         } 
         /echo Spell was interrupted... 
         /return CAST_INTERRUPTED 
      } 
   } 
/return ${castReturn} 


Sub EquipItem(string WhatWhere) 
   /declare DestName string local 
   /declare ItemName string local ${WhatWhere.Arg[1,|]} 
   /declare SlotName string local ${WhatWhere.Arg[2,|]}
   /if (${SlotName.Equal[NULL]}) /varset SlotName ${InvSlot[${FindItem[=${ItemName}].WornSlot[1]}].Name} 
   /if (${FindItem[=${ItemName}].InvSlot}<22 || !${FindItem[=${ItemName}].WornSlot[${SlotName}]}) /return 
   /if (!${InvSlot[${SlotName}].Item.Name.Equal[NULL]}) /varset DestName "${InvSlot[${SlotName}].Item.Name}|${SlotName}" 
   /call SwapItem "${ItemName}" "${SlotName}" 
/return ${DestName} 

| Sub EquipItem(string itemName,string slotName) 
   /if ( !${Defined[slotName]} ) /declare slotName string local ${FindItem[${itemName}].WornSlot[1]} 
   /declare oldItem string local ${Me.Inventory[${slotName}].Name} 
   /call SwapItem "${itemName}" ${slotName} 
/return "${oldItem}" ${slotName} 

Sub SwapItem(string itemName,string slotName) 
   /if ( ${InvSlot[${slotName}].Item.Name.Equal[${itemName}]} ) /return 
   /declare slotID int local 
   /declare oldSlotID int local 
   /declare oldItem string local 
   /declare i int local 
   /varset slotID ${InvSlot[${slotName}].ID}           | slotID = slot you're swapping item to 
   /varset oldSlotID ${FindItem[${itemName}].InvSlot.ID} | oldSlotID = slot the item was originally in 
   /varset oldItem ${InvSlot[${slotName}].Item.Name}     | oldItem = name of item in the slot you're swapping WITH 
   /if ( !${slotID} ) { 
      /echo Invalid slot name: ${slotName} 
      /return 
   } 
   /if ( !${oldSlotID} ) { 
      /echo Could not find item ${itemName} 
      /return 
   } 
:auto_inv 
   /if ( ${Cursor.ID} && !${Cursor.Name.Equal[${itemName}]} ) { 
      /if ( ${Cursor.Container} ) { 
         /for i 1 to 8 
            /if ( !${InvSlot[pack${i}].Item.Container} ) { 
               /nomodkey /itemnotify pack${i} leftmouseup 
            } 
         /next i 
      } else { 
         /autoinventory 
      } 
      /goto :auto_inv 
   } 
    

:pick_up_item 
 | if the item is in a bag and it's not open, then open it! 
   /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 

 | if the slot you're putting it in is inside a bag and it's not open, then open it! 
   /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 

 | ok.. pick up the item now! 
   /squelch /nomodkey /shiftkey /itemnotify ${InvSlot[${oldSlotID}]} leftmouseup 

 | if item isn't on your cursor, try again! 
   /if ( !${Cursor.Name.Equal[${itemName}]} ) { 
      /if ( ${Cursor.ID} && !${Cursor.Container} ) /autoinventory 
      /goto :pick_up_item 
   } 
:exchange_items 
   /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
   /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 

 | put the item in the new slot, and pick up whatever item was there 
   /squelch /nomodkey /shiftkey /itemnotify ${slotID} leftmouseup 

 | if it didnt get exchanged, try again! 
   /if ( ${Cursor.ID} && !${Cursor.Name.Equal[${oldItem}]} && !${Cursor.Name.Equal[${itemName}]} && !${Cursor.Container} ) /autoinventory 
   /if ( !${InvSlot[${slotID}].Item.Name.Equal[${itemName}]} ) /goto :exchange_items 
:drop_item 
   /if ( !${Cursor.Container} || ( ${InvSlot[${oldSlotID}]}<30 && ${InvSlot[${oldSlotID}]}>=22 ) ) { 
      /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
      /if ( ${InvSlot[${slotID}].Pack} && !${Window[${InvSlot[${slotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 
      /squelch /nomodkey /itemnotify ${oldSlotID} leftmouseup 
      /if ( ${Cursor.ID} ) { 
         /if ( !${Cursor.Name.Equal[${oldItem}]} ) /autoinventory 
         /goto :drop_item 
      } 
   } 
:close_pack 
   /if ( ${InvSlot[${oldSlotID}].Pack} && ${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} && ( ${Cursor.Name.Equal[${itemName}]} || ${FindItem[${itemName}].ID} ) ) { 
      /squelch /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
      /goto :close_pack 
   } 
   /if ( ${InvSlot[${slotID}].Pack} && ${Window[${InvSlot[${slotID}].Pack.Name}].Open} && ( ${Cursor.Name.Equal[${itemName}]} || ${FindItem[${itemName}].ID} ) ) { 
      /squelch /nomodkey /itemnotify ${InvSlot[${slotID}].Pack} rightmouseup 
      /goto :close_pack 
   } 
/return 

Sub Interrupt 
   /if ( ${Me.Mount.ID} ) /dismount 
   /stopcast 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_CANCELLED 
/return ${Macro.Return} 


Sub WaitCast(string mySub) 
   /declare currentTarget int local ${Target.ID} 
   /declare currentTargetType string local ${Target.Type} 
:wait_cast_loop 
   /if ( ${Bool[${mySub}]} ) /call ${mySub} 
   /if ( ${Me.Casting.ID} ) { 
      /if ( ${currentTarget} && !${Spawn[${currentTarget}].Type.Equal[${currentTargetType}]} ) { 
         /if ( !${Me.Casting.TargetType.Equal[PB AE]} && !${Me.Casting.TargetType.Equal[self]} && !${moveBack} && ( !${Me.Mount.ID} || !${noInterrupt} ) ) { 
            /if ( !${Me.Mount.ID} || ${castEndTime}>70 ) { 
               /call Interrupt 
            } else /if ( ${Me.Casting.RecastTime}>3 ) { 
               /varset castReturn CAST_CANCELLED 
               /keypress forward hold 
               /delay 6 
               /keypress forward 
               /varset moveBack true 
            } 
         } 
      } 
      /if ( ${Me.State.Equal[DUCK]} ) /varset castReturn CAST_CANCELLED 
      /delay 1 
      /goto :wait_cast_loop 
   } 
/return 

Sub Event_Fizzle 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_FIZZLE 
/return 

Sub Event_Resisted(string line,string name) 
   /if ( ${selfResist} && ${name.Equal[${selfResistSpell}]} ) { 
      /varset selfResist 0 
      /return    
   } 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_RESISTED 
/return 

Sub Event_Resisted2(string line,string name) 
   /if ( ${Defined[selfResist]} ) { 
      /varset selfResist 1 
      /varset selfResistSpell ${name} 
   } 
/return 

Sub Event_Interrupt 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_INTERRUPTED 
/return 

Sub Event_Recover 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_RECOVER 
/return 

Sub Event_Immune 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_IMMUNE 
/return 

Sub Event_Stunned 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_STUNNED 
/return 

Sub Event_NoLOS 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_CANNOTSEE 
/return 

Sub Event_Standing 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_RESTART 
/return 

Sub Event_Collapse 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_COLLAPSE 
/return 

Sub Event_OutOfMana 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_OUTOFMANA 
/return 

Sub Event_OutOfRange 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_OUTOFRANGE 
/return 

Sub Event_NoTarget 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_NOTARGET 
/return 

Sub Event_NotReady 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_NOTREADY 
/return 

Sub Event_BeginCast 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_SUCCESS 
/return 

Sub Event_FDFail(string line,string name) 
   /if ( ${name.Equal[${Me.Name}]} && ${Defined[castReturn]} ) { 
      /if ( !${Me.Standing} ) /stand 
      /varset castReturn CAST_RESTART 
   } 
/return  

Sub Event_Nothold 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_NOTHOLD 
/return

Merlin
a lesser mummy
a lesser mummy
Posts: 69
Joined: Tue Oct 26, 2004 2:33 am

Post by Merlin » Sat Jul 16, 2005 3:55 pm

|- Look for that item's section, return if non-existent
/if (!${Ini[RHItems.ini,${Line.Arg[3]}].Length}) {
/echo ** [${Line.Arg[3]}] not in INI file!
/return
i've been tweaking this mac, trying to get it to keep clicky buffs up, but it doesnt seem to want to let me do that.

it shows to be setup to use RHItems.ini, and i have that file in place but its not pulling the info from there and keeping it up

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

Post by majic » Tue Jul 26, 2005 4:04 pm

tried using this and kepe getting "Subroutine CheckDebuffTimers wasnt found'
anything I am missing?


nm i grabed one from another macro and it works fine. only thing not working now is the pet assisting me or ma.

mikejones
decaying skeleton
decaying skeleton
Posts: 7
Joined: Mon Jul 18, 2005 12:33 pm

Post by mikejones » Tue Aug 02, 2005 8:21 am

This Macro works pretty good. Only things I haven't been able to ge to work are getting the bst to attack at the % i set with /autoassist tank 95 it attacks as soon as the MA has a target. The other is pet attack only attacks when bst gets hit. Anyone else have this trouble?

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

Post by majic » Wed Aug 03, 2005 11:30 pm

same problems and the fact he wont heal himslef hehe

Effico
a lesser mummy
a lesser mummy
Posts: 69
Joined: Mon Oct 18, 2004 6:03 am

Post by Effico » Thu Aug 04, 2005 10:46 am

mikejones wrote:This Macro works pretty good. Only things I haven't been able to ge to work are getting the bst to attack at the % i set with /autoassist tank 95 it attacks as soon as the MA has a target. The other is pet attack only attacks when bst gets hit. Anyone else have this trouble?
You 100% sure you have typed /assist off in the normal EQ chat window.

What you have described is exactly what happens if /assist off hasn`t been typed in the eq window (NOT MQ2 window).

Eff.

mikejones
decaying skeleton
decaying skeleton
Posts: 7
Joined: Mon Jul 18, 2005 12:33 pm

Post by mikejones » Fri Aug 05, 2005 8:08 am

That did the trick thanks Effico!

gordon
a lesser mummy
a lesser mummy
Posts: 60
Joined: Sun Aug 14, 2005 12:10 am

Post by gordon » Sun Aug 14, 2005 12:13 am

i have been using this macro for a day or two now and all of the sudden it has just started hanging... it doesnt respond to any commands and wont give the /status or /bsthelp command

i dont really know what i could show you to help other than to tell you my problem so if you need anything else just ask and ill give it

mystikule
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jul 17, 2004 9:23 pm

Post by mystikule » Sun Aug 14, 2005 5:18 am

Do you use other macros and are they having the same issue? Seems that aliases aren't being loaded, how or why that would happen puzzles me. Check your macroquest ini, all the commands should be listed in there under aliases. Without more information, that's about the best I can offer for help.

gordon
a lesser mummy
a lesser mummy
Posts: 60
Joined: Sun Aug 14, 2005 12:10 am

Post by gordon » Tue Aug 16, 2005 3:05 pm

i have been playing around with this but i would like for after a mob dies for my beastlord to run back to camp/my leash point... i dont know if this is implemented but i searched around and i was wondering where i would put
/face nolook away loc ${stakeY},${stakeX}
so that after the mob im killing dies i would run back to my leash...

thanks