SnareSwap.mac

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

Moderator: MacroQuest Developers

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

SnareSwap.mac

Post by Chill » Sat Nov 06, 2004 2:52 pm

Simple little macro to swap in a snare stick, then swap back to the original weapon setup:

Code: Select all

| snareswap.mac

#include Spell_Routines.inc
#event snared "#1# has been ensnared."
#event exp "You gain party experience!!"

Sub Main
/declare Primary string outer ${InvSlot[mainhand].Item.Name}
/declare Secondary string outer ${InvSlot[offhand].Item.Name}
/declare SnareStick string outer Sap Encrusted Branch
/declare TashStick string outer Journeyman's Walking Stick


   /if (${InvSlot[mainhand].Item.Name.NotEqual[${SnareStick}]}) {
      /call EquipItem "${SnareStick}|mainhand"
      /call EquipItem "${Primary}|offhand"

   :WaitSnare
      /doevents
      /delay 1
   /goto :WaitSnare

/endmacro

Sub Event_snared(string Line,string Mob)
   /echo ${Mob} Snared!
   /call SwapBack
/return

Sub Event_exp
   /echo Snare never proced 8(
   /if (!${Target.ID}) /call SwapBack
/return

Sub SwapBack
   /call EquipItem "${Secondary}|offhand"
   /call EquipItem "${Primary}|mainhand"
   /delay 1s ${InvSlot[mainhand].Item.Name.Equal[${Primary}]}
   /endmacro
/return
Last edited by Chill on Sat Nov 27, 2004 2:39 am, edited 1 time in total.

Birdbrain
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sat Oct 23, 2004 1:40 pm

Post by Birdbrain » Fri Nov 26, 2004 9:46 pm

doesnt work.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Sat Nov 27, 2004 2:29 am

It works just fine for me. Used it today in fact.

Do you own a Sap Encrusted Branch or have you edited this macro for your snare weapon? Do you have a recent copy of Spell_Routines.inc in your Macros directory?

What isn't working for you? What happens? Do you get any error message? More info man.

Dragon_collector
decaying skeleton
decaying skeleton
Posts: 4
Joined: Thu Sep 30, 2004 4:57 pm

Post by Dragon_collector » Sat Nov 27, 2004 2:48 pm

Actually I have the ensnare shield clicker for my druid alt. Don't think this would be had to mod to use the shield/offhand swap instead of mainhand but figured i'd ask first before i jumped in and started modding it and screwed myself.

Birdbrain
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sat Oct 23, 2004 1:40 pm

Post by Birdbrain » Wed Dec 01, 2004 8:40 pm

i edited for avatar wep and yes i have spell routines, it says unable to add macro line when i try to load it.

dedpoet
a hill giant
a hill giant
Posts: 247
Joined: Sat Aug 14, 2004 12:22 pm

Post by dedpoet » Thu Dec 02, 2004 10:53 am

Actually I have the ensnare shield clicker for my druid alt. Don't think this would be had to mod to use the shield/offhand swap instead of mainhand but figured i'd ask first before i jumped in and started modding it and screwed myself.
This is already built into spell_routines.inc.

Code: Select all

/call cast "name of the spell click on the shield" item

That will swap your shield in, click it for the spell, then swap it back out.

bam
a ghoul
a ghoul
Posts: 149
Joined: Thu May 13, 2004 11:53 pm

Post by bam » Thu Dec 02, 2004 4:36 pm

Birdbrain wrote:i edited for avatar wep and yes i have spell routines, it says unable to add macro line when i try to load it.
So you screwed up someones snare macro trying to make it proc avatar and say thier code doesn't work?......

Birdbrain
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sat Oct 23, 2004 1:40 pm

Post by Birdbrain » Thu Dec 02, 2004 5:48 pm

NO..... I tried it with snareswap too, it said unable to add line, and also tried it with changing snare stuff to avatar stuff.

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

Post by fearless » Thu Dec 02, 2004 7:19 pm

Then why don't you post what you are working with so you can get a real response instead of whatever exercise in futility you are running now.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

Birdbrain
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sat Oct 23, 2004 1:40 pm

Post by Birdbrain » Fri Dec 03, 2004 3:19 pm

fearless wrote:Then why don't you post what you are working with so you can get a real response instead of whatever exercise in futility you are running now.
i said the snareswap macro posted doesnt work for me,

Code: Select all

| snareswap.mac 

#include SpellRoutines.inc 
#event snared "#1# has been ensnared." 
#event exp "You gain party experience!!" 

Sub Main 
/declare Primary string outer ${InvSlot[mainhand].Item.Name} 
/declare Secondary string outer ${InvSlot[offhand].Item.Name} 
/declare SnareStick string outer Sap Encrusted Branch 
/declare TashStick string outer Journeyman's Walking Stick 


   /if (${InvSlot[mainhand].Item.Name.NotEqual[${SnareStick}]}) { 
      /call EquipItem "${SnareStick}|mainhand" 
      /call EquipItem "${Primary}|offhand" 

   :WaitSnare 
      /doevents 
      /delay 1 
   /goto :WaitSnare 

/endmacro 

Sub Event_snared(string Line,string Mob) 
   /echo ${Mob} Snared! 
   /call SwapBack 
/return 

Sub Event_exp 
   /echo Snare never proced 8( 
   /if (!${Target.ID}) /call SwapBack 
/return 

Sub SwapBack 
   /call EquipItem "${Secondary}|offhand" 
   /call EquipItem "${Primary}|mainhand" 
   /delay 1s ${InvSlot[mainhand].Item.Name.Equal[${Primary}]} 
   /endmacro 
/return
Btw how do you do the code window?
Last edited by Birdbrain on Sun Dec 05, 2004 7:43 pm, edited 1 time in total.

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

Post by fearless » Fri Dec 03, 2004 3:26 pm

My suggestion was actually in response to:
Birdbrain wrote:i edited for avatar wep and yes i have spell routines, it says unable to add macro line when i try to load it.
It looks like you just reposted what was originally posted with no changes. I thought you said you tried to make some changes?

And the wonderment of code brackets:

Code: Select all

[code]
[/code]
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Fri Dec 03, 2004 5:10 pm

Birdbrain wrote:#include SpellRoutines.inc
Unless you renamed your include file SpellRoutines.inc, you probably need to #include Spell_Routines.inc

May actually make some changes to this soon to have it swap in tash weapons first.

Birdbrain
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sat Oct 23, 2004 1:40 pm

Post by Birdbrain » Sun Dec 05, 2004 7:39 pm

i kinda modified it to try to work for avatar, i get this error when i try to run "Subruotine Equipitem wasn't found." and " snareswap.mac@51 (main)
: /call equip "${avatarstick}|mainhand" The current macro has ended. This is what i modified it to with Chill's snareswap macro.

Code: Select all

| snareswap.mac 

#include Spell_Routines.inc 
#event avatarproced "#1# "Your body screams with the power of an Avatar".
#event exp "You gain party experience!!" 

Sub Main 
/declare Primary string outer ${InvSlot[mainhand].Item.Name} 
/declare Secondary string outer ${InvSlot[offhand].Item.Name} 
/declare AvatarStick string outer Ancient Prismatic Brawl Stick 
/declare TashStick string outer Journeyman's Walking Stick 


   /if (${InvSlot[mainhand].Item.Name.NotEqual[${AvatarStick}]}) { 
      /call EquipItem "${avatarStick}|mainhand" 
      /call EquipItem "${Primary}|offhand" 

   :WaitAvatarproced 
      /doevents 
      /delay 1 
   /goto :Waitavatarproced

/endmacro 

Sub Event_Avatarproced(string Line,string Mob) 
   /echo Avatar proced! 
   /call SwapBack 
/return 

Sub Event_exp 
   /echo Avatar never proced 8( 
   /if (!${Target.ID}) /call SwapBack 
/return 

Sub SwapBack 
   /call EquipItem "${Secondary}|offhand" 
   /call EquipItem "${Primary}|mainhand" 
   /delay 1s ${InvSlot[mainhand].Item.Name.Equal[${Primary}]} 
   /endmacro 
/return


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

Post by fearless » Sun Dec 05, 2004 8:17 pm

Birdbrain wrote:i kinda modified it to try to work for avatar, i get this error when i try to run "Subruotine Equipitem wasn't found." and " snareswap.mac@51 (main)
: /call equip "${avatarstick}|mainhand" The current macro has ended. This is what i modified it to with Chill's snareswap macro.
"Subruotine Equipitem wasn't found" means that you either do not have Spell_Routines.inc or you don't have it spelled right or your copy of it is very very old.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

Birdbrain
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sat Oct 23, 2004 1:40 pm

Post by Birdbrain » Sun Dec 05, 2004 9:17 pm

This is my copy of spell_routines.inc

Code: Select all

| spell_routines.inc 
| 
| Written by Rusty~ 
| Last Modified 7/06/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 3 seconds, else it will strafe to interrupt 
|    ** IMPORTANT: if you want auto interrupt to work include this line 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. 
| - 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 wait till invis is off to cast the spell 
| 
| 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_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                                     | 
|----------------------+----------------------------------------------------------------------+ 

#event BeginCast "You begin casting#*#" 
#event Collapse "Your gate is too unstable, and collapses.#*#" 
#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 #*#" 
#event Standing "You must be standing to cast a spell#*#" 
#event Stunned "You have been stunned.#*#" 
#event Stunned "You cannot cast while stunned#*#" 
#event Stunned "You *CANNOT* cast spells, you have been silenced!#*#" 


Sub Cast(string spellName,string spellType,timer giveUpTimer,string mySub) 
   /if ( ${Me.Invis} && ${noInvis} ) /echo You're invis... waiting to cast 
:wait_for_stop 
   /if ( ${Me.Casting.ID} || ( ${Me.Invis} && ${noInvis} ) ) { 
      /delay 1 
      /goto :wait_for_stop 
   }  
   /if ( ${Me.Speed} ) { 
   :wait_for_stop2 
      /delay 1 
      /if ( ${Me.Moving} ) /goto :wait_for_stop2 
   } 
   /if ( !${Defined[giveUpTimer]} ) /declare giveUpTimer timer local 0 
   /if ( !${Defined[spellRecastTime1]} ) { 
      /declare lastSpell string outer 
      /declare refreshTime timer outer 0 
      /declare itemRefreshTime float outer 0 
      /declare i int local 
      /declare castReturn string outer 
      /delay 5 
      /for i 1 to 8 
         /declare spellRecastTime${i} timer outer 
         /if ( ${Me.SpellReady[${i}]} ) { 
            /varset spellRecastTime${i} 0 
         } else { 
            /varcalc spellRecastTime${i} 10*${Me.Gem[${i}].RecastTime} 
         } 
      /next i 
   } 
   /declare currentTarget int local 
   /declare currentTargetType string local 
   /declare swapItemBack bool local false 
   /declare delayTime timer local 
   /declare castEndTime timer local 
   /declare moveBack bool local 
   /if ( !${Defined[spellType]} ) /declare spellType string local spell 
   /if ( ( ${spellType.Equal[spell]} || ${spellType.Left[3].Equal[gem]} ) && !${Int[${Me.Book[${spellName}]}]} ) { 
      /echo Spell: "${spellName}" was not found in your book 
      /return CAST_UNKNOWNSPELL 
   } 
   /if ( ${spellType.Equal[spell]} || ${spellType.Left[3].Equal[gem]} ) { 
      /if ( !${Me.Gem[${spellName}]} ) { 
         /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.AltAbility[project illusion]} ) /call Cast "project illusion" "alt" 
   /declare slotName int local 
   /declare slotID int local 
   /declare oldSlotID int local 
:clear_events 
   /if ( ${Me.SpellReady[${spellName}]} ) /varset spellRecastTime${Me.Gem[${spellName}]} 0 
   /call ClearReturn 
   /doevents Recover 
   /doevents BeginCast 
   /doevents Fizzle 
   /doevents Interrupt 
   /doevents Standing 
   /doevents OutOfRange 
   /doevents OutOfMana 
   /doevents NoLOS 
   /doevents Resisted 
   /doevents Immune 
   /doevents Stunned 
   /doevents Collapse 
   /doevents NoTarget 
   /doevents NotReady 
   /if ( !${castReturn.Equal[CAST_SUCCESS]} ) { 
      /delay 1 
      /goto :clear_events 
   } 
   /varset giveUpTimer ${giveUpTimer.OriginalValue} 
   /declare recoverWaitTime timer local 30 
:cast_loop 
   /if ( ${Me.Ducking} ) /keypress duck 
   /if ( !${Me.Standing} ) /stand 
   /if ( ${spellType.Equal[item]} ) { 
      /if ( !${FindItem[${spellName}].InvSlot} ) { 
         /echo Cannot find item: ${spellName} 
         /return CAST_UNKNOWNSPELL 
      }      
      /if ( ${FindItem[${spellName}].InvSlot}>30 ) { 
         /varset swapItemBack true 
         /if ( ${FindItem[${spellName}].WornSlot[1]} ) { 
            /varset slotName ${FindItem[${spellName}].WornSlot[1]} 
         } else { 
            /varset slotName pack8 
         } 
         /varset slotID ${InvSlot[${slotName}].ID} 
         /varset oldSlotID ${FindItem[${spellName}].InvSlot.ID} 
         /autoinventory 
         /if ( ${InvSlot[${oldSlotID}].Pack} ) { 
         :open_pack 
            /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
            /if ( !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /goto :open_pack 
         } 
      :pick_up_item 
         /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
         /nomodkey /itemnotify ${InvSlot[${oldSlotID}]} leftmouseup 
         /if ( !${Cursor.Name.Equal[${spellName}]} ) /goto :pick_up_item 
      :exchange_items 
         /nomodkey /itemnotify ${slotID} leftmouseup 
         /if ( !${Me.Inventory[${slotID}].Name.Equal[${spellName}]} ) /goto :exchange_items 
         /if ( ${InvSlot[${oldSlotID}].Pack} ) { 
         :close_pack 
            /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
            /if ( ${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /goto :close_pack 
         } 
      } 
      /varset itemRefreshTime ${Math.Calc[${MacroQuest.Running}+500]} 
      /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} <<,]} 
      /cast item "${spellName}" 
   } else /if ( ${spellType.Equal[spell]} ) { 
   :wait_for_spell 
      /if ( ${spellRecastTime${Me.Gem[${spellName}]}} ) { 
         /if ( !${giveUpTimer} ) /return CAST_NOTREADY 
         /delay 1 
         /goto :wait_for_spell 
      } 
      /if ( !${lastSpell.Equal[item]} ) { 
      :wait_on_refresh 
         /if ( ${refreshTime}>0 ) { 
            /delay 1 
            /goto :wait_on_refresh 
         } 
         /varcalc delayTime 10*(1.5-${Spell[${spellName}].MyCastTime}) 
      :cast_delay_loop 
         /if ( ${delayTime}>0 ) { 
            /delay 1 
            /goto :cast_delay_loop 
         } 
      } 
      /cast "${spellName}" 
   } else { 
      /if ( !${Me.AltAbilityReady[${spellName}]} ) /return CAST_NOTREADY 
      /varset itemRefreshTime ${Math.Calc[${MacroQuest.Running}+500]} 
      /echo Using AA Ability: ${AltAbility[${spellName}].Name} 
      /alt activate ${AltAbility[${spellName}].ID} 
   } 
   /if ( ${Me.Casting.ID} ) { 
      /varcalc castEndTime ${Me.Casting.MyCastTime}*10 
      /if ( ${spellType.Equal[spell]} ) /echo Casting: ${Me.Casting.Name}${If[!${Me.Casting.TargetType.Equal[PB AE]} && !${Me.Casting.TargetType.Equal[self]} && ${Target.ID}, on >> ${Target.CleanName} <<,]} 
   } 
   /varset currentTarget ${Target.ID} 
   /varset currentTargetType ${Target.Type} 
   /varset moveBack false 
:wait_cast_loop 
   /if ( ${Me.Casting.ID} ) { 
      /if ( ${Defined[mySub]} ) /call ${mySub} 
      /if ( ${currentTarget} && !${Spawn[${currentTarget}].Type.Equal[${currentTargetType}]} ) { 
         /if ( !${Me.Casting.TargetType.Equal[PB AE]} && !${Me.Casting.TargetType.Equal[self]} && !${moveBack} && !${noInterrupt} ) { 
            /if ( !${Me.Mount.ID} || ${castEndTime}>30 ) { 
               /call Interrupt 
            } else { 
               /keypress strafe_right hold 
               /delay 1 
               /keypress strafe_right 
               /varset moveBack true 
               /varset castReturn CAST_CANCELLED 
            } 
         } 
      } 
      /if ( ${Me.State.Equal[DUCK]} ) /varset castReturn CAST_CANCELLED 
      /delay 1 
      /goto :wait_cast_loop 
   } 
   /if ( ${moveBack} ) { 
      /keypress strafe_left hold 
      /delay 1 
      /keypress strafe_left 
      /delay 15 !${Me.Moving} 
   } 
   /if ( ${swapItemBack} ) { 
   :exchange_items2 
      /itemnotify ${slotID} leftmouseup 
      /if ( ${Me.Inventory[${slotID}].Name.Equal[${spellName}]} ) /goto :exchange_items2 
      /if ( ${InvSlot[${oldSlotID}].Pack} ) { 
      :open_pack2 
         /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
         /if ( !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /goto :open_pack2 
      } 
   :drop_item 
      /if ( ${InvSlot[${oldSlotID}].Pack} && !${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
      /nomodkey /itemnotify ${oldSlotID} leftmouseup 
      /if ( ${Cursor.ID} ) /goto :drop_item 
      /if ( ${InvSlot[${oldSlotID}].Pack} ) { 
      :close_pack2 
         /nomodkey /itemnotify ${InvSlot[${oldSlotID}].Pack} rightmouseup 
         /if ( ${Window[${InvSlot[${oldSlotID}].Pack.Name}].Open} ) /goto :close_pack2 
      } 
   } 
   /if ( ${castReturn.Equal[CAST_CANCELLED]} ) { 
      /echo Spell was cancelled... 
      /return CAST_CANCELLED 
   } 
   /call ClearReturn 
   /doevents Recover 
   /doevents BeginCast 
   /doevents Fizzle 
   /doevents Interrupt 
   /doevents Standing 
   /doevents OutOfRange 
   /doevents OutOfMana 
   /doevents NoLOS 
   /doevents Resisted 
   /doevents Immune 
   /doevents Stunned 
   /doevents Collapse 
   /doevents NoTarget 
   /doevents NotReady 

   /if ( !${castReturn.Equal[CAST_SUCCESS]} ) { 
      /if ( ${castReturn.Equal[CAST_NOTREADY]} ) /return CAST_NOTREADY 
      /if ( ${castReturn.Equal[CAST_FIZZLE]} ) { 
         /echo Spell Fizzled. Recasting... 
         /goto :cast_loop 
      } 
      /if ( ${castReturn.Equal[CAST_RECOVER]} && ${spellType.Equal[spell]} ) { 
         /if ( !${recoverWaitTime} ) { 
            /varcalc spellRecastTime${Me.Gem[${spellName}]} 10*${Spell[${spellName}].RecastTime} 
            /if ( !${giveUpTimer} ) /return CAST_NOTREADY 
         } 
         /goto :cast_loop 
      } 
      /if ( ${castReturn.Equal[CAST_RESTART]} ) /goto :cast_loop 
      /if ( ${castReturn.Equal[CAST_STUNNED]} ) { 
         /delay 3s !${Me.Stunned} 
         /goto :cast_loop 
      } 
      /if ( ${castReturn.Equal[CAST_INTERRUPTED]} ) { 
         /if ( ${giveUpTimer} ) { 
            /echo Spell was interrupted. Recasting... 
            /goto :cast_loop 
         } 
         /echo Spell was interrupted... 
         /return CAST_INTERRUPTED 
      } 
   } 
   /if ( ${spellType.Equal[spell]} ) { 
      /varset lastSpell ${spellName} 
      /if ( !${castReturn.Equal[CAST_CANNOTSEE]} && !${castReturn.Equal[CAST_OUTOFRANGE]} && !${castReturn.Equal[CAST_OUTOFMANA]} && !${castReturn.Equal[CAST_NOTARGET]} ) { 
         /varcalc refreshTime 10*${Spell[${spellName}].RecoveryTime} 
         /varcalc spellRecastTime${Me.Gem[${spellName}]} 10*${Spell[${spellName}].RecastTime} 
      } 
   } else { 
      /varset lastSpell ${spellType} 
   :wait_item_loop 
      /if ( ${itemRefreshTime} > ${MacroQuest.Running} ) { 
         /delay 1 
         /goto :wait_item_loop 
      } 
   } 
   /if ( ${castReturn.Equal[CAST_COLLAPSE]} ) { 
      /varset giveUpTimer 200 
      /goto :cast_loop 
   } 
   /return ${castReturn} 

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

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

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

Sub Event_Resisted 
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_RESISTED 
/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