Kirk’s writing a macro series 3 of 8

Writing macros, a series of lessons (3 of…)

Today, boys and girls, horde and alliance, all and some, we are going to start actually putting all this stuff together. We’re going to make a macro. Or maybe more than one. And then we’re going to USE IT. Trust me, there are a couple of steps in there that people just seem to miss. Fortunately, I’m just the longwinded, pedantic fool to try and catch every little part so you know how to wash your hands. (If you don’t catch that reference you didn’t read the previous entry. Shame on you, and since I’ll make statements assuming you did, go do so now.)

The very first thing you must do is get on your character – and make sure your character is somewhere you can do this for a while without worry of interruption. Later you can do this on the fly, but for now… ok.

All the guides will tell you to open a chat window and type /m or /macro. I’m going to do that too. And just like them, I’ll tell you this opens the Create Macros window. Unlike them, I realize we can’t stop there. Well, we could, but see above about longwinded and pedantic…

I’ve resisted putting up pictures in my blog, but this time I think it’s absolutely necessary. So….


Now when you opened you window, this is not what you see. You only see the big box on the left – the one with the title “Create Macros”. And all the boxes inside that are empty. Oh, and the “New” is the same color as “Exit”, meaning you can click on it. Guess what I want you to do? Yep, click on the new button. Now you get a window that looks a LOT like the other box.

The very first thing you have to do when creating a macro is creating a frame for it. That’s my term. What you have to do is select the title and icon that identifies it. Now here’s a peculiar thing I discovered. You can use the same icon multiple times. And you can use the same name several times. But – with one exception – you cannot use the same name-icon combination.

One exception? heh – close (click Cancel) the new box. Take a look at the main box and notice something peculiar. There are two tabs. One for general, and one for your character. You can have a separate list of macros that are specific to your character. And you can have the same name-icon combination in some or all of your characters, and it won’t confuse your game. Isn’t that NIFTY?

So, let’s do this right. Click on the character tab. Now open a New box. I want you to type “TEST” as the name, and for now I want you to choose any icon EXCEPT the question mark. We’ll come back to the question mark later. But for now, go through the HUGE list of icons, find one you can live with (or really like), and click OKAY.

And the box goes away, and it’s time to do something real. Well, no, not quite. I want you to notice that another box has turned red indicating you can click it. “Change Name/Icon” is ready. If you LIKE this macro we’re about to make but don’t want to live with it being TEST forever, here’s where you’ll do that. I might come back to it, and I want to try and cover most of the details, but it’s minor so I’m likely to forget. Mention made, let’s go on.

You have a blank box in the create macros popup menu in which your cursor is flashing. Let’s make a simple – I mean REALLY simple – macro. Type:

/cast fade

/sigh, you say. You’ve already got that, if you’re a priest. And if you’re not, you’re wondering “what?”. To the former, yep, but it’s a starting place – we are going to expand this. To the latter, ahem, please examine the title of this blog (grin). Though to not leave you out of why this choice seems so minor… fade can only be cast on the caster. And every priest I know has it on their toolbar in an easy to find position.

Anyway, you’ve typed it. But we want to USE it. OK, here we go. Drag this to an empty spot on your toolbar. Oh, wait – you don’t have an empty space? OK, you have two options. You can replace (temporarily, or fulltime) something presently on your toolbar. Or you can add toolbars (to a point). For the latter, if you’re not using the four standard toolbars Blizzard gives you, press escape, click on interface, click on advanced, and place a checkmark on one of the unchecked toolbars. OKAY, escape again to clear the interface options menu, and we’re ready – drag the icon to its position.

And now we test our macro. Click it – and TA-DAA, you fade. WHEEE! IT WORKS, CONGRATULATIONS. ahem. Seriously, I was exactly that excited the first time I actually got to this point – a Working Macro, and big deal if it wasn’t fancy. But as already noted, we’ve got this already, so big deal, right? heh…

We have a command, and we have a parameter option. Let’s add a conditional. I am tired – TIRED I tell you – of hitting fade when I’m not in combat. Sheesh, what a waste. So let’s put in a condition. I want to fade ONLY when in combat. If you go back to lesson two you’ll see the list of conditionals. And lo and behold, there’s the obvious one. Combat. OK, let’s write our new macro.

/cast [combat] fade

“Waitaminute… whyfor the brackets,” you ask? I’m keeping you on your toes. See, we’re not done with syntax, but I’m going to add to your knowledge in driblets – remember, brain expansion at a rate slow enough it doesn’t explode. In WoW’s macro language, ALL conditionals are in [square brackets]. Sigh – all but one. There’s an oddity in /castsequence we’ll get into when I get to that command. That command causes so much frustration among casters newly exploring macros that I’m saving it for a later post. However, there is a second syntax element that applies even for it. That’s the fact that the command is always first, the conditionals are always second, and parameters are always last.

Let’s add to our awareness of how a macro works before we continue – not syntax (though we will be adding to what you know already), but still necessary for washing hands… In a multiline macro, every line is independent. That is, what one line does has zero DIRECT effect on any other line (with the exception of two commands we will be touching upon today). When you start a new line, you reset the syntax pattern – you need a new command, if you want it to have conditionals you have to add them, if you want parameters you have to add them.

While I’m on reset… there is a ’soft reset’. If, while typing your macro, you add a semicolon (;), you are telling the computer: “Assume I’ve started a new line but I’m using the same command.” It is a means of saving characters – remember, you only get 255. We’ll use that somewhere in this series of lessons.

So, why have I been talking of multilines? Behold, let us expand the macro just a touch…

/cast [nocombat] resurrection
/cast fade

Isn’t it nifty? I’ve got two spells that are almost ALWAYS on my toolbar, but when one can be used the other can’t (and vice versa). I’ve just saved on my real estate by putting them both in one toolbar slot. Oh, wait, we did some extra changes, didn’t we? (grin). Pedantic time.

First, you see I removed [combat] from fade and put [nocombat] in front of resurrection. Well… the macro language will normally attempt to execute EVERY LINE of a macro. That said, blizzard doesn’t want anybody making a machine-gun macro – that is, a burst of spells in an instant. Therefor, if a line triggers a cooldown, then any lines which have to wait for that cooldown to clear won’t work. The macro will attempt, get a “on cooldown” message from the server, and go to the next line. And this is true EVEN IF the command apparently doesn’t trigger the cooldown because it can’t work. Case in point – if you’re in combat and you cast our macro but without the [nocombat], you’d get an error message of telling you you’re in combat and nothing would happen. See, what happens is that your computer can only do one thing at a time. So the order is: get told to cast spell; start cooldown; check validity (note I’m compressing – range, target, inside, in combat, etc, each done one at a time); start cast or give appropriate ‘can’t cast’ message. And THEN the computer starts the next line of the macro. Oops, the cooldown clock is running, so can’t cast the next spell.

But when I stuck that conditional in front of resurrection, the FIRST thing that happens is the macro says, “can I do this?” And on discovering it can’t, it goes on to the next line. Remember the previous lesson — a conditional is “if this is true, do it. Otherwise, next.” Hold that thought as we will be coming back to it soon.

Second – what’s with the “no”? heh – every conditional can be preceded with the word “no”. Here, in this macro, that’s probably intuitively obvious, but later it might get confusing. All I’ve said is, “If I’m not in combat, cast resurrection.” If I’m in combat, it’ll realize it can’t do that, check to see if there are any other conditionals that will let it do this command, and on discovering there aren’t will go on to the next line.

Third – so, why did I move the conditional, anyway? I mean, couldn’t I have just put the resurrection line without conditional AFTER the fade line that had a conditional? Yes, I could have, and it would have worked. But I’m about to introduce something else that I find extremely helpful in macros, and while I’ve mentioned it – well, them – before it’s time to bring them into play.

Let us begin by returning to the previous lesson, the list of commands, and my remark, “there are a couple of oddities in there”. And while we’re at it, I mentioned earlier that there were two commands which WERE affected by other lines in the macro. Finally, we’re going to look at that question mark icon. Yep, three teasers, one sublesson.

If your first line is #show or #showtooltip AND you chose the question mark icon, the icon that will display will be the first usable parameter for which an icon is keyed. That’s a bit heavy going, so let’s put it in action. First, let’s update our macro:

/cast [nocombat] resurrection
/cast fade

Second, let’s change the icon. Click the button (change name/icon), click on the question mark icon, click ok.

Now look at your macro’s button on the toolbar. What do you see? Yep, the icon for resurrection. Ready for the fun part? When you get into combat, that icon will change – automatically – to fade. The #show and #showtooltip don’t affect other lines (despite my misdirection), the other lines affect them. Go ahead, get into a combat and check it out. I’ll wait.

OK, you’re back. So, what’s the difference between #show and #showtooltip? The first just does the icon. The second is both icon and tooltip. That is, when you put your mouse over the icon it tells you what spell, how much mana… you’ve seen the boxes that pop up. Those are tooltips.

Tadaa, you have a useful first macro. Useful in that it saves real estate (one of the ways of helping you be more efficient and effective) while being fairly intuitive in use. If you want to rename it, go ahead – it’s pretty much the same as the way you changed from your original icon to the question mark. We’re only going to do one more thing today – one more step to making this fully effective. And that’s showing you how to bind this to a key.

The first thing that needs to happen is to check where you placed the icon. If it’s on either of the left bottom toolbars, move it to another toolbar. For this lesson I’m going to ASSUME that you are using the leftmost slot of the first (bottom if you’re showing multiples) toolbar.

If your create macro window is still open, close it.

Now press escape, and click on the “Key Bindings” button. Welcome to a long list of things – you can see the scrollbar to the right. Everything that can be done by a single keypress on the keyboard is set up here. Notice some things – it’s both fun and important.

First, notice at the very top is a checkbox – “character specific”. I highly recommend that when you’re tying macros to key bindings, you check this box.

Second, notice that you can set TWO keys for every thing. You don’t have to, and indeed you may not want to. One of the nice things about this, however, is that you can check to see if something HAS two choices. And even better… there may be times you can use your right hand, and times you’re using your left. You may have reason to want something close-to-hand REGARDLESS.

OK, I want you to move down the list till you see the label for the bottom left action bar – that’s where our macro is. You’re looking for button one. Now before we assign a button, let me digress. You have a LOT of assigned keys, and this is brand new. So I’m going to give you a key for now that has nothing assigned to it. The reason is that your program WILL NOT CHECK TO SEE IF THIS IS OK. It changes it, regardless. And if in the process it unbinds something else, you get a little red message at the bottom telling you “such and so is now unbound.” The key we’re going to use is the backslash. On US keyboards, that’s the slash that’s under the backspace key, not the one that shares a spot with the question mark. This one: \ .

Left click the red button next to the bottom right action bar button one line, and it should now say, “Press key to bind command -> bottom right action bar button one”. (note, I’m using an addon which overwrites this particular bar, so I may be slightly wrong on label. Please forgive me.) Now we’re going to learn another lesson first – left click the same red button again. Instead of assigning “leftclick” to this button, it turns off the bind. Cheer, a lot – this is how you recover from “oops, wrong button” before you commit. Go ahead and left-click the button again, and this time press the backslash key. Lo and behold two things happen. First, you see the label on the button change to \. Second, you see a yellow message telling you that you were successful. Press escape twice, and do the MOST IMPORTANT STEP: confirm.

Press the backslash key. You should see your character begin the resurrection animation, and unless you have a target already you should also see the cursor change to the targeting image (the open hand gets an aura surrounding it that’ll turn blue if it’s over a legitimate target for the spell.) If you don’t see this, you bound the wrong spot. My fault, probably – look for other ‘right action bars’ to put that backslash, and try again until it works.

Two closing remarks. First, a “gift” – a keybind I have found tremendously useful over play. Find the category “camera”, and find the line for “flip camera”. If you’ve a three-button mouse, bind the middle button to it. From now on, all you have to do to look behind you is tap your middle mouse button, then tap again to look in front. While obviously it’s tremendously useful in PVP, it’s far from useless in PVE as well. Especially if you’re kiting or fleeing or escorting.

Finally, a ‘homework assignment’. Not macros directly, but still related. Open the key bindings, and take a look at the whole list. Get some idea of what is there already bound, already ready to be bound, and while you’re at it what keys are already used. Notice in particular where ALT- and SHIFT- and CTRL- are used — we’ll be doing things with these in the next lesson, and it’s particularly frustrating to have the computer doing (or trying to do) two things at once off one keypress.

Go have fun.

 by Kirk on December 6, 2007.


One Response

  1. […] do guia Parte 1 do guia. Parte 2 do guia. Parte 3 do guia. Parte 4 do guia. Parte 5 do guia. Parte 6 do guia. Parte 7 do guia. Parte 8 do […]

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: