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
  • 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.

About these ads

~ by Kirk on December 5, 2007.

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

  1. 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!

  2. It’s in the “Me, in more depth” page. But I’ll make another explicit page – you’re right, it’s rather obscure.

    Change coming.

    And thank you. Heck no, I’m not going to delete it, you praise and I’m supposed to NOT let it boost my ego? Ha.

  3. Okay, you asked for it. ;) Since this is semi on-topic, I’ll post here instead of whining on my blog for help.

    I’m trying to create a macro to combine Fade and PW:S under one button. But…it ain’t workin’! Here’s what I have:

    #showtooltip Fade
    /stopcasting (in case I’m in the middle of a GH or similar)
    /castsequence reset=30 Fade, [target=player] Power Word: Shield
    /targetlasttarget (I still want to cast that GH, POM, or whatever
    /p *** WARNING *** PRIEST HAS AGGRO. *** WARNING ***

    Works like a charm except…it never, every casts Fade! How’s come not?? (Putting consecutive /cast commands isn’t doing the trick either.)

  4. That’s it, ask for lesson 3 (or maybe 4) before we get there.

    Move the [target=player] so it’s in front of the Fade command:

    #showtooltip Fade
    /stopcasting
    /castsequence reset=30 [target=player] Fade, Power Word: Shield
    /targetlasttarget
    /p *** WARNING *** PRIEST HAS AGGRO. *** WARNING ***

  5. Thanks, and thanks for the email too.

    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!

  6. 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.

    great series of posts! thanks

  7. 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: