imbue.mac

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

Moderator: MacroQuest Developers

brianman
a ghoul
a ghoul
Posts: 114
Joined: Mon Jun 07, 2004 7:46 am

imbue.mac

Post by brianman » Sat Jul 15, 2006 2:50 pm

Converted my old Imbue.mac
This is untested..

Changes:
2006-08-04:
Fixed the unclosed bracket at line 8.
Fixed the non-quoted ${Castname} at line 33.
Thanks to Amadeus for finding those :)

Code: Select all

#Event NOCOMPONENT  "You are missing some required spell components."
#Event NOSPELL      "You do not seem to have that spell memorized."
#Event NOMANA       "Insufficient Mana to cast this spell!"
#Event INTERRUPTED  "Your spell is interrupted."
#Event FIZZLED      "Your spell fizzles!"

Sub Main
    /if (!${Defined[Param1]}) /call Syntax
    /declare Spellname      string  outer   ${Param0}
    /declare Component      string  outer   ${Param1}

    /declare UsingMount     bool    outer   FALSE
    /declare Recast         bool    outer   FALSE
    /declare MassImbue      bool    outer   FALSE
    /declare Wildcard       bool    outer   FALSE

    /declare Castname       string  outer   ${Spellname}

    /if (${Me.Gem[Mass ${Spellname}]}) /varset MassImbue TRUE
    /if (${Component.Left[1].Equal[*]}) {
        /varset Wildcard TRUE
        /varset Component ${Component.Right[-1]}
    }

    :Loop
        /if (${Me.Buff[Summon Horse].ID} || ${Me.Buff[Summon Drogmor].ID}) {
            /varset UsingMount TRUE
        } else {
            /varset UsingMount FALSE
        }
        /if (!${Me.Standing}) /stand
        /if (${MassImbue}) /if (${FindItemCount[${If[${Wildcard},,=]}${Component}]}) {
            /varset Castname Mass ${Spellname}
        } else {
            /varset Castname ${Spellname}
        }
        /cast "${Castname}"
        /doevents
        /if (${Recast}) {
            /varset Recast FALSE
            /goto :Loop
        }
        /delay ${Math.Calc[${Spell[${Castname}].MyCastTime.Int}+1]}s (!${Me.Casting.ID})
        /delay 1s
        /doevents
        /if (${Recast}) {
            /varset Recast FALSE
            /goto :Loop
        }
        /if (!${UsingMount} && ${Me.State.NotEqual[SIT]}) /sit
        /autoinventory
        /delay ${Math.Calc[${Spell[${Castname}].RecoveryTime.Int}+1]}s (${Me.SpellReady[${Castname}]})
        /delay 5
    /goto :Loop
/return

Sub Syntax
    /echo Syntax: /macro imbue "Single Imbue/Enchant Component Spellname" "Component Name"
    /echo Example: /macro imbue "Enchant Clay" "Large Block of Clay"
    /echo You are recommended to memorize both the "Mass Imbue/Enchant" and the "Single Imbue/Enchant" spell, if you have it.
    /echo The macro will automatically use the right one, according to the number of components left to imbue/enchant.
    /endmacro
/return

Sub Event_NOMANA
    /varset Recast TRUE
    /if (!${UsingMount} && ${Me.State.NotEqual[SIT]}) /sit
    :Loop
        /delay 6s
    /if (${Me.PctMana} < 100) /goto :Loop
/return

Sub Event_FIZZLED
    /varset Recast TRUE
/return

Sub Event_INTERRUPTED
    /varset Recast TRUE
/return

Sub Event_NOSPELL
    /endmacro
/return

Sub Event_NOCOMPONENT
    /endmacro
/return
Last edited by brianman on Fri Aug 04, 2006 3:33 pm, edited 2 times in total.

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Sun Jul 16, 2006 4:20 pm

Couple of corrections so far:

Line 8 should be:

Code: Select all

    /if (!${Defined[Param1][b]}[/b]) /call Syntax 
And, line 33 should be:

Code: Select all

        /cast [b]"[/b]${Castname}[b]"[/b]

brianman
a ghoul
a ghoul
Posts: 114
Joined: Mon Jun 07, 2004 7:46 am

Post by brianman » Fri Aug 04, 2006 3:46 pm

Thanks Amadeus, updated the initial post with your fixes :) hope the macro works as intended beyond that :)