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

Believe it or not we’re pretty much done with underlying concepts – syntax, that sort of thing. So today’s rather long post will be looking at several of the specific options – a few commands, many of the conditionals – and I’ll try to pick up what few syntax elements remain along the way.

I’m going to kick off with another very popular one – focus. Before we go to detail, let’s conceptualize it. Focus is a specialized target – whether command or conditional or parameter, you use focus anywhere (and the same way) you use target. Except, that is… while you CAN use “focus=” in the conditionals, I can think of very few times you’d WANT to do so. Remember that it only works for that line, and doesn’t change the outside world.

The reason focus is so useful is that it allows you to say, basically, “This target is special, and if I go work on another target I always want to be able to return to this target in an instant without fumbling around.” As a specific example, I may want a macro that says: while I’m busy elsewhere, every so often I want to toss a Shackle Undead at this particular mob. That line, by the way, goes:

/cast [target=focus] Shackle Undead

But let’s make a usable version. Because I don’t want to tab-target, and click on a “/focus” macro that’s a separate line. So:

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

Now there are a lot of variant macros out there which clearfocus first. The command – in a macro with focus – is redundant. You can only have one focus. If you focus on a new target, the old focus is cleared.

I also want to remind that “target=target”, though labeled a conditional is really a limiter. It is not testing to see if the target is a target (or in numerous shackle macros out there if the target is the focus). It is saying, “And the target of the command is my current target”. So that first line says: make my current target the focus if there is no current focus, or make the target the focus is there is a focus but it’s dead, or REGARDLESS of current focus if I’m pressing the alt make my current target the focus. And the second line says, “regardless of my target, cast shackle undead on my focus.”

Now, I could modify this with one more line, and since it teaches as well, try this one:

/focus [noexists,target=target][exists,dead,target=target][modifier:alt,target=target]
/stopmacro [modifier:alt]
/cast [target=focus] Shackle Undead

The command added was stopmacro. This example shows its use. What it says is: If this situation is true, quit running the macro. In this specific macro, if I pressed the alt key when I clicked the macro, it makes my current target the focus and then stops without casting shackle undead. Which means I can use it to target my tank (for example) and make it my focus for later focus based healing spells. Warning – if I fail to put a conditional in place, the entire remainder of the macro stops – period. Just… something about which to beware.

While I’m on stops, let’s take a swift glance at /stopattack. Now we’ve already seen /stopcasting and /stopmacro so this should be really, really obvious. And for priests, pretty close to useless. Who is it useful for? All those people with things that say, “effect ends if target is attacked.” Sleeps, traps, sheeps… Set up your trap macro (for example) and make sure the line in front says /stopattack (and if you’re a wand user still autocasting, /stopcasting on another line) and poof – you don’t break your own attack.

rats. Despite saying we’ve already covered stopcasting, I want to throw in one of my little gems. My wand is set up as follows:

/cast [modifier:alt,target=target][target=target] shoot
/stopcasting [modifier:alt]

Pretty, isn’t it? Huh, you’re not following? Regardless of alt or no alt, I cast shoot. If I use my alt key, however, it casts once.

Oops, almost forgot, we added that weird conditional “modifier”. This needs some special consideration. Modifier is an “obvious” conditional, and introduces one more bit of syntax – the colon (:). That is, it’s a conditional that can have more than one variation. In this case you could have three modifiers – alt, shift, or ctrl. Holding those keys when you pressed the macro meant something different than using the macro alone – or it could, if you set up to use it.

Can you set it up to use, say, alt and shift combined as “must be both”? No. If you do that, one of the modifiers (the second) dominates. Which means if you have set up (for example) modifier:shift, then shift, alt-shift, and ctrl-shift all meet the “true” value of the conditional. That said, blizzard WAS nice to use in the not so distant past. See, up till 2.0 we had just shift, alt, and ctrl. And we can use those if we want – they still work. But we are ALSO allowed to differentiate between left and right. So what we really have is: lshift; rshift; lctrl; rctrl; lalt; ralt. Failure to specify means either. Which means if I’m REALLY feeling funky, I can set up seven different “modifiers” – the six listed plus “nomodifier” (or not putting modifier on – same difference). No, I am not going to give an example – I’ve never needed that many variables. But you might. For example, say you’re a hunter. You want to set up one button for your tracking – humanoids, undead, beasts, giants, elementals, hidden… ahem. I leave the exercise to the pleasure of the reader. No, no I won’t – I just won’t put in everything, just enough for an example.

/cast [modifier:lalt] track humanoids; [modifier:ralt] track giants; \
[modifier:rshift] track undead; track beasts

Remember to lead with at least #show if not #showtooltip unless your memory is fantastic – one button, seven options, you only have one “track” you have to leave off. Note that you can put seven different spells there if you want. Fair warning — you will be bumping against the 255 character limit.

OK, let’s go play with something else. Let’s start with the macro:

/cancelform [stance:1]
/cast renew [modifier:alt,target=player]

It’s the first line that’s going to drive this section. First – cancelform. It used to be that some – no, MOST – forms would trigger a GCD when you left them. Shadowform, Dire Bear form, etc. Now, however, it doesn’t. Which means you can set up a macro that lets you drop form and do stuff RIGHT NOW – and that can include casting a spell. The druids love this – drop form, use potions and healthstones (which they can’t do in form), and cast to get back in form, all with one press of the button.

Now in this particular example [stance:1] is unnecessary, but it lets us learn the modifier. Every class has some optional stances. And you can test for stance before trying to do something. Now, the full list is:

Stance Warrior Druid Priest Rogue Shaman
1 Battle Stance Bear Form Shadowform Stealth Ghost Wolf
3 Berserker Stance Cat Form
5 Moonkin Form,
Tree of Life Form

(Yes, I copied that – in this case from wowwiki.com.) Now for those of you reading with more than one possible stance, a caveat needs known. If you cannot cast a form, then all the forms higher slip down the list. Say, for example, that you are a druid who has not learned tree or moonkin form. Flight form, then, is stance:5, not stance:6.

/use brings up some more tables. First, there are 23 inventory slots. Of these slots, SOME have things in them. Except when they are, they’re labeled a bit differently. OK, let’s get specific. The 23 slots that you can use (and equip – hold on there a minute) are:
0 = ammo
1 = head
2 = neck
3 = shoulder
4 = shirt
5 = chest
6 = belt
7 = legs
8 = feet
9 = wrist
10 = gloves
11 = finger 1
12 = finger 2
13 = trinket 1
14 = trinket 2
15 = back
16 = main hand
17 = off hand
18 = ranged
19 = tabard
20 = first bag (the rightmost one)
21 = second bag
22 = third bag
23 = fourth bag (the leftmost one)

As you can see, 20-23 are bags. If we want to use something IN them, however, we have a slightly different numbering system. In THIS case, the bags are numbered 0-4 – the backpack is 0, and the numbers march to the left. Within the bags, the numbering starts in the top left position, with the first spot being 1.

So, if I want to use my first (top) trinket, the line is:

/use 13

But if I want to make a “go home” macro, AND if I always put my hearthstone in the top left spot of my leftmost bag, the line is:

/use 4 1

Note – they’re separated with spaces.

This leads me to the conditional “equipped”. Do I have…? This has a LOT of conditionals possible, so bear with me.

First, I can see if I have something in that slot. As in, /use [equipped:1] Helmet of Righteousness. (I made that up, folks, don’t go looking). If there’s something else in my head slot, or if the Helmet of Righteousness is in my bag, I’m not going to use it. I can also test for item type and subtype. Green gem, arrows or bullets, the list goes on. In fact, the most comprehensive list I know of is on Wowwiki.com – here. This, by the way, is the basis of equipment swaps. Except the more extensive ones are scripts or addons. We’ll get to scripts, we aren’t doing addons – well, sort of. But the point of this is that IF you have gear on you or in your bags that can be used, or which if there allows you to do certain things (shield present for shield bash, tanks)… here is your test.

Four more things, folks, and we’re done for today. Bear with me, because three are short and one is … actually, since I’m going to save the nasty turns it can take for the next lesson, it’s not so bad either.

Random. There are two random commands – castrandom and userandom. Now here’s the trick – you have to list a group from which the random choice is made. No list (comma separated), no use or cast. Why do this? If nothing else, for fun. Random fireworks, for example.

petautocasttoggle. OK, this isn’t for the priests, it’s for the hunters and warlocks (mostly). No more long string to turn it on, then if it’s on turn it off. Just toggle it -growl, charge, and so forth.

Channeling. As you know, if you’re channeling, anything you do interrupts the channel – which in turn means the spell quits running. If you use channeling heavily – say, with mindflay – and keep interrupting the last tick that you really mean to grab, add [nochanneling] to the conditionals for the spell, and it won’t interrupt the channel.

OK, three easy, almost intuitive commands and conditionals that I thought we should take time to review. But now… Now I want to introduce you to one more fun thing.

[button:1]. Actually, the 1 can be 2, 3, 4, 5, and virtual. I’m going to leave virtual for another lesson – the next one, actually – as it’s headed into scripting territory. Well, other than noting it’s related to the command /click. But the button… remember when I mentioned the lshift, rshift, etc? I can ALSO choose to click on the macro icon, and decide what’s happening based upon which button is I used – leftclick (1), rightclick (2), etc. If you use the mouse to do things instead of the keyboard, this is your modifier.

I have not given you the entire list. Instead, I’ve just popped through the majority of the rest of those that are ‘different’. It’s been a rather easy lesson, actually. But that’s because I want to do some heavy tricks in the next lesson, and needed these out of the way.

The next lesson is, simply, how to get around the 255 character limit. We’ll meet shortcuts of various types. We’ll also meet a couple of brain expanders, and introduce (ONLY INTRODUCE) scripting. Oh – and I’m going to show you how to find the details of these various macros – the new ones, how they work, what conditionals work and how… At least, I’m going to TRY to fit all that into one lesson. We may have to spread to another, but I don’t think so.

But for today – go play with macros a bit, and have some fun.

About these ads

~ by Kirk on December 10, 2007.

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

  1. Nice series. Two things though:
    1) A better example would be a Druid that has *not* done his Aquatic Form quest: Cat form now becomes 2 and not 3, etc.
    2) I’ve seen you use capitalization and all lower case for spell names. *MOST* of the time, that works, but some times the system insists on being case-sensitive! Back when learning how to macros, I’d almost pull some hair out only to find out the hard way about case sensitiveness! I’ve only diagonally read your series, so maybe you’ve told that, but the best way to be sure is to use lowercase for commands and SHIFT-CLICK the spell name from the spell book to ensure proper case and no spelling errors…

  2. [...] I like Priestly Endeavors’ way of setting focus in his post Writing macros, a series of lessons (5 of…). [...]

  3. I just wanted to thank you for the awesome series! This is one of the most well thought out explinations of macros that I’ve seen. I’ve always been intrested in macros, but always thought they were too hard to understand. You’ve explained it in such a way that I understand them A LOT better! I stumbled on your blog recently after my Fiancee rolled a Priest that will eventually be a melt your face off shadow priest. This series will help me with her priest, my mage that I’m leveling with her, and my lvl 70 hunter. Thank you so much!

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: