Macro Conditionals with /run

Classic Era macro question. Are macro conditionals usable with /run? I am trying to assign ItemRack Equipment sets to one mouse button, and then use nomod, shift and ctrl to select one of 3 sets. The concept is to equip a gear set heavy in spirit while running to the next mob/pull, and then swap in shadow damage gear before entering combat.

This works:

/run ToggleSet(“Spirit”)

This doesn’t:

/run [nomod] ToggleSet(“Spirit”)
/run [mod:shift] ToggleSet(“Shadow”)

Chat-GPT says it should work. :slight_smile:

MACRO script

Executes Lua code.

/script code
/run code

The Lua code is processed separately from macro text. You cannot use Lua code to do things like insert a condition into your macro.

from

2 Likes

As Battlecruisr said, you can’t mix conditionals with lua code but as long as you’re not doing anything secure in combat, you could just run the pure lua version

/run if IsShiftKeyDown() then ToggleSet("Shadow") else ToggleSet("Spirit") end
3 Likes

Did you try the /itemrack command? Not sure if it takes conditions but, worst case, you can combine it with Macro-Talk to do what you want.

If it works natty

/itemrack [mod:ctrl] equip CTRLSET; [mod:shift] equip Shadow; equip Spirit

Macro-Talk variant

/opt [mod:ctrl] /itemrack equip CTRLSET; [mod:shift] /itemrack equip Shadow; /itemrack equip Spirit

https://www.curseforge.com/wow/addons/macro-talk

There’s also SecureCmdOptionParse if you wanna stick with the script route
https://warcraft.wiki.gg/wiki/API_SecureCmdOptionParse