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:

/oom

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:

{command}{options}

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:

#show

#showtooltip

/assist

/cancelaura

/cancelform

/cast

/castrandom

/castsequence

/changeactionbar

/clearfocus

/cleartarget

/click

/dismount

/equip

/equipslot

/focus

/petagressive

/petattack

/petautocastoff

/petautocaston

/petdefensive

/petfollow

/petpassive

/petstay

/startattack

/stopattack

/stopcasting

/stopmacro

/swapactionbar

/target

/targetenemy

/targetfriend

/targetlasttarget

/targetparty

/targetraid

/use

/userandom

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

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.

Like this:

LikeLoading...

Related

7 Responses to “Writing macros, a series of lessons (2 of…)”

Kirk: I hate doing this but I’ve scoured your blog for any other way to contact you (e-mail address, contact form, etc.) and haven’t been able to find anything. So I’m leaving you a comment to ask if you wouldn’t mind updating the link of my blog from its Blogspot.com address to my new address http://www.resto4life.com.

I’m really enjoying these articles, by the way. I look forward to seeing what else you can teach me. And feel free to delete this comment if you want. And once again, sorry for contacting you this way!

For you other readers: Kirk also suggested getting rid of /targetlasttarget (pretty sure I’d have figured this part out; I’ll leave it to him to explain why in lesson 3 or 4).

By the way, the reason I want this macro is because I keep forgetting to Shift-Click my PW:S command to shield myself–instead, I shield (usually) my tank–the LAST person I want mitigating aggro when I’m George!

wonderfull OHdung button:-) Is there an icon that looks like a pile of dung? I can’t wait for lesson 3or4;-)
1. what is the reason for leaving out the /targetlasttarget?
2.a To cast these 2 spells, would I have to click on the ohdung button twice?
2.b if yes to 2a, if I click on the ohdung once, then again after 31seconds, will I fade again?

3. lets assume that I want to add fear as spell3 BUT…I want to keep the reset=30 for the PW:S, but change to reset=10 for fade i.e. I want 30seconds between fade and PW:S, but only 10s between PW:S and fear.

Well now that I have a basic understanding and know where the (secured commands) are and what they are..I’m going to /get a beer/get a penciel/get paper/do homework.. I forgot the command for popping the top of the beer, but thats not a command I really need to hear.

About…

I've experience with many priests of many races and specs on several servers. The more I play, the more I realize how much I do not yet know. This is a share of some of what I have learned.
My main these days is Zingiber on the Undermine server.