[Request] Macro to toggle sound
Does anyone know of a macro that will toggle sound on and off?
I want to use bindpad to bind it to a key, so that if I want to mute WoW I can just press that key, and press it again to unmute wow. |
Quote:
/run SetCVar("Sound_EnableSFX", 0) On: /run SetCVar("Sound_EnableSFX", 1) |
To make it into a toggle...
Quote:
|
Oops, my bad.
Quote:
|
Nibelheim always pulls through for me :p ty once again! TY to you too seerah!
This toggles the Sound Effects only though, so i just have to modify it to toggle sound only. /run SetCVar("Sound_EnableAllSound",GetCVar("Sound_EnableAllSound")==0 and 1 or 0) This is the new macro I'm using, but the problem is it only toggles sound off if it's on, and doesn't turn it back on if pressed. (stays muted) |
That's because the old GetCVar() function either returns a string or nil. There are Lua functions provided in the default UI that are run by the keybind system for toggling music and sound. Using the default keybindings, you can use Ctrl+M and Ctrl+S for music and sound respectively. To do this in a macro, you make calls to Sound_ToggleMusic() and/or Sound_ToggleSound(). Both are defined in Sound.lua within the FrameXML.
Toggle Music: Code:
/run Sound_ToggleMusic(); Code:
/run Sound_ToggleSound(); |
Quote:
I think the old functionality was much more useful :( |
So there's no way to turn it into a toggle? It has to be done with two different macros?
|
This should work:
Code:
/run local c = "Sound_EnableAllSound"; local s = GetCVar(c) or "0"; if s == "1" then SetCVar(c, "0") else SetCVar(c, "1") end |
Quote:
Quote:
Quote:
Code:
/run Sound_ToggleMusic(); Code:
/run Sound_ToggleMusic();Sound_ToggleSound(); |
Quote:
Code:
/run SetCVar("Sound_EnableSFX", 1-GetCVar("Sound_EnableSFX")) |
Quote:
Quote:
I tried them both, Nib's is silent (no notification), and Phantom's notifies you "Sound Effects Enabled/Disabled" message. THANK YOU EVERYONE! Hopefully no future patches break these. |
All times are GMT -6. The time now is 08:49 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI