Tuesday, January 12, 2010

DogTags : The Hidden Add-on

If you have Pitbull 3 (PB4 converted to "lua scripting" or something that frightens me when I look at it) or X-Perl, and possibly other unit frame addons as well, buried into your addon package was a library (technically not an addon) called DogTags. What this does is allow you to tweak your raid frames with custom texts / borders / highlights / etc., if you're willing to brave the way down into the addon to find it. It being one of my sworn, and so-far-unsuccessful, goals to learn everything there is to know about pitbull, I was digging around after looking at Elitist Jerks trying to find a way to code in my unit frames to light up with big flashing lights if said player was a healer. Basically, to do what I do in a BG anyway and covered earlier, and identify my healers for me. It is not, regrettably, perfect, due to the incredible annoyance that is dual spec which has a tendency to confuse DogTags. I haven't figured out what spec DT is getting when you ask it to, but it will frequently return a spec that is not what the player is packing at the moment (presumably the other, inactive, dual spec). I'm pretty sure it's either the Primary spec (which is completely arbitrary for most people), or the spec they logged out in, or the spec from the last armory update, but in any case what should have been a simple thing to code forced me to do a work-around. And so, complete with step by step screenshots, I present, a BG Healer Addon :

STEP ZERO : Open Pitbull. That part was hopefully obvious?

STEP ONE : It should probably default to this, if you haven't previously in this session been dicking around with pitbull to do something else, but click 'Pitbull' at the top.

STEP TWO : There'll be a configuration mode window over to the right, which defaults to disabled. Click the down arrow to get your options.

STEP THREE : Click 'Raid'. You could do party if you were doing something tiny, but no BG uses only five people, and if you're doing this for arena well...why don't you have Gladius anyway, suckas? Be warned that your screen is about to look very, very ugly. Ignore that, though, that's just pitbull's way of showing you every possible buff, debuff, unit frame, etc. You are not expected to be able to make sense of any of that gibberish in the background. Seriously, it will look like a magic eye, and if you are one of those lucky enough to be able to DO magic eyes, you might see Arthas totally making out with Jaina if you look hard enough.

STEP FOUR : On the left hand pane, where you clicked Pitbull before, scroll down to where it says Raid. Expand that, either by clicking on 'Raid', or by clicking the little + sign next to it.

STEP FIVE : In that expanded raid menu, scroll to find 'Texts', and expand that. Your list of options under 'Texts' will NOT show one called 'BGHealer' like mine does in this screenshot, b/c I've already created it. It will after we create it, don't panic mmkay?

STEP SIX : Click 'Other'.

STEP SEVEN : Over in the right pane you will see two drop-down text fields, one for disabled texts, and one for New Text. Click into the New Text field, and type whatever you want to call this fancy gadget were making. I call it BGHealer but...use your own creative tastes. Incidentally, if you choose to create custom texts for other things, and want to reuse it in other unitframes (say you make something for your "target" frame but want to reuse it in your raid frames), you'll find it under your disabled texts so you don't have to create it from scratch again.

Notice under the pitbull config window the gigantic mess of Magic Eye. I made my cut and paste big enough so you could see what I'm talking about and not panic ;-).

Ok, time for the scary coding part of the text.

STEP EIGHT : Under your expanded texts you should now see the name of the one you just added. Click it.

STEP NINE : This drop-down menu lets you pick where you want your custom flashing green healer light to show up in the unit frame. I put it on the inside right of the frame, b/c I have nothing else going on there right now anyway.

STEP TEN : Tada the coding. Reproduce this exactly. I reput it in here with explanation:

[Class = "Priest" ? ~HasAura("Shadowform") ? "H":Green]
[Class = "Paladin" ? MaxMP > 10000 ? "H":Green]
[HasAura("Earthliving Weapon") ? "H":Green]
[Class = "Druid" ? ~HasAura("Moonkin Form") ? MaxMP > 10000 ? "H":Green]

What this is basically doing, is running through the steps that we talked about before in my How to Heal a BG.

*The "Class" dogtag, returns the unit's class. The = compares it to what we set up following it in quotation marks (priest/pally/druid).
*The "?" is an if statement. So if the class matches, it proceeds to the next thing in the brackets. You can put as many of those sequentially in a tag as you want, depending on the complexity of what you want to code. You'll note that my druid one has three if statements in it, b/c druids are hard to figure out!
* "HasAura" checks the auras/buffs of the unit. You could do a ~ in front of the HasAura which is a negation -- a DoesNotHaveAura, if you will.
* "MaxMP" is exactly what it sounds like. It checks the mana pool of the unit in question.
* After all the ifs have been truthfully satisfied, you see "H":Green. This is what you actually want the text to be. I just made a green H, because I found that saying "HEALER" took up too much space on my raidframes, which tend to be fairly small in a battleground, particularly a 40-man one like IOC or AV.

*Possible faults should be highlighted here. Remember that no addon is ever going to match your personal skills of actually inspecting the person for talents/gear, or getting a direct response to a query in BG chat. This text is a helpful assist, and I do not recommend using it to replace personal hands-on observation. Also, with regard to shamans, sometimes a resto shammy will forget to put earthliving weapon up, in which case they won't get flagged. But my reading tells me they're SUPPOSED to have it on pretty much all the time, so you shouldn't run into that too often. Also, an spriest dpsing in normal form, or a boomkin dpsing in caster form, won't trigger the flag either. But usually if either of those classes is out of form, it's because they're healing (usually themselves, but hey, miracles happen) so they deserve your support!

STEP ELEVEN : Save your lovely new dog-tag!

LAST NOTE : See that button at the bottom, DogTag help? Feel free to click Open and fiddle around. There's a LOT of utility with this library that I haven't even scratched, and it's actually a fairly easy readthrough help screen that lets you mess around and try to play in the sandbox before you risk trying to actually use it in pitbull or xperl. You can also open this same window up to play with dogtags by doing /dt in your command window.


Go forth and tinker!


Traxus said...

This is excellent, thanks for the writeup. Do you know if it's possible to do the same with Grid?

Ihrayeep said...

I hunted but it looks like the answer to that question is no, unfortunately. Everyone besides pitbull (and I think iceHUD as well) seems to have moved on and not-use dogtags anymore.

It's a library, not an addon, technically, so it's a question of whether your particular unit-frames addon uses it.

You could do a simple test to see if it does by just typing /dt in your command line -- if nothing comes up, you know it won't work. If you get that sandbox-type window I mentioned at the end, then somewhere, someone of your addons uses it.