View Single Post
12/15/16, 02:43 PM   #1
Crabby654
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 19
Question Running into issues with LAM, first addon with it!

Hey there everyone. So I created a super basic addon way long ago, bigger chat window. Basically a brainless addon to create. But now I am attempting to create my own version of the "ESO Toolbox" addon called "Expanded Options", but I want to build it myself and have more options.

I am running into issues at the very start. I want to have a settings window for this addon in the Addon Settings Menu in the default UI, but it just is not working at all. I was trying to pull parts of code from other addons with very very basic LAM settings window in the addon settings menu part of the default UI.

As an example I pulled out the AlignGrid LAM parts of the main lua and put it into my addon, I changed all the relevant information to remove anything with AlignGrid to ExpandedOptions. The addon is recognized by ESO and it shows up in the ESO Addons and is enabled. However I am seeing nothing in the Addons Settings Menu.

I am at a loss of what to do. I am an incredible newbie with LUA and making addons, I have updated a couple buy basically just updating the TOC and Library files, nothing code related.

Here is the contents of ExpandedOptions.lua
Code:
local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0")

local panelData = {
		type = 'panel',
		name = 'ExpandedOptions',
		displayName = 'Expanded Options',
		author = 'Crabby654',
		version = '1.0',
		slashCommand = '/eopt',
	}

local restartRequired = '|t16:16:/esoui/art/progression/lock.dds|t You have to restart the game for these changes to take effect.';

local optionsData = {
	{
		type = 'header',
		name = 'Misc Settings',
		width = 'full',
	},
	{
		type = 'description',
		text = 'The following settings aren\'t availalbe in the standard game UI. They\'re either hidden or new and provided by this addon.',
		width = 'full',
	},
	{
		type = 'checkbox',
		name = 'Skip logos on game start',
		getFunc = function()
				return GetCVar('SkipPregameVideos') == '1'
			end,
		setFunc = function(value)
				if value then
					SetCVar('SkipPregameVideos', '1');
				else
					SetCVar('SkipPregameVideos', '0');
				end
			end,
		default = false,
	},
	{
		type = 'dropdown',
		name = 'Screenshot format',
		choices = {'PNG', 'BMP', 'JPG'},
		getFunc = function()
				return GetCVar('ScreenshotFormat.2')
			end,
		setFunc = function(value)
				SetCVar('ScreenshotFormat.2', value)
			end,
		width = 'full',
		default = 'PNG',
	},
	{
		type = 'dropdown',
		name = 'Rendering engine to be used',
		choices = {'DirectX 9', 'DirectX 11', 'OpenGL', 'Let the game decide'},
		getFunc = function()
				local v = GetCVar('GraphicsDriver.7')
				if v == 'D3D11' then
					return 'DirectX 11'
				elseif v == 'D3D9' then
					return 'DirectX 9'
				elseif v == 'OPENGL' then
					return 'OpenGL'
				else
					return 'Let the game decide'
				end
			end,
		setFunc = function(value)
				if value == 'DirectX 11' then
					SetCVar('GraphicsDriver.7', 'D3D11')
				elseif value == 'DirectX 9' then
					SetCVar('GraphicsDriver.7', 'D3D9')
				elseif value == 'OpenGL' then
					SetCVar('GraphicsDriver.7', 'OPENGL')
				else
					SetCVar('GraphicsDriver.7', '')
				end
			end,
		width = 'full',
		warning = restartRequired,
		default = '',
	},
	{
		type = 'description',
		title = 'Expand UI Memory',
		text = 'By default, ESO reserves 64 MB of RAM for addons and UI code. If you\'re using many complex addons you might actually run out of memory.',
		width = 'full',
	},
	{
		type = 'description',
		text = 'LUA UI memory limit',
		width = 'half',
	},
	{
		type = 'dropdown',
		--name = 'Lua UI Memory Limit',
		choices = {'64MB', '128MB', '256MB', '512MB'},
		getFunc = function()
				return GetCVar('LuaMemoryLimitMB') .. 'MB'
			end,
		setFunc = function(value)
				SetCVar('LuaMemoryLimitMB', value:gsub('MB', ''));
			end,
		default = '64MB',
		warning = 'Reserving too much memory for the game UI might have negative impact on your game performance. Only do so if you really have to.\n\n' .. restartRequired,
		width = 'half',
	}
}

----------------------------------------------------------------------------------------------------------

---------------------------------- Addon Initialization --------------------------------------------------

local function AddOnLoaded(eventID,addonName)
	if addonName == "ExpandedOptions" then
		EVENT_MANAGER:UnregisterForEvent("ExpandedOptions_Start",eventID)
		LAM2:RegisterAddonPanel("ExpandedOptionsOptions", panelData)
        LAM2:RegisterOptionControls("ExpandedOptionsOptions", optionsData)
		setupSavedVars()
		ExpandedOptionsWindow = WM:CreateTopLevelWindow("ExpandedOptions")
		ExpandedOptionsWindow:SetAnchorFill(GuiRoot)
		ExpandedOptionsWindow:SetDrawLayer(DL_BACKGROUND)
		ExpandedOptionsWindow:SetMouseEnabled(false)
		SLASH_COMMANDS["/eopt"] = function()
			if ExpandedOptionsWindow:IsHidden() then
				ExpandedOptionsWindow:SetHidden(false)
			else
				ExpandedOptionsWindow:SetHidden(true)
			end
		end
		createGrid()
		hideGrid()
	end
end

EVENT_MANAGER:RegisterForEvent("ExpandedOptions_Start",EVENT_ADD_ON_LOADED,AddOnLoaded)
Here are the contents of ExpandedOptions.txt
Code:
## Title: Expanded Options
## Description: Shows more options for tweaking ESO
## APIVersion: 100017
## Author: Crabby654
## Version: 1.0.0

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

ExpandedOptions.lua

; This Add-on is not created by, affiliated with or sponsored by ZeniMax
; Media Inc. or its affiliates. The Elder Scrolls® and related logos are
; registered trademarks or trademarks of ZeniMax Media Inc. in the United
; States and/or other countries. All rights reserved.
;
; You can read the full terms at:
; https://account.elderscrollsonline.com/add-on-terms

Last edited by Crabby654 : 12/15/16 at 03:26 PM.
  Reply With Quote