Thread Tools Display Modes
07/09/16, 04:14 PM   #1
Lagencie
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 7
Cant find the Error - Addon Settings not shown

Hello,

i am new to addon programming and i have more or less 2 similiar addons now (one own and one is just a dummy test project i found that shows how to create addon settings)

I use the same Libraries for both (LibAddon2.0)

addon.txt
Code:
## Title: MountFeedTimer Reloaded
## Description: Shows the remaining time until you can feed your mount again!
## APIVersion: 100015
## Author: Lagenia
## Version: 1.0
## DependsOn:
## OptionalDependsOn: LibAddonMenu-2.0, LibStub
## SavedVariables: MountFeedTimerSavedVariables

lib\LibStub\LibStub.lua

lib\LibAddonMenu-2.0\LibAddonMenu-2.0.lua
lib\LibAddonMenu-2.0\controls\panel.lua
lib\LibAddonMenu-2.0\controls\submenu.lua
lib\LibAddonMenu-2.0\controls\button.lua
lib\LibAddonMenu-2.0\controls\checkbox.lua
lib\LibAddonMenu-2.0\controls\colorpicker.lua
lib\LibAddonMenu-2.0\controls\custom.lua
lib\LibAddonMenu-2.0\controls\description.lua
lib\LibAddonMenu-2.0\controls\dropdown.lua
lib\LibAddonMenu-2.0\controls\editbox.lua
lib\LibAddonMenu-2.0\controls\header.lua
lib\LibAddonMenu-2.0\controls\slider.lua
lib\LibAddonMenu-2.0\controls\texture.lua

MountFeedTimerReloadedMenu.lua
MountFeedTimerReloaded.lua
MountFeedTimerReloadedMenu.lua
Code:
if MFT == nil then MFT = {} end

function MFT.MakeMenu()

	local menu = LibStub("LibAddonMenu-2.0")
	local set = MFT.settings
	local panel = {
		type = "panel",
		name = "MountFeedTimer",
		displayName = "Mount Feed Timer Reloaded",
		author = "Lagenia"
		version = "" .. MFT.version,
	}
	
	local options = {
		{
			type = "header",
			name = "Settings"
		},
		{
			type = "checkbox",
			name = "Unlock Windows",
			tooltip = "Toggle lock on/off",
			getFunc = function() return set.lock end,
			setFunc = function(value)
				set.lock = value
			end,
		},
		{
			type = "dropdown",
			name = "Display when",
			tooltip = "Display when?",
			choices = {"Always", "Hide in menus","Menus only", "Timer < 1 hour", "Toggle keybind"},
			getFunc = function() return set.Hide_Type end,
			setFunc = function(value)
				set.Hide_Type = value
			end,
			warning = "Keybind doesn't work with french client (german?)"
		},
	}

	menu:RegisterAddonPanel("MountFeedTimer_Reloaded", panel)
	menu:RegisterOptionControls("MountFeedTimer_Reloaded", options)

end
and the MountFeedTimerReloaded.lua
Code:
local em = GetEventManager()

if MFT == nil then MFT = {} end

MFT.name = "MountFeedTimer"
MFT.version = "1.0"
MFT.settings = {}
MFT.defaults = {
		lock = true,
		Hide_Type = "Menus only",
}

function MFT.Initialize(event, addonName)
	if addonName ~= MFT.name then return end
	
	em:UnregisterForEvent("MountFeedTimerInitialize", EVENT_ADD_ON_LOADED)
	
	MFT.settings = ZO_SavedVars:New("MountFeedTimerSavedVariables",1,nil,MFT.defaults)
	
	ZO_CreateStringId("SI_BINDING_NAME_MountFeedTimer_Reloaded_TOGGLE", "Toggle Window")
	
	MFT.MakeMenu()	
end

em:RegisterForEvent(MFT.name, EVENT_ADD_ON_LOADED, function(...) MFT.Initialize(...) end)
  Reply With Quote
07/09/16, 04:26 PM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Is the name of your addon "MountFeedTimer" or "MountFeedTimerReloaded"?
The name (MFT.name) must match the folder name.

And additional:
If you register with
Code:
em:RegisterForEvent(MFT.name, EVENT_ADD_ON_LOADED, ...
you should unregister the same name:
Code:
em:UnregisterForEvent(MFT.name, EVENT_ADD_ON_LOADED)
  Reply With Quote
07/09/16, 04:36 PM   #3
Lagencie
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 7
Ok, thx

I didnt name the Folder right - I thought only the code is needed
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Cant find the Error - Addon Settings not shown


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off