Writing macros, a series of lessons (2 of…)
So I ended the last lesson by having you discover the frustration of making your own list of commands. It is to laugh, how it doesn’t cycle in alphabetical order, but instead bounces back and forth intolerably, isn’t it? Much like trying to tab-target through a multi-mob, actually. Fortunately, I misled you when I said there is no definitive list. You know this if you read Cogwheel’s guide already. See, he (and a bunch of volunteers) have a fairly comprehensive list (though it is incomplete, and we’ll get to that in a bit) of commands.
Now, before we dig deep, you need to know a few minor things so you can put it all together – basically, we’re doing a bit of terminology. To begin, a minimum macro is a command. For example:
You may not have used this one, so I’ll tell you it send both voice and chat-window message. Oh, and a visual gesture, but it’s too similar to a bunch of other emotes to be of any use. And heck, you could tie that to a key (we’ll get there in a later lesson) to help build a clue-by-four for the fast-moving tank. (As another aside – it announces you’re low on mana, not out of mana. Truth in advertising…) That said, there is a lot more to a macro. There’s a structure to a macro. That structure is:
Now, I need to digress a moment to explain computers and programming. Yes, programming – a macro is a program. But anyway… when you write a program for a computer, it helps to keep in mind a simple analogy. Your computer is, in many ways, like a precocious three year old toddler. You do not tell your child “Go wash your hands,” and expect it done right – especially not right away. Instead, “Go to the bathroom and turn on the hot AND cold water. Get your hands wet, front and back up and over the wrists. Put some soap on your hands and rub them together, then rub those soapy hands over the wet parts of your hands so they’re all soapy. Then put your hands back under the water to rinse off all the soap. Turn off both the hot and the cold water. Pick up the towel and dry your hands. If you splashed water on the counter, use the towel to dry that, too. Put the towel BACK on the rack, and come back to me.” Or to be redundant – They will do exactly what you tell them, all of what you tell them, and nothing that you don’t tell them. Now part of telling them what to do is knowing the syntax – the sequence and pattern of words and symbols the computer comprehends. Again an analogy – If someone asks you for a coke, you can use context to know if they want a carbonated sweet drink or a Coca-Cola (or … let’s not go there, ok?) If the computer has ONE definition for coke and it’s Coca-Cola and you’re a Pepsi drinker… sorry, you didn’t get what you expected. Thank you for your patience with that digression.
Now, some commands aren’t allowed any options – the example above being one. Some commands have a VERY limited set. Some are… a lot more flexible. We’ll get there, but let’s start by splitting our syntax just little further. We’re going to divide our options into two subcategories: conditionals and parameters.
We’ll get into conditionals more deeply later – they’re the part that really gets to making brains explode in macros – but I think you need a handle. So, a conditional is a portion that says, basically, “If this is true, do the command.” Go back up to the ‘washing the hands’ example above. “If you splashed water on the counter…” is a conditional. The idea is simple, the details are what make it complex. So, complexity later.
Parameters are, basically, limiters. They constrain and explain the command. /sigh, I see that confused some of you. OK, constrain. Constraints include the target of the command. Explaining the command… if you give the command /say and nothing else, then you get silence. If it’s
/say Well this is another fine mess you’ve gotten us into.
Then you get, well, you get the same as though you’d opened the chat window and typed the “well this…” into it.
Now, for MOST commands, the only target parameter you’re allowed is target – either your current target, or a target you specify at the time of command. No wildcards, no ‘that target I’m keeping in reserve’, none of that. Note that in some cases the target can only be a player. And in some cases the target is an oddity – for example, many chat commands can have channel as a target. Most, however, is not all. And in essentially every case, the exceptions are in the “secure command” list.
Secure commands are the ONLY commands Blizzard allows you to use to:
- cast a spell
- use an item
- change your action bar page
- affect your target in ANY way
And, secure commands are the only ones that allow conditionals in their parameters. Needless to say, most of the macros you make to be more effective in play are going to use secure commands.
Unlike the complete list, we know the whole lists of both secure commands and conditional options. Copying from Cogwheel, the current list of secure commands is:
Yes, there are a couple of oddities in there, but I’m going to save that brain expansion for later – I want to expand your mind at a controlled rate, not so fast it’s an explosion. With that said, here’s the currently complete list of conditionals, again courtesy of Cogwheel:
- help – Can cast helpful spells on the target
- harm – Can cast harmful spells on the target
- exists – Target exists
- dead – Target is dead
- stance:0/1/2/…/n – In a stance
- stealth – Stealthed
- modifier:shift/ctrl/alt – Holding the given key
- button:1/…/5/<virtual click> – Macro activated with the given mouse button
- equipped:<item type> – item type is equipped (item type can be an inventory slot, item type, or item subtype)
- channeling:<spell name> – Channeling the given spell
- actionbar:1/…/6 – Given action bar page is selected
- pet:<pet name or type> – The given pet is out
- combat – In combat
- mounted – Self explanatory
- swimming – Self explanatory
- flying – Mounted or in flight form AND in the air
- flyable – In a zone where flying is allowed
- indoors – Self explanatory
- outdoors – Self explanatory
- party – Target is in your party
- raid – Target is in your raid/party
- group:party/raid – You are in the given type of group
And now I’m going to leave you hanging. You’re welcome – in fact, encouraged – to go seek info on your own. But here’s today’s stop. See, the next step is actually building the macros, and while the first macros will be fairly simple there are some simple but necessary things involved… Basically, I have to explain what I mean when I tell you to wash your hands (grin). It’ll include using the /macro command, and using key bindings. But that’s for the next time. For now,
Go have fun.
=== added later ===
Parameter, option, and conditional are not blizzard’s terms (as far as I know). They’re the handle Cogwheel stuck on them. And sometimes he flips what part is parameter and option, though not very often. I’m sticking to his majority use to attempt to reduce confusion over the long run during this series. You are not required to use these terms when conversing with macro experts, much less when you’re talking to yourself about ‘why doesn’t this work’? Just a point of info.