Stop macro if mounted

Here’s my macro as a whole:

/userandom [noflyable, nomounted] Spinemaw Gladechewer, Black Primal Raptor, Core Hound
/castrandom [nomounted] Corrupted Dreadwing, Dark Phoenix, Jade Pandaren Kite
/dismount [mounted]
/cast Soulshape
/cast Flicker

It works for the most part I would just like to have the macro dismount me and stop the macro when mounted. Right now, I’m dismounting then I am casting soulshape.

I’d like the logic to be:

If mounted, dismount and exit macro otherwise cast soulshape.

Is this possible? Anyone have any suggestions?

Thanks for the assist!

Try [noflying]

/stopmacro [mounted]

Or add [nomounted] to the soulshape line.

You can remove the flicker line, soulshape automatically becomes flicker while transformed.