Save the following code into a file called spells.mac:
Code: Select all
#event Fizzle "Your spell fizzles!"
#event Interrupt "Your casting has been interrupted!"
#event Interrupt "Your spell is interrupted."
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
#event Resisted "You target resisted the "
#event OutOfMana "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event NoLOS "You cannot see your target."
#event Stunned "You cannot cast while stunned"
#event Standing "You must be standing to cast a spell"
#event Collapse "Your gate is too unstable, and collapses."
Sub Cast(SpellName)
/echo attempting to cast @SpellName
/if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL
:StartCast
/call ClearReturnValue
/if n $char(gem,"@SpellName")<0 {
/delay 0
/goto :StartCast
}
/cast "@SpellName"
:WaitCast
/if "$char(casting)"=="TRUE" {
/delay 1
/goto :WaitCast
}
/doevents Fizzle
/doevents Interrupt
/doevents Recover
/doevents Standing
/doevents OutOfRange
/doevents OutOfMana
/doevents NoLOS
/doevents Resisted
/if n "$return"=="CAST_RESTART" /goto :StartCast
/if n "$return"!="CAST_SUCCESS" /return "$return"
/return CAST_SUCCESS
Sub ClearReturnValue
/return CAST_SUCCESS
Sub Event_Fizzle
/return CAST_RESTART
Sub Event_Interrupt
/return CAST_RESTART
Sub Event_Recover
/delay 5
/return CAST_RESTART
Sub Event_Standing
/stand
/return CAST_RESTART
Sub Event_Collapse
/return CAST_RESTART
Sub Event_OutOfMana
/return CAST_OUTOFMANA
Sub Event_OutOfRange
/return CAST_OUTOFRANGE
Sub Event_NoLOS
/return CAST_CANNOTSEE
Sub Event_Stunned
/return CAST_STUNNED
Sub Event_Resisted
/return CAST_RESISTED
Code: Select all
#turbo
#include spells.mac
Sub Main
/call Cast "@Param0"
/return

