Spellcast.inc for necros/sks

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

User avatar
Leezard
a ghoul
a ghoul
Posts: 81
Joined: Wed Feb 04, 2004 12:54 pm

Spellcast.inc for necros/sks

Post by Leezard » Fri Feb 06, 2004 12:39 pm

Included the ability for it to automatically recast FD if it fails, enjoy.

Code: Select all

|Plazmic + 1 line change by Imperfect 

| SpellCast.inc 
| This will cast a spell reliably for you... 
| Usage: 
| /call Cast "spellname" 
| It will return the following values: 
| CAST_SUCCESS 
| CAST_UNKNOWNSPELL 
| CAST_OUTOFMANA 
| CAST_OUTOFRANGE 
| CAST_CANNOTSEE 
| CAST_STUNNED 
| CAST_RESISTED 
| CAST_FDFAIL
| 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 - switch some logic, removed defines - gf 

#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 "Your 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." 
#event OnlyAtNight "Spell can only be cast during the night." 
#event FDFAIL "has fallen to the ground"

Sub CastSpell(SpellName) 
  /if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL 
  | /echo Casting @SpellName 
  :StartCast 
  /call ClearReturnValue 
  /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 
     /doevents OnlyAtNight 
     /doevents FDFAIL 
     /if "$return"=="CAST_RESTART" { 
        /goto :StartCast 
     } 
     /if "$return"!="CAST_SUCCESS" /return "$return" 

/return CAST_SUCCESS 

Sub ClearReturnValue 
/return CAST_SUCCESS 

Sub Event_Fizzle 
|   /echo Event_Fizzle 
/return CAST_RESTART 

Sub Event_Interrupt 
|   /echo Event_Interrupt 
/return CAST_RESTART 

Sub Event_Recover 
|   /echo Waiting for recovery... 
   /delay 5 
/return CAST_RESTART 

Sub Event_Standing 
|   /echo Event_Standing 
   /stand 
/return CAST_RESTART 

Sub Event_Collapse 
|   /echo 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 


Sub Event_OnlyAtNight 
|   /echo Event_OnlyAtNight 
/return CAST_SUCCESS 

Sub Event_FDFAIL 
|   /echo Event_FDFAIL 
/return CAST_RESTART 
Last edited by Leezard on Fri Feb 06, 2004 2:02 pm, edited 1 time in total.
Death is merely a doorway, for a god!

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Fri Feb 06, 2004 1:54 pm

Fix the trigger message for this please.

Code: Select all

#event Resisted "You target resisted the " 
:)

User avatar
Leezard
a ghoul
a ghoul
Posts: 81
Joined: Wed Feb 04, 2004 12:54 pm

Post by Leezard » Fri Feb 06, 2004 2:10 pm

Fixed :)
Death is merely a doorway, for a god!

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

Post by LamahHerder » Sat Feb 07, 2004 3:41 am

oops there is 2 spellcast threads now 8*(

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Tue Feb 10, 2004 3:20 am

Might be 3 when I finish tweaking and testing mine.
Covers all situations (that I'm aware of) for any class.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

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

Post by LamahHerder » Sun Feb 15, 2004 3:40 am

Should post it karma, if it works better then the one im useing id love it

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Sun Feb 15, 2004 10:30 am

I'm adding a few things and making a few tweaks to it that broke from last couple of patches. after I'm satisfied with results, will post.

Since it;s in all my mac's, wanna make sure it works before posting
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!