Setting the Same CVar Twice in Quick Succession

This doesn’t seem to work anymore.

I used to be able to do something like:

#showtooltip Primary Nuke
/console Sound_EnableSFX 0
/use 13
/use 14
/use Off GCD Damage Amp Ability
/use Other More Different Off GCD Damage Amp Ability
/use Primary Nuke
/run UIErrorsFrame:Clear()
/console Sound_EnableSFX 1

And it would fire the primary nuke as normal, the off-GCD stuff as available, and wouldn’t spam me with error text and error speech. This is no longer the case - whether in a macro or an addon, setting Sound_EnableSFX() on and off doesn’t work - it turns off, but won’t turn back on. I tried the same structure with Sound_SFXVolume() and got the same result. In an addon, I tried delaying the second CVar by a few seconds with a C_Timer.After() but that didn’t work either.

Is this an addon conflict or something controlling CVars that I’m not aware of, or is this expected behavior these days?

since patch 8.2.0 the error text started behaving quirky, this should hide it

#showtooltip Primary Nuke
/use 13
/use 14
/use Off GCD Damage Amp Ability
/use Other More Different Off GCD Damage Amp Ability
/use Primary Nuke
/run UIErrorsFrame:Hide()C_Timer.After(0,function()UIErrorsFrame:Clear()UIErrorsFrame:Show()end)

Not sure how to clear the sound though, maybe it’s easier to just disable Error Speech altogether in the options. There also isn’t really much space left for that in the macro anyway

1 Like

It’s not error speech I’m after, but spell activation sound effects.

The error speech, the “woosh” sound, and a few others.

I’m also doing this in an add-on so length isn’t an issue.

Cvars are getting disabled fine, but sounds seem to resume even after the cvar has been toggled. You can test this with ctrl-s or toggling the global sound options while spamming your macro

The only option I see is to just mute the “woosh” sounds, and any other sounds that you can find. You can put these sound IDs into MuteSoundFile or copy the whole snippet into https://addon.bool.no/

local sounds = {
	569772, -- sound/spells/fizzle/fizzleholya.ogg
	569773, -- sound/spells/fizzle/fizzlefirea.ogg
	569774, -- sound/spells/fizzle/fizzlenaturea.ogg
	569775, -- sound/spells/fizzle/fizzlefrosta.ogg
	569776, -- sound/spells/fizzle/fizzleshadowa.ogg
}

for _, fdid in pairs(sounds) do
	MuteSoundFile(fdid)
end

I’m having the opposite issue.

Setting Sound_EnableSFX 0 turns it off just fine, but Sound_EnableSFX 1 does not turn it back on. Same for Sound_SFXVolume.

I’m now remembering a recent thread in which we determined that are swapped, so I’ll go test that theory.

I did some testing and cannot confirm that toggling either Sound_EnableSFX or Sound_SFXVolume clears the sounds. Even tried it with separate /console commands

/run local v = "Sound_EnableSFX"; SetCVar(v, 1-GetCVar(v)); print(v, GetCVar(v))
/run local v = "Sound_SFXVolume"; SetCVar(v, GetCVar(v) == "1" and 0 or 1); print(v, GetCVar(v))

So I tried four different methods for each CVar. On mobile but I’ll edit with my code when at my PC.

Method 1: Chatframe

Ran console Sound_EnableSFX 0, confirmed sound off. Ran console Sound_EnableSFX 1, confirmed sound on.

Method 2: Macro
Same commands as above, together in a macro. Sound turns off and doesn’t come back on. Manually entering the command as above turns it back on.

Method 3: GetCVar() and SetCVar() in functions in Addon

Collects the state of the CVar before running, sets to 0, then sets to the GetCVar() return. Sound turns off, does not turn back on.

Method 4: SetCVar() Called Directly in addon

Just SetCVar() to 0 and then 1, no checking state before run, no discrete functions, calling this in line as part of the OnEvent() function. Sound turns off, does not turn back on.

This makes me think there is a throttle period to setting the same CVar more than once in a short period.

/run PlaySoundFile(569772, "SFX") PlaySoundFile(569774, "SFX")
You can hear both sound effect play.

/run SetCVar("Sound_EnableSFX", "0") print(GetCVarBool("Sound_EnableSFX")) PlaySoundFile(569772, "SFX") SetCVar("Sound_EnableSFX", "1") print(GetCVarBool("Sound_EnableSFX")) PlaySoundFile(569774, "SFX")

You can hear only the last one play.

The prints return false/true for off/on
Seems it’s working.

1 Like

i ran into the same thing as i force scan all the tradeskills. i open the tradeskill pane, set each tradeskill, scan and loop, but you get the sounds that makes and i wanted to mute them (or at least give the users the option to mute them).

i set the Sound_EnableSFX cvar to off, did the scan and then set it back on, for each tradeskill scan, but it kept ignoring the changes and playing the sounds. even if i yielded after each one (it was inside a coroutine), made no difference.

eventually i gave up and now just disable it before i start the scans, and then re-enable it when ive done all of them, which works fine but has some potential to leave the sound muted.

its possible its a timing issue, or it could be a bug in C_CVar

its also possible its been fixed but i cant be bothered checking, or changing my code again, at least not unless it starts causing an issue.

for macros. there was an issue doing it via C_CVar in Lua

I’ma just leave this here.

This is my own uber one-stop shop for pet management.

It will wake up the pet if it’s currently dead, rez a pet if it’s dead, call my 1st pet if no pet is out and finally cast mend pet if none of the other conditions is met.

Note that like you all, I was getting annoyed with the whistle sound on pet wake up even if the pet was alive. It seems that calling “/console Sound_EnableSFX 0” and 1 in quick succession was not working, like it was too fast or something and the re-enable needed a delay. So I borrowed inspiration from one of the posts above with the clever use of the CTimer API call to enable the sound effects via a cvar setting after 200 milliseconds (0.2 seconds) and viola! It works a treat.

Note that you may have to play with 0.2 figure, I did a lot of testing to arrive at this number, you may need more or less to get it to work.

#showtooltip Mend Pet
/console Sound_EnableSFX 0
/cast Wake Up
/run local v = “Sound_EnableSFX”;C_Timer.After(0.2, function() SetCVar(v,1) end)
/cast [@pet,dead]Revive Pet; [nopet]Call Pet 1; Mend Pet
/script UIErrorsFrame:Clear();