Need help with a macro you are writing? Ask here!
Moderator: MacroQuest Developers
-
Fuergrissa
- a grimling bloodguard

- Posts: 607
- Joined: Mon Dec 08, 2003 3:46 pm
- Location: UK
Post
by Fuergrissa » Sun May 09, 2004 12:53 pm
I have written a Spell Training macro and as it stands will cast OVER and OVER all spells in gem slots BUT i need someone to help me out with the logic code to stop once all spells in the slots have reached their respective "ArcaneMax" also if anyone has any ideas on tidying up if it needs it or any Constructive critism would be welcome.
*** You MUST Include
SpellCast.inc***
Code: Select all
| trainspell.mac
| Made by Fuergrissa V1.0
#Define ArcaneMax 235
#include spellcast.inc
Sub Main
/declare ArcaneLevel int outer
/declare SpellName string outer
/declare GemNumber int outer
/declare WhatSkill string outer
/varcalc ArcaneLevel ${Me.Level}*5+5
/echo Your Max Spell Cap is ${ArcaneLevel}
/if (${ArcaneLevel}<${ArcaneMax}) /varset ArcaneLevel ArcaneMax
/echo Your Current Spell Cap is ${ArcaneLevel}
/varset GemNumber 0
/varset SpellName ""
/varset WhatSkill ""
:TrainingLoop
/if (${Me.PctMana}<20) /goto :SitDown
/if (${Cursor.ID}) /autoinv
/goto :CastSpell
/return
:SitDown
/echo Mana at ${Me.PctMana}% Medding till over 98%
:MedLoop
/if (${Me.State.Equal[STAND]}) /sit
/if (${Me.PctMana}>98) /goto :FullMana
/goto :MedLoop
/return
:FullMana
/echo Mana at ${Me.PctMana}% Starting Casting Again.
/if (${Me.State.Equal[SIT]}) /stand
:CastSpell
/Varcalc GemNumber ${GemNumber}+1
/if (${GemNumber}>8) /varset GemNumber 1
/varset SpellName ${Me.Gem[${GemNumber}]}
/if (!${Me.Gem[${SpellName}]}) /goto :TrainingLoop
/call TestSkill
/target myself
/echo Casting ${SpellName} from GemSlot ${GemNumber} of Type ${Spell[${SpellName}].Skill} (${Me.Skill[${Spell[${SpellName}].Skill}]})
/call cast "${SpellName}"
/goto :TrainingLoop
/return
Sub TestSkill
/if (${Me.Skill[${Spell[${SpellName}].Skill}]}==${ArcaneLevel}) /goto :TooHigh
/return
:TooHigh
/echo You cannot Increase ${WhatSkill} anymore.
/return
[color=red]:Finished
/echo Ending
/endmacro[/color]
The stuff in red is waiting for the logic code for max skills.
As usual Many Thanks to whoever can help.
-
wilso132
- Contributing Member

- Posts: 106
- Joined: Thu Oct 17, 2002 11:53 am
Post
by wilso132 » Sun May 09, 2004 1:58 pm
Here's some code from an old macro I have, change it over and it should work for you:
Code: Select all
| Initalize
#define spellmaxskill_ 235
....
[color=red]| Set later, using this formula (probably what you need)[/color]
/if n $int($calc($char(level)*5+5))<=spellmaxskill_ /varset castmcr_spellmaxskill $int($calc($char(level)*5+5))
/if n $int($calc($char(level)*5+5))>=spellmaxskill_ /varset castmcr_spellmaxskill spellmaxskill_
.....
| Set spell skills of each type
/varset castmcr_spellskillabj $char(skill,abjuration)
/varset castmcr_spellskillalt $char(skill,alteration)
/varset castmcr_spellskillcon $char(skill,conjuration)
/varset castmcr_spellskillevo $char(skill,evocation)
/varset castmcr_spellskilldiv $char(skill,divination)
-
Fuergrissa
- a grimling bloodguard

- Posts: 607
- Joined: Mon Dec 08, 2003 3:46 pm
- Location: UK
Post
by Fuergrissa » Sun May 09, 2004 2:20 pm
what i am trying to do is make a note of the spell skill say abju if its max set a mark in a variable or an array if all spells being cast equall the max then end macro or camp out, i just cant get my head around arrays ( if that is what i need )
-
Fuergrissa
- a grimling bloodguard

- Posts: 607
- Joined: Mon Dec 08, 2003 3:46 pm
- Location: UK
Post
by Fuergrissa » Sun May 09, 2004 3:48 pm
ok i think i have it working , tested on 2 toons one under and one over max it all worked ok.
If anyone can tidy it up or offer a better way please feel free.
Code: Select all
| trainspell.mac
| Written by Fuergrissa V2.0
#Define ArcaneMax 235
#include spellcast.inc
Sub Main
/declare ArcaneLevel int outer
/declare SpellName string outer
/declare GemNumber int outer
/declare WhatSkill string outer
/declare Maxxed int outer
/varcalc ArcaneLevel ${Me.Level}*5+5
/echo Your Spell Cap is ${ArcaneLevel}
/if (${ArcaneLevel}>ArcaneMax) /varset ArcaneLevel ArcaneMax
/echo Your Current Spell Cap is ${ArcaneLevel}
/varset GemNumber 0
/varset Maxxed 0
/varset SpellName ""
/varset WhatSkill ""
:TrainingLoop
/if (${Me.PctMana}<10) /goto :SitDown
/if (${Cursor.ID}) /autoinv
/goto :CastSpell
:SitDown
/echo Mana at ${Me.PctMana}% Medding till over 98%
:MedLoop
/if (${Me.State.Equal[STAND]}) /sit
/if (${Me.PctMana}>98) /goto :FullMana
/goto :MedLoop
/return
:FullMana
/echo Mana at ${Me.PctMana}% Starting Casting Again.
/if (${Me.State.Equal[SIT]}) /stand
:CastSpell
/Varcalc GemNumber ${GemNumber}+1
/if (${GemNumber}>8) /varset GemNumber 1
/varset SpellName ${Me.Gem[${GemNumber}]}
/if (!${Me.Gem[${SpellName}]}) /goto :TrainingLoop
/goto :TestSkill
:StartCasting
/target myself
/echo Casting ${SpellName} from GemSlot ${GemNumber} of Type ${Spell[${SpellName}].Skill} (${Me.Skill[${Spell[${SpellName}].Skill}]})
/varset Maxxed 0
/call cast "${SpellName}"
/goto :TrainingLoop
/return
:TestSkill
/if (${Me.Skill[${Spell[${SpellName}].Skill}]}==${ArcaneLevel}) /goto :TooHigh
/goto :StartCasting
/return
:TooHigh
/varset WhatSkill ${Spell[${SpellName}].Skill}
/varcalc Maxxed ${Maxxed}+1
/echo You cannot Increase ${WhatSkill} anymore.
/if (${Maxxed}==8) /goto :Finished
/goto :TrainingLoop
/return
:Finished
/echo Ending
/endmacro
Posting in Macros Section.
-
Chill
- Contributing Member

- Posts: 435
- Joined: Fri May 07, 2004 5:06 pm
- Location: Erie, PA
Post
by Chill » Mon May 10, 2004 7:13 am
1) Added a line to check for a mount, and cast one if not already
2) Deleted the standing/sitting crap
3) Added spaces between sections
4) Made it /sit and /camp at the end.
Code: Select all
| trainspell.mac
| Written by Fuergrissa V2.0
#Define ArcaneMax 235
#include spellcast.inc
Sub Main
/declare ArcaneLevel int outer
/declare SpellName string outer
/declare GemNumber int outer
/declare WhatSkill string outer
/declare Maxxed int outer
/varcalc ArcaneLevel ${Me.Level}*5+5
/if (${ArcaneLevel}>ArcaneMax) /varset ArcaneLevel ArcaneMax
/echo Your Current Spell Cap is ${ArcaneLevel}
/varset GemNumber 0
/varset Maxxed 0
/varset SpellName ""
/varset WhatSkill ""
/if (!${Me.Buff["Summon Drogmor"].Duration}) /call cast "Small Red Drum" item |edit your mount if different
:TrainingLoop
/if (${Me.PctMana}<10) /goto :Med
/if (${Cursor.ID}) /autoinv
/goto :CastSpell
:Med
/echo Mana at ${Me.PctMana}% Medding till over 98%
:MedLoop
/if (${Me.PctMana}>98) /goto :FullMana
/goto :MedLoop
:FullMana
/echo Mana at ${Me.PctMana}% Starting Casting Again.
:CastSpell
/Varcalc GemNumber ${GemNumber}+1
/if (${GemNumber}>8) /varset GemNumber 1
/varset SpellName ${Me.Gem[${GemNumber}]}
/if (!${Me.Gem[${SpellName}]}) /goto :TrainingLoop
/goto :TestSkill
:StartCasting
/target myself
/echo Casting ${SpellName} from GemSlot ${GemNumber} of Type ${Spell[${SpellName}].Skill} (${Me.Skill[${Spell[${SpellName}].Skill}]})
/varset Maxxed 0
/call cast "${SpellName}"
/goto :TrainingLoop
:TestSkill
/if (${Me.Skill[${Spell[${SpellName}].Skill}]}==${ArcaneLevel}) /goto :TooHigh
/goto :StartCasting
:TooHigh
/varset WhatSkill ${Spell[${SpellName}].Skill}
/varcalc Maxxed ${Maxxed}+1
/echo You cannot Increase ${WhatSkill} anymore.
/if (${Maxxed}==8) /goto :Finished
/goto :TrainingLoop
:Finished
/echo Ending
/sit
/camp desktop
/endmacro
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Mon May 10, 2004 7:53 am
Like it Fuergrissa :) Works on all my toons without having to edit anything. Big bonus as I'm a neat freak with files on my puter.
Glad to see this come out of that mess we started working with about two weeks ago!

-
Fuergrissa
- a grimling bloodguard

- Posts: 607
- Joined: Mon Dec 08, 2003 3:46 pm
- Location: UK
Post
by Fuergrissa » Mon May 10, 2004 7:56 am
I would not have gotten this far without your help, THANK YOU very much.