#include spell_routines.inc
Sub Main
/declare noInvis int outer 1
/if (${FindItemCount[=Large Block of Clay]}<5) {
/echo Need to buy more Large Block of Clay!
/end
}
/if (!${Me.Book[Mass Enchant Clay]}) {
/echo You don't have Mass Enchant Clay in your spell book!
/end
}
/declare OldSpell string local
/varset OldSpell ${Me.Gem[1]}
:loop
/if (${Me.CombatState.Equal[COMBAT]} || ${Me.Moving} || !${Me.Standing} || ${Cursor.ID} && !${Me.Invis}) {
/delay 10s
/goto :loop
}
/if (!${Me.Gem[Mass Enchant Clay]}) /memspell 1 "Mass Enchant Clay"
/delay 5s ${Me.SpellReady[Mass Enchant Clay]}
/if (!${Me.SpellReady[Mass Enchant Clay]}) /goto :loop
/timed 1 /if (${Cursor.ID}) /autoinv
/delay 5s !${Cursor.ID}
/call cast "Mass Enchant Clay" gem1 2s
/if (${Cursor.ID}) /autoinv
/delay 5s !${Cursor.ID}
/if (${FindItemCount[=Large Block of Clay]}<5) {
/memspell 1 "${OldSpell}"
/timed 1 /if (${Cursor.ID}) /autoinv
/end
}
/goto :loop
/return