Trying to add automem to spellcast

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Goofmester1
a hill giant
a hill giant
Posts: 241
Joined: Thu Nov 06, 2003 4:26 am

Trying to add automem to spellcast

Post by Goofmester1 » Sun Dec 14, 2003 10:25 pm

Working on adding automemming to Plazmic's spellcast.ini.. can anyone look over the changes and tell if they should work? would try it out but at work right now so no EQ access. What I want to add is that if the spell is not memmed it will mem the spell to slot 6 and then cast it.
Changes/additions are in Red

Code: Select all

| SpellCast.inc 
| This will cast a spell reliably for you... 
| Usage: 
| /call Cast "spellname" [item] 
| 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 


#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,Item) 
:StartCast 
  /if "@Item"=="Item" { 
  /call ClearReturnValue 
  /cast item "@SpellName" 
} else { 
  /if n $char(gem,"@SpellName")==0 [color=red]/goto :spellmem |Attempt to get automem routine running was /return CAST_UNKNOWNSPELL[/color]
  /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 "$return"=="CAST_RESTART" /goto :StartCast 
     /if "$return"!="CAST_SUCCESS" /return "$return"
     [color=red]/if "$return"=="CAST_UNKNOWNSPELL" /goto :spellmem |addeded to try and get automemming working[/color]
/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
[color=red]| Attempt to get a automem routine running
Sub Mem
:spellmem
     /if  n $char(gem,"@SpellName")==0 {
     /memspell 6 "@SpellName"
     /goto :StartCast
}
/return[/color]
Thanks in advance for any help.

User avatar
psychotik
a ghoul
a ghoul
Posts: 112
Joined: Mon Oct 06, 2003 3:48 am

Post by psychotik » Sun Dec 14, 2003 11:09 pm

heres what i did, should work

Code: Select all

| 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 
|  
| New Vars Modification 
| Plazmic's no globals needed version 

#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) 
  /if n $char(gem,"@SpellName")==0 /call Mem
  /if "$return"=="CAST_RESTART" /goto :StartCast 
  :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 "$return"=="CAST_RESTART" /goto :StartCast 
   /if "$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 

Sub Mem(Spellname)
     /if n $char(gem,"@SpellName")==0 { 
     /memspell 6 "@SpellName" 
} 
/return CAST_RESTART 

Goofmester1
a hill giant
a hill giant
Posts: 241
Joined: Thu Nov 06, 2003 4:26 am

Post by Goofmester1 » Mon Dec 15, 2003 7:09 am

I thought /call was to get it to look for a new macro.. so maybe a /goto there instead.. thanks for the idea I will work on it once I get home.

Goofmester1
a hill giant
a hill giant
Posts: 241
Joined: Thu Nov 06, 2003 4:26 am

Post by Goofmester1 » Mon Dec 15, 2003 8:54 am

Ahh I found the readme.html.. /em a light shines

Thanks for the info psychotik

User avatar
psychotik
a ghoul
a ghoul
Posts: 112
Joined: Mon Oct 06, 2003 3:48 am

Post by psychotik » Mon Dec 15, 2003 9:51 pm

so yeah i got around to trying that and it didnt work, so i fixed it!

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) 
  /if n $char(gem,"@SpellName")==0 /call Mem "@SpellName"
  /if "$return"=="CAST_RESTART" /goto :StartCast
  :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 "$return"=="CAST_RESTART" /goto :StartCast 
   /if "$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 

Sub Mem(SpellName)
     /memspell 7 "@SpellName" 
:memming
  /if n $char(gem,"@Spellname")==-2 /goto :memming
/return CAST_RESTART