** Note, example only and could be bad to actually use, besides, its 6am and my baby woke me up so I'm bored **
1. Determine what you want your macro to do
Example: If my hps drop below 99%, target myself, cast the aa divine arbitration, cast the aa celestial regeneration, tell the group they suck, and gate.
2. Create your macros framework
Example: As we will have a macro that is continuously checking the circumstances, we will put in a basic loop.
Code: Select all
| Savemyass.mac, usage /macro savemyass.mac
| I use this to heal in groups with my cleric
Sub Main
:loop
/goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
3. Flesh out the outline with psuedocode to get an idea of how you want things to be done.
Example:
Code: Select all
| Savemyass.mac, usage /macro savemyass.mac
| I use this to heal in groups with my cleric
Sub Main
:loop
if my hitpoints go below 99% then (
target myself
cast aa DA
cast aa CR
/g fuck off asshats and learn to control agro
cast gate
)
/goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
4. Pull out the manual and start searching for what we want to do.
Example: First we need to find out how to do an if statement, lets check the Macroquest commands section, and we find:
/if (conditions) {command(s)}
Runs command(s) if conditions evaluates to TRUE.
conditions are ONLY numeric compares. You must use MQ2Data string comparison to turn string compares into numeric compares.
conditions gets evaluated down to a single term from however many terms there are (You may use && and || freely.)
Multiple commands can be surrounded by { }, allowing multiple commands to be executed if the comparison is true.
} can be followed by else and a command. (also see /multiline)
Example:
/if (${String[${firstvar}].Equal[This is true]}) {
/echo TRUE
} else /if (!${secondvar}) {
/echo FALSE
/mqlog secondvar equals: ${secondvar}
} else {
/echo It's Something else
}
Now we are getting somewhere, lets change the psuedocode to the actual code show in the usage.
Code: Select all
| Savemyass.mac, usage /macro savemyass.mac
| I use this to heal in groups with my cleric
Sub Main
:loop
/if (my hitpoints go below 99%) {
target myself
cast aa DA
cast aa CR
/g fuck off asshats and learn to control agro
cast gate
}
/goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
Next we want to find out how to determine our characters hit points, lets search the manual for 'hit point', and we find:
character (inherits spawn)
Members
...
int PctHPs Percent hit points
We aren't quite done with this yet, as we need to find a TLO (Top Level Object) that accesses type character, to allow us to use the PctHPs object. Browsing the TLO reference in the manual and we come up with:
character Me
access to types: character, spawn
character object which allows you to get properties of you as a character
${Me} is a character object, so has access to all of the properties of the character reference Type. The character Type also has access to the properties of the spawn Type.
Ok, now lets put that together with the code:
Code: Select all
| Savemyass.mac, usage /macro savemyass.mac
| I use this to heal in groups with my cleric
Sub Main
:loop
/if (${Me.PctHPs}<=99) {
target myself
cast aa DA
cast aa CR
/g fuck off asshats and learn to control agro
cast gate
}
/goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
Using the above steps we target ourselves by find the /target command, and find out how to figure out who to target (in this case, we'll just use our name).
Code: Select all
| Savemyass.mac, usage /macro savemyass.mac
| I use this to heal in groups with my cleric
Sub Main
:loop
/if (${Me.PctHPs}<=99) {
/target ${Me.Name}
cast aa DA
cast aa CR
/g fuck off asshats and learn to control agro
cast gate
}
/goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
/alt activate is an eq command, but we need the aa id number to use it, so lets get that out, the manual spits out:
altability
Members
...
int ID ID number
and the TLO to access that is aptly named
AltAbility
altability AltAbility[n]
Alt ability by number
altability AltAbility[name]
Alt ability by name
access to types: altability
putting things together leads to
Code: Select all
| Savemyass.mac, usage /macro savemyass.mac
| I use this to heal in groups with my cleric
Sub Main
:loop
/if (${Me.PctHPs}<=99) {
/target ${Me.Name}
/alt activate ${AltAbility[Divine Arbitration].ID}
/delay 1
/alt activate ${AltAbility[Celestial Regeneration].ID}
/delay 1
/g fuck off asshats and learn to control agro
cast gate
}
/goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
Hmm, looks like we are almost there, so back to the manual and find a command to cast a spell.
/cast ["spellname"|"${varname}"]
- [item "itemname"]
Will cast the specified spell, or perform a right click of an item that has a right click spell
This looks to be a good choice and so:
Code: Select all
| Savemyass.mac, usage /macro savemyass.mac
| I use this to heal in groups with my cleric
Sub Main
:loop
/if (${Me.PctHPs}<=99) {
/target ${Me.Name}
/alt activate ${AltAbility[Divine Arbitration].ID}
/delay 1
/alt activate ${AltAbility[Celestial Regeneration].ID}
/delay 1
/g fuck off asshats and learn to control agro
/cast "Gate"
}
/goto :loop
| Note, the next line actually does nothing, as the loop will never reach it, but I like to end all my subs at the end as a definite border so to speak
/return
Now, this code should be functional at this point, but just fire up eq and playtest it. Things noticed while playtesting it might be: this macro needs to check if I'm actually in a group, my AA's are ready, or if my spell fizzles and I need to recast, or if I forgot to memorize gate, and so forth. Once you figure out what else you need, its back to the manual to flesh out the macro a bit more to make it more robust.