View Single Post
04-13-24, 05:13 AM   #15
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 115
Originally Posted by Xrystal View Post
Your code must still be missing something which is why I asked to see the code where you create your settings panel. How you create that will determine how you display it.
Sorry. Looks like I didn't see it. Here is the panel code.

Lua Code:
  1. local addonName, addon = ...
  2. -- Create a function to add options to the Interface Options Addons panel
  3. local function AddAddonOptions()
  4.     local panel = CreateFrame("Frame", "MyAddonOptionsPanel", UIParent)
  5.     panel.name = "ZamestoTV: Gold" -- Replace "MyAddon" with your addon's name
  6.  
  7.     -- Create a checkbox for QuestCompletionFrame
  8.     local completionCheckBox = CreateFrame("CheckButton", "QuestCompletionFrameCheckbox", panel, "InterfaceOptionsCheckButtonTemplate")
  9.     completionCheckBox:SetPoint("TOPLEFT", 16, -16)
  10.     completionCheckBox.Text:SetText("Enable Quest Completion Frame") -- Replace with your desired default text
  11.     completionCheckBox.tooltipText = "Enable the Quest Completion Frame" -- Replace with your desired default tooltip text
  12.  
  13.     completionCheckBox:SetScript("OnClick", function(self)
  14.         local isChecked = self:GetChecked()
  15.         -- Handle the checkbox state change here
  16.         if isChecked then
  17.             -- Checkbox is checked, enable QuestCompletionFrame
  18.             QuestCompletionFrame:Show()
  19.         else
  20.             -- Checkbox is unchecked, disable QuestCompletionFrame
  21.             QuestCompletionFrame:Hide()
  22.         end
  23.     end)
  24.  
  25.     -- Create a checkbox for ZAMTimer777 frame
  26.     local timerCheckBox = CreateFrame("CheckButton", "ZAMTimer777Checkbox", panel, "InterfaceOptionsCheckButtonTemplate")
  27.     timerCheckBox:SetPoint("TOPLEFT", completionCheckBox, "BOTTOMLEFT", 0, -8)
  28.     timerCheckBox.Text:SetText("Enable ZAMTimer777 Frame") -- Replace with your desired default text
  29.     timerCheckBox.tooltipText = "Enable the ZAMTimer777 Frame" -- Replace with your desired default tooltip text
  30.  
  31.     timerCheckBox:SetScript("OnClick", function(self)
  32.         local isChecked = self:GetChecked()
  33.         -- Handle the checkbox state change here
  34.         if isChecked then
  35.             -- Checkbox is checked, enable ZAMTimer777 frame
  36.             ZAMTimer777:Show()
  37.         else
  38.             -- Checkbox is unchecked, disable ZAMTimer777 frame
  39.             ZAMTimer777:Hide()
  40.         end
  41.     end)
  42.  
  43.     -- Add the panel to the Interface Options Addons category
  44.     InterfaceOptions_AddCategory(panel)
  45.  
  46.     -- Handle language localization
  47.     local locale = GetLocale()
  48.     if locale == "deDE" then
  49.         -- German localization
  50.         completionCheckBox.Text:SetText("Aufgabenliste: Ein-/Ausblenden")
  51.         completionCheckBox.tooltipText = "Aufgabenliste: Ein-/Ausblenden"
  52.         timerCheckBox.Text:SetText("Timer: Ein-/Ausblenden")
  53.         timerCheckBox.tooltipText = "Timer: Ein-/Ausblenden"
  54.         panel.name = "ZamestoTV: Gold"
  55.     elseif locale == "enUS" then
  56.         -- English localization
  57.         completionCheckBox.Text:SetText("To Do List: Show/Hide")
  58.         completionCheckBox.tooltipText = "To Do List: Show/Hide"
  59.         timerCheckBox.Text:SetText("Timer: Show/Hide")
  60.         timerCheckBox.tooltipText = "Timer: Show/Hide"
  61.         panel.name = "ZamestoTV: Gold"
  62.     end
  63. end
  64.  
  65. -- Register the addon-specific options when the player logs in
  66. local frame = CreateFrame("FRAME")
  67. frame:RegisterEvent("PLAYER_LOGIN")
  68. frame:SetScript("OnEvent", function()
  69.     AddAddonOptions()
  70. end)

I'm new to writing LUA, but I was advised to use ChatGPT (with the help of it I was able to create the panel code and the "icons on the minimap" code)

Last edited by Hubb777 : 04-13-24 at 05:15 AM.
  Reply With Quote