Get the Desktop App for Battle.net Now
- All your games in 1 place
- Log in once
- Automatic game updates
UPDATED 12/19/12 TO WORK WITH BOTH WILD BATTLES AND PET TAMERS.**
Outfitter is required for this to work. If there is demand, I can make a tiny addon that does this too.
1. Open your Character Screen (C) and hit the Outfitter button in the top right to open Outfitter's panel.
2. At the bottom-right, click "New Outfit".
3. For the name, type in "Safari Hat" (or whatever). Leave Automation set to "None". Under "Build", make sure to select "Create Empty Outfit".
4. Now select your new outfit in the list (make sure it has a checkbox next to it) and drag your Safari Hat into the Helmet slot on your Character Sheet.
5. Click on the down arrow next to your new outfit's entry in the list and go to "Script (None)" --> "Custom ..." (under the Automation header) and click on it.
6. Copy the following code and paste it into the Script window. Then press Okay.
7. Lastly, select your normal outfit (so that the Safari Hat one gets unselected) and you're good to go.
** Note that this is not 100% perfect, only 99% perfect. Sometimes it will break and I don't want to over-complicate an already absurdly complicated script.
Edited by Simca on 12/19/2012 1:33 PM PST
Hmm. Using same Outfitter version.
Let me try making it use a slightly different event, I think it might be trying to trigger the swap when your character does not have control yet (during battle intro sequence).
I agree. So many times I forgot to use the hat during pet battles and so many times I forgot to change the hat in a raid.
Edit: Testing the Safari Hat itself now to make sure it works the way I think it works.
Edit 2: Hat works fine while weaing it normally, but with the outfitter swap it does not give bonus EXP. I can only guess I'm Unequipping it a second too late or maybe it has to be equipped for 100% of the fight.
Edited by Simca on 12/13/2012 12:15 AM PST
Updated the Outfitter script in the OP to truly give the EXP bonus now (I had to adjust the time that it equips/unequips it). However, it only works for wild pets.
What I did is pretty outside the scope of Outfitter, so I'll make an addon for it separately later this week. Should be a neat project.
Edited by Simca on 12/13/2012 12:32 AM PST
If you're writing an addon you may look into hooksecurefunc("TurnOrActionStart") or "TurnOrActionStop" to get the moment just before you "right click" a wild pet. So targeting a critter and then getting aggro beforehand won't equip a hat too soon (not that it should make a huge difference).
For those reluctant to install outfitter, this is a simple macro to toggle the hat:
/run local o,s=GetItemInfo(GetInventoryItemLink("player",1)) s=o~="Safari Hat" EquipItemByName(s and "Safari Hat" or OldHat) ShowHelm(s) OldHat=o
If a Safari Hat isn't worn, it equips it and turns the helm graphic on.
If it's not worn, it equips whatever you had previous and turns the helm graphic off.
Hmm, interesting function but I'm not sure it does the job. It provides no arguments when hooked and after its execution it clears mouseover, so secure hooking it wouldn't be an option if I wanted to check mouseover + target (since you can initiate a pet battle without a mouseover by using the "interact with target" key and you can initiate a pet battle without a target by right-clicking before left-clicking).
I could just use a regular insecure hook (so I could get mouseover before that was called), but I always worry about using those on major game functions (such as this) because it could cause some obscure taint.
Edited by Simca on 12/13/2012 12:20 PM PST
Sadly TurnOrActionStop et al aren't unsecurely hookable (without breaking stuff in a big way). The changes in 1.10 and 1.11 were some of my prouder accomplishments in the addon community.
You can work around it:
But with interact with target and pet tamers, a more economical approach is probably fine.
I've been busy with other addons so I haven't had time to convert this into one yet, but I just updated the script in the first post to now work with Wild Battle Pets AND Pet Tamers.
Update to the new script and enjoy 100% automated Safari Hat goodness!
Edit: Updated again 12/19/12. It works but is only 99% perfect. Working on an addon version for that reason.
Edited by Simca on 12/19/2012 1:34 PM PST
You may already be aware of it, but there's a mod that does something similar - Iron Chef. It would automatically equip your chef's hat if it was in your bag when the cooking window was opened. I know the mechanics of pet battles are different (and that mod hasn't been updated in a long time), but you might get some ideas on how to program the Safari Hat mod.
It's not on Curse anymore, but it's on WoW interface:
Published the addon today (well, actually over a day ago but Curse staff was busy because of New Years I'm sure).
Forum thread for the addon: http://us.battle.net/wow/en/forum/topic/7415156093
Curse link: http://www.curse.com/addons/wow/auto-safari-hat
Threats of violence. We take these seriously and will alert the proper authorities.
Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.
Harassing or discriminatory language. This will not be tolerated.