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
