Thankfully, Lysi of WarcraftPets stumbled onto a script that can be used in a macro to summon a random companion. Yay!
/run local t={}for i=1,select(2,C_PetJournal.GetNumPets(false))do tinsert(t,(C_PetJournal.GetPetInfoByIndex(i)))end C_PetJournal.SummonPetByID(t[random(#t)])This command works just as the previous ones did and will summon a random pet from your collection.
I love being surprised with old and new pets that pop out whenever I use it. :)
Note: The macro mainly works if you don't have any filters on in the Pet Journal UI. Also, if you're typing the text out rather than copy/pasting, the script is one continuous line and there are no breaks.
UPDATE: As of Patch 5.1, the above macro will no longer work. The new macro to summon a random companion or a specific pet can be found here.
There is an add-on called Livestock which will summon a random pet for you - it also will do random mounts (ground or flying). I think it's been updated for the patch.
ReplyDelete@Sephrenya: Thanks, if the macro to summon a random pet ever stops working again, I'll check this addon out. :)
DeleteYay, macro works. thanks for passing this along! I don't like installing actual addons if I can help it. :)
ReplyDelete@pandy: Same here. :)
Delete:( Trying to run this, but I just end up "saying" the last 3 lines (starting w/ i=1)in chat. Any idea what I'm doing wrong?
ReplyDelete@Anonymous: Are you typing it out the way it looks on my blog? If so, that could be the problem since it looks like the "i=1" starts on a new paragraph when it's not. The entire command is one long continuous sentence and is not broken up despite the way it looks in this post.
DeleteTry highlighting the entire script (starting from /run) and then copying/pasting it.
Hey thanks for the reply! I guess I'm a bit of a noob w/ macros. I can't ever copy or paste into the macro box, but I did get it to work just re-typing. Thanks again, and I always enjoy your site:)
ReplyDelete/randompet works
ReplyDelete@Thetaobera: Yup, this post is outdated. As of patch 5.1 there are three simpler macros that you can use. I've outlined them here.
Delete