Use /macro spellskill to work on skills in sequential order
Use /macro spellskill 1 to work on skills in random order
The macro will periodically display your progress.
Some of this code isn't fully tested, I didn't really test the GM, tell, or PC radius checking as I don't really worry about them. If you are paranoid, you can enable the checking and let me know if it pans out.
Code: Select all
|*
SpellSkill, by QHynoS
Supplied as-is, feel free to reuse any code and claim that it is your own
including my INI beautifier.
Simple macro to max out your base casting skills with checking for valid spells,
skill caps, and INI. Summoned items will be deleted and the PC will be targeted
(for spells that need a target). Evocation may be a problem for some classes/levels
due the inability to do self damage. All spells specified must be memmed or
otherwise available to be cast by name. The macro will end if all you hit all
specified spell skill caps.
If you are paranoid, set I_AM_PARANOID to TRUE. It's probably worthless, but
it exists for anyone that thinks it will help. It will camp you out if you get
more than 3 tells in 3 minutes or if PCs are within 300 radius and line of
sight for longer than 15 minutes. Casting is effectively suspended while PCs
are in the area. The GM check is there, but it's stupid.
The INI file ( "SpellSkill_INI_yourname.ini" ) generated by default:
[SpellSkill]
I_AM_PARANOID..................=FALSE
Med_To_Full_At_Percent_Mana....=10
Mana_Recover_Spell_Name........=
SpellSkill_Spell_Count.........=
Spell1_Cast_Name...............=
Spell2_Cast_Name...............=
Spell3_Cast_Name...............=
Spell4_Cast_Name...............=
Spell5_Cast_Name...............=
Med to full defaults at 10%, so you will stop casting and med to 100% when
this threshold is hit. Fill in the spell count, spell names (pick a spell for
each skill category) and priority from each casting skill. Priority is based
on lowest number If you have a mana recovery spell (e.g. Clarity, Harvest,
etc), supply the name and it will attempted just prior to medding.
Example INI:
[SpellSkill]
I_AM_PARANOID..................=FALSE
Med_To_Full_At_Percent_Mana....=10
Mana_Recover_Spell_Name........=Harvest
SpellSkill_Spell_Count.........=5
Spell1_Cast_Name...............=O'Keil's Radiation
Spell2_Cast_Name...............=True North
Spell3_Cast_Name...............=Fade
Spell4_Cast_Name...............=Halo of Light
Spell5_Cast_Name...............=Iceflame of E'ci
Usage:
/macro spellskill
Will run SpellSkill in normal mode where it will repeatly cast a spell to the
skillcap in priority order as specified in the INI file.
/macro spellskill 1
Will run SpellSkill in random mode where it will cast a random spell from the list
in the INI file.
*|
#chat tell
Sub Main(int Arg1)
/declare Mode int outer ${Arg1}
/declare MS_Ini_File string outer SpellSkill_INI_${Me.CleanName}.ini
/declare TellCount int outer 0
/declare TellTimer timer outer 0
/declare SkillDisplayTimer timer outer 0
/echo ${MS_Ini_File}
/call LoadIni ${MS_Ini_File}
/if ( !${SpellSkill_Spell_Count} ) {
/echo No Spell Count, new INI to edit?
/endmacro
}
:MainLoop
/doevents
/if ( ${I_AM_PARANOID} ) /call CheckForBadShit
/call CheckSkillCap
/call Med
/if ( !${Mode} ) {
/call DoSpellSkill
/goto :MainLoop
}
/call DoRandomSpellSkill
/goto :MainLoop
/return
Sub DoSpellSkill
/declare i int local
/for i 1 to ${SpellSkill_Spell_Count}
/if ( ${Me.Skill[${Spell["${Spell${i}_Cast_Name}"].Skill}]} < ${Me.SkillCap[${Spell["${Spell${i}_Cast_Name}"].Skill}]} ) {
/call CastSkill ${i}
/return
}
/next i
/return
Sub DoRandomSpellSkill
/declare i int local
/declare p int local ${Math.Rand[${SpellSkill_Spell_Count}]}
/varcalc p ${p} + 1
/call CastSkill ${p}
/return
Sub CastSkill(int SpellNumber)
/if ( !${Me.Skill[${Spell["${Spell${SpellNumber}_Cast_Name}"].Skill}]} ) {
/echo Cast Skill for ${SpellNumber} ${Spell${SpellNumber}_Cast_Name} not found, valid spell?
/endmacro
}
/if ( !${Me.SpellReady["${Spell${SpellNumber}_Cast_Name}"]} || ${Me.Skill[${Spell["${Spell${SpellNumber}_Cast_Name}"].Skill}]} == ${Me.SkillCap[${Spell["${Spell${SpellNumber}_Cast_Name}"].Skill}]} ) /return
/if ( ${TargetID} != ${Me.ID} ) /target id ${Me.ID}
/delay 10 ${Target.ID} == ${Me.ID}
/cast "${Spell${SpellNumber}_Cast_Name}"
/delay 100 !${Me.Casting.ID}
/delay 20 ${Cursor.ID}
/if ( ${Cursor.ID} ) /destroy
/return
Sub CheckSkillCap
/declare i int local
/declare b bool local FALSE
/for i 1 to ${SpellSkill_Spell_Count}
/if ( !${SkillDisplayTimer} ) /echo ${Spell["${Spell${i}_Cast_Name}"].Skill}: ${Me.Skill[${Spell["${Spell${i}_Cast_Name}"].Skill}]} of ${Me.SkillCap[${Spell["${Spell${i}_Cast_Name}"].Skill}]}
/if ( ${Me.Skill[${Spell["${Spell${i}_Cast_Name}"].Skill}]} < ${Me.SkillCap[${Spell["${Spell${i}_Cast_Name}"].Skill}]} ) /varset b TRUE
/next i
/if ( !${b} ) {
/echo No Casting skill found to be lower than the cap!
/endmacro
}
/if ( !${SkillDisplayTimer} ) /varset SkillDisplayTimer 300
/return
Sub Med
/if ( ${Me.PctMana} > ${Med_To_Full_At_Percent_Mana} ) /return
/echo ${Spell[${Mana_Recover_Spell_Name}]} ${Me.SpellReady[${Spell["${Mana_Recover_Spell_Name}"]}]}
/if ( ${Me.SpellReady[${Spell["${Mana_Recover_Spell_Name}"]}]} ) {
/cast "${Mana_Recover_Spell_Name}"
/delay 300 !${Me.State[STUN]}
}
/if ( ${Me.Standing} ) /sit
:MedLoop
/delay 10
/if ( ${Me.PctMana} < 100 ) /goto :MedLoop
/stand
/delay 10 ${Me.Standing}
/return
Sub CheckForBadShit
/declare infidelhangingaroundcount int local
:CheckForBadShitLoop
/if ( ${Spawn[gm].ID} || ${SpawnCount[pc los radius 300 zradius 300].ID} ) {
/delay 300
/varcalc infidelhangingaroundcount ${infidelhangingaroundcount} + 1
/if ( ${infidelhangingaroundcount} > 30 ) {
/echo Shit, I think someone has their eyes on me!
/camp
/endmacro
}
/goto :CheckForBadShitLoop
}
/if ( ${TellCount} > 3 && ${TellTimer} ) {
/echo OMFG I got more than 3 tells in 3 minutes, aborting!
/camp
/endmacro
}
/if ( $!{TellTimer} ) /varset TellCount 0
/return
Sub LoadIni(string Ini_File)
/declare i int local
/declare j int local
/call DeclareIniVar ${Ini_File} I_AM_PARANOID.................. int SpellSkill FALSE
/call DeclareIniVar ${Ini_File} Med_To_Full_At_Percent_Mana.... int SpellSkill 10
/call DeclareIniVar ${Ini_File} Mana_Recover_Spell_Name........ int SpellSkill
/call DeclareIniVar ${Ini_File} SpellSkill_Spell_Count......... int SpellSkill
/varset j ${SpellSkill_Spell_Count}
/if ( !${j} ) /varset j 5
/for i 1 to ${j}
/call DeclareIniVar ${Ini_File} Spell${i}_Cast_Name............... string SpellSkill
/next i
/return
Sub DeclareIniVar(string IniFile, string VarName, string VarType, string SectionName, string VarValue, string Alias)
|*Strips the ... off of the end of an INI variable so the actual var names are clean*|
/declare CleanVarName string local ${VarName}
/if ( ${VarName.Find[.]} ) {
/declare i int local
/varcalc i ${VarName.Find[.]}-1
/varset CleanVarName ${VarName.Left[${i}]}
}
|*Defines the clean var name if not defined and then writes it to the INI or reads the INI value*|
/if ( !${Defined[${CleanVarName}]} ) /declare ${CleanVarName} ${VarType} outer
/declare TempString string local ${Ini["${IniFile}",${SectionName},${VarName},NOTFOUND]}
/if ( ${TempString.Equal[NOTFOUND]} ) {
/varset ${CleanVarName} ${VarValue}
/ini "${IniFile}" "${SectionName}" "${VarName}" "${${CleanVarName}}"
} else {
/varset ${CleanVarName} ${TempString}
}
/return
Sub Event_Chat
/varcalc TellCount ${TellCount} + 1
/if ( $!{TellTimer} ) /varset TellTimer 1800
/delay 300
/doevents
/return



