"Randomish" Mount Macro - Is it possible using script?

Hello everyone,

I was wondering if you folks could help me with a question about using script in a “Randomish” Mount Macro.

I am aware of the Random Favorite Mount button/macro, but that unfortunately applies to the whole account.
I am wanting to create a mount macro for each of my characters, to help give them personality.

My default, non-script, macro tuns something like this for this character…

#showtooltip
/stopmacro [flying]
/use [swimming,nobtn:2]Darkwater Skate; [swimming][nobtn:2]Flying Machine; [resting]Red Mechanostrider; Swift Yellow Mechanostrider
/eq [swimming] Hydrocane; [] Runeblade of Baron Rivendare

The macro, functions fairly simply in practice.
Are you swimming?
Then a left click gets my water mount, while a right click gets my flying mount.
Not swimming?
Defaults to a Flying mount on a normal left click, right click gives you either a smaller city mount, or a larger wilderness mount.
(Note: I default to the flying mount, because I no longer trust the [flyable] conditional, it returns false in too many places.)

I am wanting to add some randomness to my macro, to change up this characters mechanostriders when [noresting].

I found this bit of random mount script…
/run local m={88,89,90} C_MountJournal.SummonByID(m[random(#m)])

The 88,89,90 represent the three Swift Mechanostriders.

Is there a way to add a conditional, or multiple conditionals, to the script?

So that each set of random variables is assigned to a conditional, and can mimic my original macro layout…just with the added benefit of random mounts some situations?

Thanks for your time.

SecureCmdOptionParse returns a string. You could use those strings as keys for a table with the mount ids.

/run k,m=SecureCmdOptionParse("[swimming,nobtn:2]s;[swimming][nobtn:2]f;[resting]r;g"),{s={855},f={205},r={39},g={88,89,90}}C_MountJournal.SummonByID(m[k][random(#m[k])])