Oh but my onload function updates some stuff.
Lua Code:
function AMD_OnLoad(self)
print("AMD: AddOn loaded")
AMD_TabOnCharacterFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
AMD_TabOnCharacterFrame:RegisterEvent("VARIABLES_LOADED");
AMD_TabOnCharacterFrame:SetScript(
"OnEvent", function(self, event, ...)
print("DEBUG: Event:", event); -- For debugging
if (event == "VARIABLES_LOADED") then
if AMD_CharacterSavedVariables == nil then
print("AMD_CharacterSavedVariables : ", AMD_CharacterSavedVariables );
-- No Saves for this character found
AMD_CharacterSavedVariables = {};
end
if AMD_SavedVariables == nil then
print("AMD_SavedVariables: ", AMD_SavedVariables);
-- No Saves found
AMD_SavedVariables = {};
AMD_OpagueBackgroundCheckbox:SetChecked(true);
AMD_DisplayFormatIconRadioButton:SetChecked(true);
else
print("AMD_SavedVariables: ", AMD_SavedVariables);
AMD_OpaqueBackgroundCheckbox:SetChecked(AMD_SavedVariables["OpaqueBackground"]);
if (AMD_SavedVariables["DisplayFormat"] == true) then
AMD_DisplayFormatIconRadioButton:SetChecked(true);
AMD_DisplayFormatTextRadioButton:SetChecked(false);
else
AMD_DisplayFormatIconRadioButton:SetChecked(false);
AMD_DisplayFormatTextRadioButton:SetChecked(true);
end
end
if (AMD_OpaqueBackgroundCheckbox:GetChecked() == true) then
AMD_TabOnCharacterFrame:EnableDrawLayer("BORDER");
else
AMD_TabOnCharacterFrame:DisableDrawLayer("BORDER");
end
end
if (event == "PLAYER_ENTERING_WORLD") or (event == "PLAYER_MONEY") then
AMD_UpdateScreen(event);
end
end
)
end