This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Live
PTR
10.2.7
PTR
10.2.6
Beta
Need random mount macro/addon with a twist
Post Reply
Return to board index
Post by
90137
This post was from a user who has deleted their account.
Post by
asakawa
have a look at 'equus infinata'. it certainly has some of the features you're looking for and may well be capable of everything you mention.
personally i just use it for the fact that it summons a flyer or ground mount correctly without the need for a long script macro checking for whereabouts you are in dalaran etc.
Post by
HighFive
I'm going to be rude and try to "feed you for a lifetime". What you requested is covered in at least one sticky, go read them.
@asakawa: the mount location issue was actually fixed a while ago. At the moment the only issues with the flyable conditional are in Wintergrasp. It will return true even during a battle.
Post by
Wildhorn
Via macro: no
Via addon: yes, but it would be very static and would require an update every time a new mount is added, because as far as I recall, you can't get the model of a mount (was already hard as hell to find out the speed when I created WildMount).
Post by
asakawa
@asakawa: the mount location issue was actually fixed a while ago. At the moment the only issues with the flyable conditional are in Wintergrasp. It will return true even during a battle.
good to know.
Post by
HighFive
@Wildhorn: Well, you could depend on the names to be consistent with the models. It's not like a mount with "Bear" in its name will not be a bear. :P
You would have to handle palominos and such though.
edit: @Anubi: Forgive my previous post. I didn't get that you actually wanted to call a mount based on model. That is specific enough to not be in any of the stickies.
Post by
pelf
You would indeed have to categorize the mounts yourself if you want them grouped by "model" as you said. However, it's do-able in a macro. Let's see if I can pseudocode it and then someone who is better at Lua than I am can write it.
local mounts = {{1, 5, 9, 13}, {2, 6, 10, 14}, {3, 7, 11, 15}, {4, 8, 12, 16}};
local class = random(1,#mounts);
local mount = random(1,#mounts);
CallCompanion("MOUNT", mount);
You define the "models" in those inner braces, then define a new group for each model. So you effectively have a list of lists.
Then you choose a list from the lists by getting a random number between 1 and the number of lists (# is count, right? also Lua arrays are one-based, right?).
Then, you find a random mount WITHIN that list by taking the count of the list retrieved by the index we just found.
Then you call that mount.
It looks kind of long, but, it's very compressible. I'm sure my syntax isn't exactly right
but
if we assume it is, then all of that can be compressed into this:
local m,c,t={{1,5,9,13},{2,6,10,14},{3,7,11,15},{4,8,12,16}},random(1,#m),random(1,#m);CallCompanion("MOUNT",t)
Only downside would be that you would have to keep it up to date. Up-side is that I think mounts are added to the companion list sequentially so you wouldn't have to shuffle your numbers around every time the list changes. Companions are in there alphabetically, I think.
EDIT
: brackets -> braces
I'll add this to my macro post if we work it out.
Post by
HighFive
I believe that will produce a runtime-error though. You see, the way the assignment operator works is, m (and c, and t) will be nil until it finishes. So you won't be able to reference the table that way.
You could be sneaky and do it this way:/run local r=GetRandomArgument CallCompanion("MOUNT",r(unpack(r({1,5,9,13},{2,6,10,14},{3,7,11,15},{4,8,12,16}))))
^is that the correct number of closed parentheses?(there should be a table variant of GetRandomArgument)
On a slightly related note I think writing a script that will update your macro's indexes every time you get a new mount will possibly be easier than writing something to recognize them more literally.
I mean you'd only have to find the index of the new mount (I think this may even get thrown as an argument of the event) and increment any index that is greater than or equal to it. Quite straightforward.
Post by
pelf
Blah blah, I was JUST coming in here to note that I didn't know how multiple-assignment worked. Of course you looked at my "condensed" version
:)
. Thanks for being complete and noting that since I forgot to (and remembered that I hadn't while I was sitting on the john).
As for your version, that is quite nice. Fairly significant reduction over the local _, local _, ... way.
WRT your related note, like I said, I think the mounts are just appended as you get new ones without changing the indexes of the previous mounts. Once you wrote it, you'd just have to add new indexes at that point.
Can anyone confirm what I think I'm remembering?
(And yes, the parens are right: open, open, open, open, close, close, close, close.)
Post by
HighFive
Actually I think I remember having the Albino Drake at the front, even though obviously I didn't get it first, so I think they're ordered alphabetically.
Post by
pelf
I know the NCPs are alphabetical. Mm, the order I'm seeing in mine might be coincidence.
So, if that's the case, how can we make this easy ... probably not without an addon; that would be too much to make mappings and whatnot.
Post by
HighFive
I don't think this can be done without an addon. (Unless you consider chaining /run macros with /click, or Hack pages not addons, I guess)
If one doesn't ever get any more mounts then it won't matter, and it is doable without an addon, but a static macro like that is pretty awkward nonetheless.
Post by
pelf
If one doesn't ever get any more mounts then it won't matter
, and it is doable without an addon, but a static macro like that is pretty awkward nonetheless.
OP, I think this is your answer. It's do-able with a macro, but not realistic to maintain if you're still getting more mounts.
Post by
90137
This post was from a user who has deleted their account.
Post by
asakawa
Tried Equus Infinata. It's nice but, unless i missed something, it doesn't pick random mounts based on their model but by name. Close, but still not exactly what i was aiming.
not sure if you missed it or if you did get it but it really isn't what you're thinking of but EI does have rather a lot of filters.
quoting from the
curse page
:
Filters?
Currently, Equus can filter your mounts by speed, species, colour and number of passengers. It can also filter companion pets by species, colour and type (ground/flying). You can use all of these filters in the slash commands.
This is a brief set of examples:
"/ei mount"
- Will summon a random mount from your entire collection.
"/ei mount kodo"
- Will summon a random kodo.
"/ei mount !nopassengers"
- Will summon a mount which has space for at least one passenger.
"/ei mount kodo raptor"
- Will summon a random kodo or raptor.
"/ei mount kodo !grey"
- Will summon a random kodo which is not grey.
"/ei mount !blue kodo slowground nopassengers"
- Will summon a random kodo which is not blue, cannot carry pasengers, and travels at 60% ground speed.
it also has the filter "checked" and tick boxes next to each mount so, personally, i just tick the ones i like and let it choose one for me with the macro "/ei mount checked". however, judging by the info on the curse page it is capable of much more than that.
just in case you'd missed it.
Post by
HighFive
What the OP is looking for is im essence a random choice
with custom probabilities
, one that is not uniformly distributed.
I don't know if commands like "/ei mount kodo raptor" will first flip a coin to choose either kodo or raptor and then chooses a random kodo or raptor (what the OP would want). It seems to me more likely that it will provide equal probabilities to each individual mount.
Post by
asakawa
ah yes, you're quite right, i was forgetting the OP had made that stipulation earlier on.
Post by
pelf
Aye, i'm planning to get even more mounts,
but i don't bother much having to update every time
, as long is not a total rewrite of the macro/script. And i don't want every model being used (rams, for example)
Thank you for the support, will give another look around. ;-)
If that's the case, then the script is there. HF & I are pretty sure it works. I think companions are 1-based, starting top left, then across, then down, across, etc. and then to the next page. You can replace the brace section with your own companion IDs.
As you get mounts, the macro will sort of stop behaving, but you might actually not notice until the list changes significantly. Getting a new mount won't
break
the macro, so you will probably be able to just update it at milestones.
Let us know how it goes!
Post by
HighFive
Oh, I just noticed. Did you want to have the macro check for flyability and act upon it? Or would you rather have two separate macros?
If the first one is true this should do the trick:/run local r,u=GetRandomArgument,unpack CallCompanion("MOUNT",r(u(r(u(IsFlyableArea()and {{1,5,9,13},{2,6,10,14}} or {{3,7,11,15},{4,8,12,16}})))))Where the first table of tables is your flying mounts and the second is your ground mounts.
The macro is quickly growing but it's still well below 255 characters and should support about 50 mounts without crossing that.
Also, yay for unreadability.
Post by
pelf
Yeah. That's what the "expanded" section is for on my post.
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.