Saturday, January 24, 2009

Magic Pet Bar Trick with Macaroon

So, today I've got pretty neat technique to show you--how to use custom conditionals with Macaroon--and a very useful application of this technique (for hunters, anyway).

  • Note: At the moment, the Bag and Menu Bars portion of Macaroon Xtras is broken for 3.0.8. Just disable that add-on and don't worry about it. If you're having trouble finding the minor edit you need to perform to get the main Macaroon add-on working again after of the change to secure templates, drop me an email and I'll explain it.
Unless you're a Hunter who is very, very (almost obsessively) focused about what playstyle they use, you've got more than one pet. ...and unless you're not very imaginative about your pet selection, you've now got some pets who have some talents that the others don't have. One of my pet peeves (no pun intended) is buttons on the display that can't be used or that make no sense. Heart of the Phoenix is very handy to have on a button, but only for the one pet family that can learn it. Carrion Feeder is also a great button to have, but not when your cat is out. You could try and put these into one of the middle four buttons on the pet bar, but then you can't easily keep cower/growl/taunt in there at the same time where you can keep a close eye on 'em. So how do we make these buttons go away without writing some crazy macro with those length limitations?

The solution is custom conditionals on a new Macaroon bar.

For those of you new to Macaroon that haven't figured out how to make a pet bar, here's now: Start by typing "/mac create bar" (or use the menu item "Create Bar"). A transparent blue box will appear in the middle of the screen which is your new bar. Right-click on it and on the right-hand side of the menu that appears will be full of little checkboxes, one of which says "Pet". Click that checkbox to flag this bar as a pet bar. Now click on the little arrow button in the lower-right-hand corner, and at the top of the next menu change the text to read "Pet Bar" because we want things labeled neatly in case we want to find them later with ButtonFacade or something. Lastly, since all new bars start with no buttons attached (don't forget this!) we now have to add some, so click the arrow-buttons again to go back to the first menu pane and then click "Button Count"--now scroll up or left-click until you've got ten buttons and then middle-click or move your mouse out of the bar area to stop changing button count. By default the new buttons should actually be assigned to pet action id (a.k.a. "pet id") one through ten, but in case they don't if you select Button Edit from the Macaroon menu, you can then click on them to cycle through whether or not they say "action", "macro", or "pet id:#". Make sure they all say "pet id:" and some number.

  • Note: While you might think you can do something clever like add fourteen buttons to the pet bar, and then edit the last four to be "normal" macro buttons and drop some macros in there, some bug/oddity in Macaroon causes the entire pet bar to be repeatedly (but not always) reset to contain only pet buttons.
Now, before we go on, I should explain a few things. Technically, this pet bar doesn't disappear when your pet isn't out, it merely has two states--one which is visible when you have a pet out and makes the conditional "[pet]" true and one which becomes visible when you don't have your pet out and makes the conditional "[nopet]" true. It just so happens that the [nopet] state of this bar still doesn't have any buttons assigned to it so there's nothing for you to see when it's active. It's important you understand this so that you'll see how our next part works. While you've got bar editing active (click 'Bar Edit' on the Macaroon menu) if you simply left-click on a bar (sometimes it takes two single-clicks to get it moving because the first one will often set the bar as the one you're actively editing) it will change state and go through the various states it could be. In the case of the pet bar two states are involved, pet and nopet. While you've got the nopet state selected, you could add two buttons and drop Revive Pet and Call Pet into them but don't do that--it'll make those buttons appear when you're mounted and when you're in a vehicle and in neither case would it make sense to have them on the screen then. For now what you need to know is that a bar can have multiple states and each state can have it's own independent set of buttons/macros.

Now that you have your relatively plain pet bar, we're going to make a magic pet bar that'll go right next to it which will hold our wonderful new macros and generally make life easier. So, again click Create Bar from the Macaroon menu or type "/mac create bar" to get a new pet bar on the screen, then right-click it and put a checkmark next to "Custom" which enables custom states. Click the little arrow buttons to go to the second menu pane and name the bar "Magic Pet Bar". Finally, at the bottom of the second menu pane you'll see a large text-entry box labeled "Custom States". Paste exactly the following into it (you may edit it later):

[bonusbar:5]hide
[mounted]hide
[pet:Cat]show
[pet:Gorilla/Raptor]show
[pet]show
[nopet]show
hide


Each of these lines contains one conditional test (inside the square brackets) and one result (to the right of the brackets). If the bit that inside the square brackets ("[ ]") is true, then the stuff to the right of it is what happens, and it'll stop working it's way down the list the moment the first one that's true is found. The strange "[bonusbar:5]hide" part is there to avoid a conflict with the Vehicle UI--if you're in a vehicle, then [bonusbar:5] is true, which then makes this state one to hide. If you're on your mount, then [mounted] is true and that will make this bar hide in this state. If your pet happens to be a Cat, then [pet:Cat]show makes the bar appear. If you want the same state to apply to more than one pet, you simply separate the pet names with slash, like "Gorilla/Raptor". You want [pet]show there for when you have a pet which doesn't fit into any of the groups you've just defined (because you neglect your wasp terribly) which can happen more often than you'd expect--there are a few quests out there that give everyone temporary pets. Finally [nopet]show makes this bar appear when you don't have a pet. The hide statement at the end is simply a catchall that will keep the bar hidden should none of these conditions be true (and you probably messed up somehow).

Now comes the fun part. Click the "Done" button so this giant mess of custom stateness will be saved. In Button Edit mode start left-clicking on the bar and you will see the bar change through each of these custom states! You may now have an entirely different set of buttons appearing on this bar for each of these custom states--simply select Button Count while the bar is set to a specific state and add some button slots just like you would with any new bar.

Now decide which of those pet conditionals you're going to change (because I know you're going to if you didn't already ignore me when I said "paste exactly") and change them now to avoid a bug in Macaroon. Each conditional is assigned to an array element and the button settings are tied to that array and not the conditional, so if you insert a new conditional at the top of the list and your cat buttons which may have been third in the list of states before will still be third in the list of states, but that third state might now be [pet:Gorilla] instead of [pet:Cat] and you'll have to go fix all the states again. There is another bug in Macaroon you should be aware of... If you ever see the state listed as "custom homestate" or saying "(not indexed)" it's because the editor has freaked out--just keep left-clicking until the thing changes to a state you recognize. Any changes you make to the bar while it's showing either of those two things won't work properly and may appear over the top of other states (and will not be editable, requiring you to delete the entire bar and start it all over again).

I strongly suggest this Magic Pet Bar be the place where you put your Dismiss Pet button, a Mend Pet button, the macro for FizzWidget's Feed-O-Matic (or just your own Feed Pet macro) and your Master's Call macro, just for starters. The nopet state is a good place to put Beast Lore, Tame Beast, Call Pet and probably Revive Pet as well. It's also probably worth mentioning that you should stick the "common" buttons like Dismiss Pet on one end of the Magic Pet Bar in each applicable state so they'll always be in the same order and relative position on your screen.

No comments: