Saturday, 7 June 2008

Looking For Macro

Every time I log on, I forget to do something really important: put myself in LFG.  It's just a pain in the bit that I sit on to have to click through the drop boxes over and over and over again.  So I did what all good programmers do; I jury-rigged a macro to do the work for me!  [1]

/script local a,b;a=SetLFGType;b=SetLookingForGroup a(1,2);b(1,2,7) a(2,2);b(2,2,9) a(3,2);b(3,2,11)
/script SetLFGComment "BM Hunter; I kill stuff dead."

Yes, it looks horrible, but it's not too obtuse.  Well, OK, it is, but at least there's a method to the madness!

/script local a,b;a=SetLFGType;b=SetLookingForGroup

Programmers are lazy, and since "SetLFGType" and "SetLookingForGroup" are kinda long to type, I just set up a shorter name for them: "a" and "b" respectively.

... a(1,2);b(1,2,7) a(2,2);b(2,2,9) a(3,2);b(3,2,11)

Here's how the LFG system works: the system gives each player three "slots."  For each of these slots, you specify the type of thing you're looking for (dungeon group, raid group, battleground, etc.) and the specific location (Mana Tombs, Karazhan, Warsong Gulch, etc.)

"a(1,2)" is saying "set the first slot to look for a Dungeon group," while "b(1,2,7)" says "set the first slot to look for a Dungeon group for Steamvaults."  Yes, the "1,2" in the first call means the same as the "1,2" in the second.  Don't ask me why it's repeated; as far as I can tell, it just has to be.

So where did those numbers come from?  Here's the trick: open up the LFG window, and set it to look for a group.  Pull down the first drop down.  It should have a list like "None, Dungeon, Raid, ...".  The first entry in this list is "1", the second is "2" and so on.  The same applies to the second drop down.

Say you want to look for a group to run Zul'Aman; pull down the category list, and count down to "Raid."  Let's say it's the third one down.  Now pull down the second list and look for "Zul'Aman."  Suppose that it's ninth in the list.  Finally, we'll use the first LFG slot for this.  The code would be:


That's not too bad, right?  In the example of my macro, I'm looking for groups for Steamvault, Shattered Halls and The Arcatraz.

/script SetLFGComment "BM Hunter; I kill stuff dead."

This one's pretty simple: it sets the LFG comment.  I like to make mine at least moderately amusing.

So that's it; when I log in now, I can just hit that macro, and it sets me up in LFG.  And the next time some half-brained level 12 idiot invites me to a group without saying a word so I can run him through RFC, it only takes a second to fix it back up!

[1]  Dance, computer. Dance!

No comments: