Need help turning macro into addon

I have this macro:

/use Ratstallion Harness
/use Majestic Elderhorn Hoof
/use Magic Broom
/use !Travel Form
/use !stealth
/run if not IsMounted() then C_MountJournal.SummonByID(0) end
/run if not MovePadFrame then UIParentLoadAddOn"Blizzard_MovePad"MovePadFrame:Hide()end
/click [mounted] MovePadForward

On first activation it picks a mount based on what is available the the char that I am playing and second activation triggers a sort of autorun. Sadly tho this macro has now grown to long, I know there are add-ons that let me make longer macro’s but I would rather just turn this into a regular add-on.

My question: is it possible to shorten this to the 255 char limit of a regular macro. Or would turning it into a add-on be a lot of extra work? And if not where should I go to figure out how to do this.

Ill probably want to add more code to this macro in the future so eventually ill have to turn it into a add-on anyway.

The biggest problem with turning this macro into an addon, is with the /use and /click commands. Their Lua API equivalents are protected functionality, which requires a physical click or keypress from the player in order to execute.

Both approaches include creating a frame (hidden or visible) with a button on it, either to sit somewhere on the screen for you to click directly, or to be hidden and clicked by a macro which in turn would be bound to a key.

A SecureActionButtonTemplate (https://wow.gamepedia.com/SecureActionButtonTemplate) is what you need to make this work, but those buttons can only contain one action, so you’d also need background logic to recognize what spells your character has, what action should be cast next etc. and insert that action into the SecureActionButton.

All in, it’s a lot of work to convert this macro into an Addon. You might want to install the addon Long Macros instead, or split this macro into two smaller ones and chain them together with a /click on an action button.

Spell(s) : Sprint & Mounts
Macro name : Rogue Mount
Macro icon : ?
Macro Code:

#showtooltip
/cast [stealth] Sprint; [combat] Sprint; [indoors] Sprint; [flyable] Sky Golem; Summon Random Favorite Mount

If you are stealthed, in combat, or indoors it will cast Sprint, if you can fly it will cast Sky Golem, else it will summon one of your favourite mounts.

Set your chosen mounts as favorites in the mounts tab of the collections interface.

Also, you can use the addon called “Macro toolkit” to write addons longer than the default limit.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.