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
