So with the new changes to 3.3 there are new cvars for
nameplateShowEnemy
nameplateShowEnemyPets
nameplateShowEnemyGuardians
nameplateShowEnemyTotems
nameplateShowFriend
nameplateShowFriendPets
nameplateShowFriendGuardians
nameplateShowFriendTotems
nameplateAllowOverlap
Have been incorporated.
I'm fairly new to scripting Lua and I'm not sure how to use the GetCVar an SetCvar API functions.
Since most CVars return a "1" or "0" they're not considered booleans. I saw the GetCVarBool() function and I'm not sure exactly how to incorporate it.
For example I used to have a saved variable returning true or false for a toggle in my ace 3 options:
Code:
totems = {
order = 1,
type = "toggle",
name = L["Show Totems"],
desc = L["Toggles the showing and hiding of All totem nameplates."],
get = function() return self.db.profile.showtotems end,
set = function(info,val)
self.db.profile.showtotems = not self.db.profile.showtotems
if self.db.profile.showtotems then return print("-->>Totem Nameplates are now |cff00ff00ON!|r<<--") else return print("-->>Totem Nameplates are now |cffff0000OFF!|r<<--") end
end
},
Could it be simplified to:
Code:
totems = {
order = 1,
type = "toggle",
name = L["Show Totems"],
desc = L["Toggles the showing and hiding of All totem nameplates."],
get = function() return GetCVarBool("nameplateShowEnemyTotems") end,
set = function(info,val)
if GetCVarBool("nameplateShowEnemyTotems") then
SetCVar("nameplateShowEnemyTotems", 0, "scriptCVar")
else
SetCVar("nameplateShowEnemyTotems", 1, "scriptCVar")
end
end
},
??
I tried this and I get the toggle to show accurately, however changing the value for it in the options doesn't seem to set the CVar.
Where am I failing?