View Single Post
04-30-23, 02:39 AM   #10
AeroMaxxD
An Aku'mai Servant
Join Date: Dec 2022
Posts: 33
Oh but my onload function updates some stuff.

Lua Code:
  1. function AMD_OnLoad(self)
  2.     print("AMD: AddOn loaded")
  3.  
  4.     AMD_TabOnCharacterFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
  5.     AMD_TabOnCharacterFrame:RegisterEvent("VARIABLES_LOADED");
  6.  
  7.     AMD_TabOnCharacterFrame:SetScript(
  8.         "OnEvent", function(self, event, ...)
  9.             print("DEBUG: Event:", event); -- For debugging
  10.  
  11.             if (event == "VARIABLES_LOADED") then
  12.                 if AMD_CharacterSavedVariables == nil then
  13.                     print("AMD_CharacterSavedVariables : ", AMD_CharacterSavedVariables );
  14.  
  15.                     -- No Saves for this character found
  16.                     AMD_CharacterSavedVariables = {};
  17.                 end
  18.  
  19.                 if AMD_SavedVariables == nil then
  20.                     print("AMD_SavedVariables: ", AMD_SavedVariables);
  21.  
  22.                     -- No Saves found
  23.                     AMD_SavedVariables = {};
  24.  
  25.                     AMD_OpagueBackgroundCheckbox:SetChecked(true);
  26.                     AMD_DisplayFormatIconRadioButton:SetChecked(true);
  27.                 else
  28.                     print("AMD_SavedVariables: ", AMD_SavedVariables);
  29.  
  30.                     AMD_OpaqueBackgroundCheckbox:SetChecked(AMD_SavedVariables["OpaqueBackground"]);
  31.                     if (AMD_SavedVariables["DisplayFormat"] == true) then
  32.                         AMD_DisplayFormatIconRadioButton:SetChecked(true);
  33.                         AMD_DisplayFormatTextRadioButton:SetChecked(false);
  34.                     else
  35.                         AMD_DisplayFormatIconRadioButton:SetChecked(false);
  36.                         AMD_DisplayFormatTextRadioButton:SetChecked(true);
  37.                     end
  38.                 end
  39.  
  40.                 if (AMD_OpaqueBackgroundCheckbox:GetChecked() == true) then
  41.                     AMD_TabOnCharacterFrame:EnableDrawLayer("BORDER");
  42.                 else
  43.                     AMD_TabOnCharacterFrame:DisableDrawLayer("BORDER");
  44.                 end
  45.             end
  46.  
  47.             if (event == "PLAYER_ENTERING_WORLD") or (event == "PLAYER_MONEY") then
  48.                 AMD_UpdateScreen(event);
  49.             end
  50.         end
  51.     )
  52. end

Last edited by AeroMaxxD : 04-30-23 at 03:00 AM.
  Reply With Quote