Sound Macro

I was wondering if anyone would be able to help me with this? I have a macro that turns my master sound on and off, but I want it to also tell me what the current status is in chat or another method if possible. The macro is below. So far I have tried everything I can think of related to /print macros and can’t get it to work so any help is appreciated. Thanks in advance.

/run SetCVar(“Sound_EnableAllSound”,GetCVar(“Sound_EnableAllSound”)==“0” and 1 or 0)

/run local s = GetCVarBool("Sound_EnableAllSound") SetCVar("Sound_EnableAllSound", s and 0 or 1) s = GetCVarBool("Sound_EnableAllSound") print("Sound", s and "\124cff00ff00On" or "\124cffff0000Off")

You could do a double GetCVarBool if you wanted to print actual confirmation rather than “this is what I just tried to set it too”

Fixed: to show printed text as confirmation.

2 Likes

Very impressive thank you.

That does sound better as it would be more accurate. Would you mind showing me what that would look like? If not no problem and thank you for your help.

Updated to OP code.

1 Like

That works perfectly. Really appreciate you taking the time to help. Have a good one.

1 Like

Easy to reuse toggle for any CVar that flips between 0 and 1.

/run local k,v = "Sound_EnableAllSound" v = C_CVar.GetCVar(k) C_CVar.SetCVar(k, 1 - v) print(k .. (v == "1" and " Disabled" or " Enabled"))

Added it to my template list.

1 Like

But mine has pretty colours :grin:

2 Likes