YAST - Yet another spell trainer.

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

Moderator: MacroQuest Developers

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

YAST - Yet another spell trainer.

Post by GoatFoot » Thu Oct 09, 2003 3:22 am

Specific to SK's, but should be easy to mod.

Code: Select all

| skspelltrain.mac - have a pet up and near by.

#define ARCANEMAX 235
#define MEDPOINT 30
#define MEDDELAY 30
#define ARCANECOUNT 4
#define NOTMEMMED 0
 
#include spellcast.mac
#chat say
#chat tell

#event TargetPet "This spell only works on undead"
#event TargetPet "You must first select a target for this spell"
#event TargetPet "Your target is out of range"
#event TargetPet "You cannot see your target"

Sub Main

  /declare MaxArcane global
  /declare FinishedTraining global
  /declare TrainingSpell array
  /declare i local

| initialize spell array
  /varset TrainingSpell(0) "Siphon Strength"
  /varset TrainingSpell(1) "Locate Corpse"
  /varset TrainingSpell(2) "Disease Cloud"
  /varset TrainingSpell(3) "Endure Cold"
  /varset TrainingSpell(4) "Ward Undead"
  
| determine arcane skill max
  /varcalc MaxArcane $char(level)*5+5
  /if n @MaxArcane>ARCANEMAX /varset MaxArcane ARCANEMAX

| initialize loop vars and start training
  /varset i 0
  /varset FinishedTraining TRUE
  :TrainingLoop
    /doevents
 
| Ye olde med loop
    /if n $char(mana,pct)<MEDPOINT {

        /if $char(state)!=SIT /sit
        :MedLoop
        /delay MEDDELAY
        /if n $char(mana,cur)<$char(mana,max) /goto :MedLoop
    }

|  If ya don't want to train it, don't mem it.
    /if n $char(gem,"@TrainingSpell(@i)")==NOTMEMMED /goto :NextSpell

    /if n $char(skill,"$spell("@TrainingSpell(@i)",skill)")==@MaxArcane /goto :NextSpell

   /varset FinishedTraining FALSE
   /call Cast "@TrainingSpell(@i)"
   :NextSpell

| Increment/reset spell index - Check if finished training 
    /if n @i<ARCANECOUNT {
      /varadd i 1
    } else {
      /if @FinishedTraining==TRUE /goto :EndMacro
      /varset i 0
      /varset FinishedTraining TRUE

    }
    /goto :TrainingLoop

  :EndMacro
  /endmacro keep keys
/return

sub Event_Chat
  /beep
  /beep
  /beep
  /mqpause
/return

sub Event_TargetPet
  /target id $char(pet)
  /delay 3
/return
Put some #defines in.
Updated with new spellcast.mac

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Fri Oct 10, 2003 11:27 pm

I tired using this macro with the updates spellcast.mac thats posted in this forum.. I get the following error:

Ending macro: Subroutine Cast wasnt found
spells.mac@57 (Main): /Cast"@TrainingSpell@i)@
Cleared the following: Timers Vars Arrays
The current macro has ended

any ideas?

Guest

Post by Guest » Fri Oct 10, 2003 11:49 pm

error msg "Ending macro: Subroutine Cast wasnt found" seems to indicate that spellcast.mac isn't being included properly.

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Sat Oct 11, 2003 1:17 am

I have the spellcast.mac in the directory.

Guest

Post by Guest » Sat Oct 11, 2003 1:49 am

so make a test macro

Code: Select all

#include spellcast.mac

sub Main

/call Cast  "@Param0"
/return
see if that works. if it does, add sections till it breaks, if it doesn't, you have issues. :)

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Sat Oct 11, 2003 2:09 am

in all honesty, I have no idea what you said..I know nothing about making a macro, or how they even work. I have read the manual, and was more confused than when I put together my kids swingset. But I do appreciate the reply.

Guest

Post by Guest » Sat Oct 11, 2003 7:20 am

copy paste this into a file called test.mac

Code: Select all

#include spellcast.mac

sub Main
  /call Cast  "@Param0"
/return
then, in EQ, type

/mac test "<spell name>"

the double quotes are needed if the spell name has an embedded space - is 2 or more words.

if you successfull cast the spell, then your set up is good and you need to check you spells.mac? file.

if this fails. you've got a problem with your install.

Guest

Post by Guest » Sat Oct 11, 2003 7:25 am

bleah, that's not true.

If the above macro fails, you need to look at your copy/paste of spellcast.mac.

- post any error msg you might get when you run it.

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Sat Oct 11, 2003 1:39 pm

Ok, copied that info into a file and named it test.

In eq I typed /macro test blaze, and I tried it with /macro test "Summon Companion" and got the same error message:

Ending macro: Subroutine Cast wasnt found
test.mac@4 (Main): /call Cast "@Param0"
Cleared the following: Timers Vars Arrays
The current macro has ended.

Spectre
orc pawn
orc pawn
Posts: 21
Joined: Tue Sep 02, 2003 10:31 am

Post by Spectre » Sat Oct 11, 2003 2:02 pm

Hmm, something's rotten in Denmark.

Open up your test.mac and block copy the copy of spellcast.mac into it, then try the experiment again.

Either there's a typo somewhere, or for some reason your MQ isn't able to find the spellcast.mac file.

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Sat Oct 11, 2003 2:31 pm

I pasted the whole spellcast.mac into that test mac..and still got the same error..

I have copies/pasted the posted spellcast.mac right into a spellcast.mac. its exactly as it was posted..

/cry

I do appreciate everyones help

BTW, I can get it to forage, do skills ( sense heading)..I just cant get it to cast spells..and thats all I really wanted to do..lol

Spectre
orc pawn
orc pawn
Posts: 21
Joined: Tue Sep 02, 2003 10:31 am

Post by Spectre » Sat Oct 11, 2003 2:40 pm

bzt wrote:I pasted the whole spellcast.mac into that test mac..and still got the same error..
Then there's a typo in there somewhere. Please post the contents of your test.mac file (the most recent one, with the spellcast.mac text pasted in).

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Sat Oct 11, 2003 2:46 pm

here it is.

Code: Select all

#include spellcast.mac 

sub Main 
  /call Cast  "@Param0" 
/return 

|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 
** 
** 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 "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 /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 

thanks again

Spectre
orc pawn
orc pawn
Posts: 21
Joined: Tue Sep 02, 2003 10:31 am

Post by Spectre » Sat Oct 11, 2003 3:00 pm

try this. save this code as test.mac, then post results...

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 
|** 
|** 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 "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 Main(Spell)
  /if $defined(Spell)<1{
    /echo Usage: /macro test <Spell Name>
    /endmacro
  } 
  /call Cast  "@Spell" 
/return 

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 
 

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Sat Oct 11, 2003 3:24 pm

pasted that into a new file and named it test.mac..tried it and got

Cannot call when a a macro isnt running.


Thanks