The goal is simply to train Alteration, Divination, etc, whatever. The macro should be able to check how much mana the character still has. If it is less than, say, 10 percent, then have the character sit and med until it has full mana. Once it has full mana, just have it get up and start casting again.
The first version tries to use a pair of while loops. The MQ2 window keeps telling me that it could not parse the first while statement and exits the macro before attempting anything else, of course.
Here is the first version's code:
Code: Select all
Sub Main
:MainLoop
/while (${Me.PctMana}>10)
{
/docommand /cast 1
| This delay makes the macro wait until the cast time and
| the re-cast time have elapsed
| Granted, this delay would have to be modified according
| to the length of the cast time and the re-cast time.
/delay 6s
}
/while (${Me.CurrentMana}<${Me.MaxMana})
{
/if(${Me.Sitting})
{
| Already sitting.
| So, continue to sit.
}else
{
| Standing. Have a seat.
/docommand /sit
}
}
/goto :MainLoop
/endmacro
Failed to parse /if command. Could not find command to execute.
Naturally, it chokes on the first if statement and exits the macro.
Here is the code for the second version:
Code: Select all
Sub Main
:Loop1
:CastLoop
/if (${Me.PctMana}>10)
{
/docommand /cast 1
| This delay makes the macro wait until the cast time and
| the re-cast time have elapsed
/delay 6s
| Go back to the top and re-evaluate the mana remaining
/goto :CastLoop
}
/if (${Me.PctMana}<11)
{
| Mana is less than 11 percent
| Time to med up
/goto :SitLoop
}
:SitLoop
/if (${Me.CurrentMana}<${Me.MaxMana})
{
/if (${Me.Sitting})
| Currently sitting.
| Go back to the top of this loop and
| re-evaluate whether to continue medding or no
/goto :SitLoop
/if (${Me.Standing})
| You weren't sitting.
| Have a seat and med up.
/docommand /sit
| Go back to the top of this loop and
| re-evaluate whether to continue medding or no
/goto :SitLoop
}
| In going back over this macro, I realized that this next if
| was not required because if CurrentMana !< MaxMana, then
| the macro is going to jump down to /goto :Loop1 without this
| if in the way.
| Leaving this if in the macro simply to be complete and
| thorough.
/if (${Me.CurrentMana}==${Me.MaxMana})
{
/docommand /sit
/goto :CastLoop
}
/goto :Loop1
/return
Additionally, I did have a working version that couldn't evaluate how much mana the character had remaining, but it DID cast the spell over and over again. Alas, in my attempts to get this macro working I have over-written the semi-working version. What that version did manage to do, though, is to cast the spell, wait 6s, sit, stand, repeat. If I recall correctly, that version did not use the goto's for :CastLoop and :SitLoop. I simply used effectively ordered and nested if statements to accomplish what I wanted. However, to meditate, I had to end the macro. My goal is to get a macro that I wrote (& thus understand better) that allows me to have my characters practice any spell skills they can outside of combat. I managed to do this with my monk and have posted that macro for others to make use of.
Thanks in advance.
Edit: Added code brackets.




