SpellUp macro v1.0

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

Moderator: MacroQuest Developers

taman
decaying skeleton
decaying skeleton
Posts: 6
Joined: Thu Jan 15, 2004 4:59 am

SpellUp macro v1.0

Post by taman » Thu Jan 29, 2004 5:17 pm

Friend of mine asked me to come up with an easy to use macro that will just cast a spell over and over. I used the SpellCast.inc file (placed in an inc dir) and also used the skillup code from ml2517. Thanks!

Code: Select all

#include inc\SpellCast.inc

| ** SpellUp.mac v1.0 - by taman
| ** Usage: /macro SpellUp  (reads spells from ini file)
| ** Usage: /macro SpellUp "Spellname" delay (in seconds)
| ** ie.  /macro SpellUp "Spirit of Wolf" 2
| ** ie.  /macro SpellUp
| **
| ** This macro will recast a spell indefinitely.  You can either specify one
| ** spell to be recast upon invoking the macro, or you may specify multiple
| ** spells through the SpellUp.ini file. The ini file can specify up to 5 spells.
| ** To quit the macro at any time, just start camping... then cancel.
| ** NOTE: macro automatically selects yourself prior to every cast. (don't use strong nuke!)

#turbo

#define SPELLCASTINI "spellup.ini"
#define MAXSPELLS 10

#event SkillUp "You have become better at"
#event QUIT "It will take you about 30 seconds"

Sub Main
  /declare gSpellArray array2
  /declare gSpellCount global
  /declare cnt local
  /declare zbSpellCount local

  /varset gSpellCount 0

  /if $defined(Param0)==TRUE {
    /echo Starting spellup v1.0 (Single Spell Mode)
    /varset gSpellArray(0,0) "@Param0"
    /varset gSpellArray(0,1) @Param1
    /varset gSpellCount 1

  } else {
    /echo Starting spellup v1.0 (Ini Spell Mode)
    /call getIniSpellList
    /varset gSpellCount $return
  }

  :CASTSPELL
    /varset cnt 0
    /varset zbSpellCount $int($calc(@gSpellCount-1))
    /for cnt 0 to @zbSpellCount
      :MEDLOOP
      | check to make sure we have mana to cast this spell
      /if n $char(mana,cur)<$spell("@gSpellArray(@cnt,0)",mana) {
        /echo Out of Mana... medding
        /if "$char(state)"!="SIT" /sit
        /delay 10
        /doevents QUIT
        /goto :MEDLOOP
      }
      /if "$char(state)"!="STAND" /stand
      /press F1   | Select yourself
      /echo Casting @gSpellArray(@cnt,0) (@cnt)
      /call Cast "@gSpellArray(@cnt,0)"
      /delay "@gSpellArray(@cnt,1)s"
      /if "$return"=="CAST_OUTOFMANA" /goto :MedLoop
      /doevents QUIT
    /next cnt
    /doevents
  /goto :CASTSPELL
/endmacro

Sub getIniSpellList
  /declare spellcount local
  /declare tmpKey local
  /declare tmpValue local
  /declare tmpName local
  /declare tmpDelay local

  /varset spellcount 0
  /echo Loading spells...

  :READLOOP
    /varset tmpKey Spell@spellcount
    /varset tmpValue $ini(SPELLCASTINI,"Spell@spellcount")

    /if "@tmpValue"=="NOTFOUND||" {
      /if n @spellcount==0 {
        /echo No spells specified in SPELLUPINI.  Ending mac.
        /endmacro
      }
      /echo @spellcount spells loaded.
      /return @spellcount
    }

    /varset tmpName "$ini(SPELLCASTINI,"Spell@spellcount","Name")"
    /varset tmpDelay $ini(SPELLCASTINI,"Spell@spellcount","Delay")

    /varset gSpellArray(@spellcount,0) "@tmpName"
    /varset gSpellArray(@spellcount,1) @tmpDelay

    /if "@tmpDelay"=="NOTFOUND" /varset tmpDelay 0
    /if n @tmpDelay<0 /varset tmpDelay 0

    /echo @spellcount) '@tmpName' with delay of @tmpDelay seconds.
    /varset spellcount $int($calc(@spellcount+1))
    /if n @spellcount>MAXSPELLS /return
  /goto :READLOOP
/return $spellcount

Sub Event_SkillUp(SkillUpText)
  /declare ParseSkillLevel local
  /declare ParseSkill local
  /declare PositionStart local
  /declare PositionEnd local

  /varset PositionStart $calc($instr("! (","@SkillUpText")+3)
  /varset PositionEnd $instr(")","@SkillUpText")
  /varset ParseSkillLevel $mid(@PositionStart,$calc(@PositionEnd-@PositionStart),"@SkillUpText")
  /varset PositionStart $instr("You have become better at ","@SkillUpText")
  /varset PositionEnd $instr("! (","@SkillUpText")
  /varset ParseSkill $mid(@PositionStart,$calc(@PositionEnd-@PositionStart),"@SkillUpText")

  | /call ChatOut 5 "@MasterName" "@ParseSkill increased - @ParseSkillLevel ..."
  /echo @ParseSkill increased - @ParseSkillLevel ...

  /if n @ParseSkillLevel==$calc($calc($char(level)*5)+5) {
    | /call ChatOut 5 "@MasterName" "@ParseSkill maxed for level - @ParseSkillLevel ... woo!"
    /echo @ParseSkill maxed for level - @ParseSkillLevel ... woot!
    /if n @ParseSkillLevel==235 {
        |/call ChatOut 5 "@MasterName" "@ParseSkill maxed forever! - 235 is max!"
        /echo @ParseSkill maxed forever! - 235 is max!
    }
  }
/return

Sub Event_QUIT
  /echo Quit Command Recieved!
/endmacro

And here's a sample ini file (spellup.ini):

Code: Select all

[Spell0]
Name=Clarity
Delay=5

[Spell1]
Name=Insight
Delay=6

[Spell2]
Name=Gift of Magic
Delay=7

flukemello16
decaying skeleton
decaying skeleton
Posts: 1
Joined: Thu Feb 05, 2004 8:53 am

Post by flukemello16 » Thu Feb 05, 2004 8:57 am

sup, loaded the mac and i get this prob:

Code: Select all

no spells specified in spellupini ending mac

i have this in my spellcast.inc file

Code: Select all

[Spell0]
Name=Sense the Dead 
Delay=5 

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Thu Feb 05, 2004 9:01 am

Kay. I'll handle this one without ranting.

Spellup.ini should have the spell listed. It should be in the same folder as your macro.

Spellcast.inc is what the macro uses to handle fizzles, LOS, and other goodies that would take a whole lot of room and coding in one macro. Spellcast.inc(in this case) has to be in the Inc folder, in your macro directory. But you can easily change that to the macro folder.

So to wrap it all up. Spellup.ini and Spellcast.inc are two different files. Hence the error you're getting.

Thanks, have a nice day.
:twisted:
-Elric

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Thu Feb 05, 2004 10:18 am

Spellcast.inc can be found by searching these boards.
I was going to be nice and post a link, but the web server is crawling again.
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Thu Feb 05, 2004 1:18 pm

Don't even bother.

It's in the Snippets forum. And if you can't see the difference between Spellcast.inc and Spellup.ini, I rank you a dumbass, and not capable of being anything other than a spore.

BWAHAHAHA!

:twisted:
-Elric