2 addon commands in 1 macro, turning it on and off?

/ac button 0
/ac button 1

these are the commands of a addon, they turning a icon off and on.
i tried to put these in a macro, but the only output i get was button 1 command.
i wonder how to use these command separately so i can turning it off and on again each time i click the macro… little help!

Could use Macro-Talk’s /opt command and regular macro conditions to differentiate the clicks.

You could also see this thread for how functions are associated with an addons slash command.

Your macro would be something like

/run BroqToggleAc = not BroqToggleAc SlashCmdList.AcSlashFunc(BroqToggleAc and 1 or 0)

Where the AcSlashFunc portion is the function in the SlashCmdList table used by /ac in the addon.

kinda try not to add more addons atm, but if im stucked then i will try it thx
and
idk how this slashcmdlist works, i tried SlashCmdList.dbm() instead SlashCmdList.BigWigs(), example from the link but doesnt open dbm option or any windows. im so lost lol

You need to find, in the addon, the name of the slash command function. I don’t know which addon /ac comes from.

For DBM it would be
/run SlashCmdList.DEADLYBOSSMODS()

Instead of
/dbm infoframe
you would:
/run SlashCmdList.DEADLYBOSSMODS("infoframe")

1 Like

Slash commands get added to hash_SlashCmdList, with key being the slash command in upper case, and value being the function for the slash command. (Remember to pass something to use as a msg.)

/run hash_SlashCmdList["/AC"]("button 0")

If OP wanted to toggle between /ac button 0 and /ac button 1:

/run AcT=not AcT hash_SlashCmdList["/AC"](AcT and "button 1" or "button 0")
2 Likes

Thank you very much! i can toggle it now

just curiousity, what does AcT meaning?

AcT is a global variable that is created by doing AcT=not AcT to store/toggle(true/false) the current state to use in the slash command:
(AcT and "button 1" or "button 0")
which is shorthand for:

if AcT then 
    "button 1"
else
   "button 0"
end
1 Like