I have an addon that toggles the CVAR deselectOnClick when I go into combat (to prevent me from accidently clicking off the target) and toggles it back on when I’m done. I just noticed today (not sure when it actually broke to be honest) that I can no longer toggle this variable (in or out of combat). I can change it via the Sticky Targeting selection in settings, but no matter what I can’t seem to toggle it period via SetCVar()… I even checked with GetCVarInfo and it’s not locked, so not sure why I can’t.
This is my code which was working back in DF for sure. I have even tried just to toggle the CVar with all addons disabled. Still doesn’t work.
local function toggleSticky(self, event, ...)
local value = (event == "PLAYER_REGEN_DISABLED" and "0" or "1")
C_CVar.SetCVar("deselectOnClick", value)
print("StickyTarget: toggled deselectOnClick to " .. value)
print("StickyTarget: deselectOnClick set to " .. C_CVar.GetCVar("deselectOnClick"))
end
local f = CreateFrame("Frame", "StickyTargetListenerFrame", UIParent)
f:SetScript("OnEvent", toggleSticky)
f:RegisterEvent("PLAYER_REGEN_ENABLED")
f:RegisterEvent("PLAYER_REGEN_DISABLED")
print("StickTarget: Loaded")
Just for giggles, I tried modifying this to adjust the Sound_MasterVolume CVAR instead of deselectOnClick, and it works just fine. It’s something specifically with deselectOnClick.
And if you check both with C_CVar.GetCVarInfo() neither indicate that they can’t be altered. shrugs, out of ideas here.