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

macroshot

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:

#showtooltip
/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.

15 Responses to “Writing macros, a series of lessons (3 of…)”

  1. I just had a brainstorm while reading this. Do you have ANY idea how many times I’ve tried to Fade while solo? No? Well, try one or more times daily (yes, even this week!).

    We (priests) all know Fade is useless when soloing–it’s a Jedi mind trick gone bad. (If I were a dev, I’d make it increase threat if you’re wasting time trying to fade when you’re alone.)

    So how about a conditional, that if you’re in a party, you fade; if not, you self-cast Renew? (Going to see if I can manage that on my own; I’ll get back to you.)

    And yes, I know that may be more than you wanted for Chapter 3; save it for 4 or 5. ;)

  2. Ok I had a problem today and would like to know if anyone has a workaround or another method of doing a focus shackle macro. Todays rolling restart broke mine and as of yet I have not found a solution. This raises issues due to my lack of dps and mana battery potential since I would have to either tab target or simply reaquire target by clicking around on the screen to reshackle my target, neither of which are very effective imho.

  3. /cast [target=focus] Shackle Undead

    I think that will do it…
    Very useful for Moroes, I use it all the time.

  4. That still requires me to tab target or try to reaquire it again.

  5. What WAS your macro?

  6. /clearfocus [modifier:shift]
    /clearfocus [target=focus,dead]
    /clearfocus [target=focus,noexists]
    /focus [target=focus,noexists]
    /cast [target=focus] Shackle Undead

    Click once, makes your target your focus and shackles, click again (even while targeting a different target) will re-shackle if the mob is still alive or exists (your current target will stay selected). hold shift if you wish to focus and shackle a new target while the old focuseed shackle target is still alive/exists (ie. switch shackle targets).

    hope that helps, it serves me well.

  7. Thank you for these posts. I had briefly looked for a way to do “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.” and had assumed it wasn’t possible. Keep up the great writing!

  8. This is my Macro and as of yesterday it is broke.

    /clearfocus [modifier:shift]
    /clearfocus [target=focus,dead]
    /clearfocus [target=focus,noexists]
    /focus [target=focus,noexists]
    /cast [target=focus] Shackle Undead

    Click once, makes your target your focus and shackles, click again (even while targeting a different target) will re-shackle if the mob is still alive or exists (your current target will stay selected). hold shift if you wish to focus and shackle a new target while the old focuseed shackle target is still alive/exists (ie. switch shackle targets).

    hope that helps, it serves me well.

  9. Mojo, that should be working. But based on your description… can you give a better description? Maybe a fuller sequence of events? As in, can you not do a focus at all with this? or does the focus misapply? Or go away? And in all of those, what mob, and under what circumstances? I don’t know enough to answer your question.

  10. Ok for more detail, Went into Kara last night with that macro as I have always used it.One of my jobs is to shackle some of the mobs in there. Normally I make sure it is cleared then I target the mob I want to keep shackled till it is ready to be picked up. While that mob is shackled I can dps to my hearts content and keep hitting my macro button every so often to keep my shackled mob shackled without having to retarget that shackled mob.

    Last night I did my normal routine of acquiring my target shackled it then moved on to the target we were going to kill. Much to my horror and dismay when I hit my macro instead of keeping my orginal target shackled it automatically shifted to the mob I was attacking. Later on I decided to do my test of the macro by going over to hellfire penn. Shackled a mob and started to attack a couple of others at the same time. After a couple of spell cast I hit my macro and instead of the orginally shackled mob being reshackled it shackled the mob I was trying to kill.

    Hope all this makes sense but I am trying to describe this in a med induced state due to a discogram today.

  11. Mojophone,

    Took a better look, and MAYBE I have a solution. Try this:

    /clearfocus [modifier:shift]
    /clearfocus [exists,dead]
    /focus [target=focus,noexists]
    /cast [target=focus] Shackle Undead

    Let me know, ok?

  12. Thanks for the help and working shackle focus macro Kirk

  13. Thanks for taking the time to do this series. I haven’t been particularly looking for a macro tutorial, but this is one of the clearest explanations I’ve seen in a while.

  14. [...] did not create this. I am, despite all that Kirk could do with his series of posts on how to write macros, still macro-creating [...]

  15. WOW (no pun intended) I just had two of my brain cells collide and they actually made a spark. I now know what a command is, what a conditons is, and what (well I call it) an action, even thougth I didn’t go through your test ( I ain’t usen a Priest *yet*) the idea or how to work with my idea actually made sence. The keybinding I’ve never used, but I belieave I may just start now. Awe good lord, this here redneck is about to get off “hooked on phonics” and become [sophisticated]..

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: