Quantcast
WoWInterface - View Single Post - Hide party quest information in Raids
View Single Post
10-06-16, 01:20 PM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Phanx View Post
Either of those should generally work, but the name of the CVar is a string, so it needs to be quoted:
Code:
SetCVar("showQuestTrackingTooltips", 1)
Without quotes, you're passing SetCVar a variable name, but since there is (probably) no variable with that name, SetCVar will either throw an error, or just ignore you.

Also, "f" should be a local variable (put a "local" keyword at the beginning of the first line). Putting "f" into the global namespace is just begging for conflicts -- and if Blizzard ever leaks a global "f" you could potentially break the whole UI, which actually happened with "_" when Cataclysm launched.

Finally, you can shorten things up a bit with ternary syntax.

Code:
local f = CreateFrame("Frame")
f:RegisterEvent("GROUP_ROSTER_UPDATE")
f:SetScript("OnEvent", function(self, event)
	SetCVar("showQuestTrackingTooltips", IsInRaid() and 0 or 1)
end)
Since you can't set cvars in combat, you should also make sure to have a combat lockdown check.
  Reply With Quote