spellcast.inc

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

LamahHerder
a hill giant
a hill giant
Posts: 299
Joined: Sat Jun 29, 2002 2:37 am

spellcast.inc

Post by LamahHerder » Fri Jan 16, 2004 5:52 pm

Since alot of people still ask for this, posting it.

Code: Select all

| SpellCast.inc
| This will cast a spell reliably for you...
| Usage:
| /call Cast "spellname"
| or
| /call Cast "itemname" [item]
| example: /call Cast "Death Peace"
| example: /call Cast "
| It will return the following values:
| CAST_SUCCESS
| CAST_UNKNOWNSPELL
| CAST_OUTOFMANA
| CAST_OUTOFRANGE
| CAST_CANNOTSEE
| CAST_STUNNED
| CAST_RESISTED
|
| New Vars Modification
| Plazmic's no globals needed version
|

| Oct 9, 2003 - Updated to work with new vars and $char(casting) - gf
| Oct 11, 2003 - switched some logic, removed defines - gf
| Oct 15, 2003 - Item support added by EqMule
|  Modified to add automeming of spells. Goofmester1
| Dec 26, 2003 fd fail 1 added by m0nk

#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 Standing "has fallen to the ground."
#event Collapse "Your gate is too unstable, and collapses."

Sub Cast(SpellName,Item)
	/sendkey up up
	/sendkey up down
	/delay 5
	/if "@Item"=="Item" /goto :StartCast
	/if n $char(gem,"@SpellName")==0 {
		/memspell 5 "@SpellName"
		/delay 5s
		}
	:StartCast
		/if "@Item"=="Item" {
			/call ClearReturnValue
			/cast item "@SpellName"
		} else {
			/if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL
			/call ClearReturnValue
			/if n $char(gem,"@SpellName")<0 {
				/delay 0
				/goto :StartCast
				}
				/cast "@SpellName"
			}
	:WaitCast
		/if "$char(casting)"=="TRUE" {
		/delay 1
		/goto :WaitCast
		}
	/delay 1
	/doevents Fizzle
	/doevents Interrupt
	/doevents Interrupt
	/doevents Recover
	/doevents Standing
	/doevents OutOfRange
	/doevents OutOfMana
	/doevents NoLOS
	/doevents Resisted
	/if "$return"=="CAST_RESTART" /goto :StartCast
	/if "$return"!="CAST_SUCCESS" /return "$return"
/return CAST_SUCCESS

Sub ClearReturnValue
/return NULL

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
	/delay 1s
/return CAST_RESTART

Sub Event_Resisted
/return CAST_RESISTED

ionsf
a ghoul
a ghoul
Posts: 94
Joined: Wed Jan 14, 2004 10:19 pm

Post by ionsf » Tue Jan 20, 2004 6:36 pm

BRAVO