Reply
 
Thread Tools Display Modes
Unread 06-29-11, 09:39 PM   #1
litesung
A Flamescale Wyrmkin
 
litesung's Avatar
Join Date: Aug 2010
Posts: 129
[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.
litesung is offline   Reply With Quote
Unread 06-29-11, 10:27 PM   #2
Nibelheim
local roygbi-
 
Nibelheim's Avatar
Featured
Join Date: Jan 2010
Posts: 1,597
Originally Posted by litesung View Post
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.
Off:

/run SetCVar("Sound_EnableSFX", 0)


On:

/run SetCVar("Sound_EnableSFX", 1)
Nibelheim is offline   Reply With Quote
Unread 06-29-11, 10:43 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,691
To make it into a toggle...
/run SetCVar("Sound_EnableSFX",GetCVar("Sound_EnableSFX")==0 and 1 or 0)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

Seerah is offline   Reply With Quote
Unread 06-29-11, 11:17 PM   #4
Nibelheim
local roygbi-
 
Nibelheim's Avatar
Featured
Join Date: Jan 2010
Posts: 1,597
Oops, my bad.

Originally Posted by Seerah View Post
To make it into a toggle...
That's the ticket
Nibelheim is offline   Reply With Quote
Unread 06-30-11, 06:51 PM   #5
litesung
A Flamescale Wyrmkin
 
litesung's Avatar
Join Date: Aug 2010
Posts: 129
Nibelheim always pulls through for me 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)

Last edited by litesung : 06-30-11 at 06:57 PM.
litesung is offline   Reply With Quote
Unread 06-30-11, 08:31 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,068
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();
Toggle Sound:
Code:
/run Sound_ToggleSound();
__________________
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
SDPhantom is offline   Reply With Quote
Reply

Go BackWoWInterface » AddOns, Compilations, Macros » Macro Help » [Request] Macro to toggle sound

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off