Thread Tools Display Modes
04-19-10, 03:27 PM   #1
upyursh
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 32
AceConfig (Ace3)

Hi all,

another question, this time with AceConfig
I have gotten my addon working pretty well I'm just having some issues with my Configs.

I have my default db setup as follows;

Code:
-- Defaults
local ProEmote_defaults = {
	global = {
		enabled = true,
		Emotes = {
			["hi5"] = {
				["slash"] = "hi5",
				["self"] = "runs around giving everyone a high five",
				["target"] = "holds his hand up for %t to high five",
			},
			["qq"] = {
				["slash"] = "qq",
				["self"] = "mumbles some random qq to himself about fail mages",
				["target"] = "nudges %t and grumbles about his failure",
			},
		}
	}
}
and I have my options setup as;

Code:
local ProEmote_options = {
	type = "group",
	name = "ProEmote",
	args = {
		basicDesc = {
			order = 1,
			type = 'description',
			name = "ProEmote allows you to build your own emotes that can be accessed via user defined slash commands",
		},
		general = {
			type="group",
			name= "General",
			order = 10,
			args={
				enable = {
					type = "toggle",
					name = "Enable",
					desc = "Enable ProEmote",
					width = "full",
					order = 10,
					get = function()
						if (addon.db.profile.enabled == false) then
							return false
						else
							return true
						end
					end,
					set = function(info, v)
						if v then
							addon.db.profile.enabled=v
							print("|cffff0000ProEmote:|r You will need to restart your user interface, use the provided button");
						else
							addon.db.profile.enabled=false
						end
					end,
				},
				spacing1 = {
					order = 20,
					type = 'description',
					name = " ",
				},
				spacing2 = {
					order = 21,
					type = 'description',
					name = " ",
				},
				spacing3 = {
					order = 22,
					type = 'description',
					name = " ",
				},
				reloadUI = {
					type = "execute",
					name = "Reload your UI",
					desc = "Reload your UI",
					order = 30,
					func = 	function()
								ReloadUI();
					end,
				},
			},
		},
		emotes = {
			type="group",
			name= "Emotes",
			order = 20,
			args={
				description = {
					type = "description",
					order = 10,
					name = "Click New Emote or an existing Emote to Manage"
				},
				newemote = {
					type="group",
					name= "New Emote",
					order = 1,
					args = {
						slash = {
							type = "input",
							order = 2,	
							width = "full",					
							name = "slash",
							desc = "Slash Command",
							set = function(_, v)
								addon.db.global.Emotes.v = { slash = v, self = "", target = "", }
							end,					
						},
					},
				},
                                --[[ This is where i want the dynamic list but for now i've hard coded --]]
				hi5 = {
					type = "group",
					name = "hi5",
					args = {
						slash = {
							type = "input",
							order = 1,	
							width = "full",					
							name = "slash",
							desc = "Slash Command",
							get = function() return addon.db.global.Emotes.hi5.slash end,
							set = function(_, v)
								addon.db.global.Emotes.hi5.slash = v
							end,					
						},
						self = {
							type = "input",
							order = 3,	
							width = "full",					
							name = "self",
							desc = "Message if not target",
							get = function() return addon.db.global.Emotes.hi5.self end,
							set = function(_, v)
								addon.db.global.Emotes.hi5.self = v
							end,					
						},
						target = {
							type = "input",
							order = 2,	
							width = "full",					
							name = "target",
							desc = "Message if a terget is selected (use %t as target replacement)",
							get = function() return addon.db.global.Emotes.hi5.target end,
							set = function(_, v)
								addon.db.global.Emotes.hi5.target = v
							end,					
						},
					},
				},
				qq = {
					type = "group",
					name = "qq",
					args = {
						slash = {
							type = "input",
							order = 1,	
							width = "full",					
							name = "slash",
							desc = "Slash Command",
							get = function() return addon.db.global.Emotes.qq.slash end,
							set = function(_, v)
								addon.db.global.Emotes.qq.slash = v
							end,					
						},
						self = {
							type = "input",
							order = 3,	
							width = "full",					
							name = "self",
							desc = "Message if not target",
							get = function() return addon.db.global.Emotes.qq.self end,
							set = function(_, v)
								addon.db.global.Emotes.qq.self = v
							end,					
						},
						target = {
							type = "input",
							order = 2,	
							width = "full",					
							name = "target",
							desc = "Message if a terget is selected (use %t as target replacement)",
							get = function() return addon.db.global.Emotes.qq.target end,
							set = function(_, v)
								addon.db.global.Emotes.qq.target = v
							end,					
						},
					},
				},
				hi10 = {
					type = "group",
					name = "hi10",
					args = {
						slash = {
							type = "input",
							order = 1,	
							width = "full",					
							name = "slash",
							desc = "Slash Command",
							get = function()
								if (addon.db.global.Emotes.hi10.slash ~= nil) then
									return addon.db.global.Emotes.hi10.slash
								end
							end,
							set = function(_, v)
								addon.db.global.Emotes.hi10.slash = v
							end,					
						},
						self = {
							type = "input",
							order = 3,	
							width = "full",					
							name = "self",
							desc = "Message if not target",
							get = function()
								if (addon.db.global.Emotes.hi10.self ~= nil) then
									return addon.db.global.Emotes.hi10.self
								end
							end,
							set = function(_, v)
								addon.db.global.Emotes.hi10.self = v
							end,					
						},
						target = {
							type = "input",
							order = 2,	
							width = "full",					
							name = "target",
							desc = "Message if a terget is selected (use %t as target replacement)",
							get = function()
								if (addon.db.global.Emotes.hi10.target ~= nil) then
									return addon.db.global.Emotes.hi10.target
								end
							end,
							set = function(_, v)
								addon.db.global.Emotes.hi10.target = v
							end,					
						},
					},
				},
			},
		},
	}	
}
My issues are;
1. Get the List of emotes dynamically and add it to the "Emotes" options group

2. How do I update the options table so the new emote appears there to select

What I would like is an adding a new slash command the options group get updated with the new one so it can be managed.

Thanks for your help

Upy

Last edited by upyursh : 04-19-10 at 03:30 PM.
  Reply With Quote
04-19-10, 10:40 PM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Look at how I handle the options in TabAlerts - you can use my general methodology to inject your emotes table into the config display.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
04-20-10, 07:33 AM   #3
upyursh
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 32
thanks mate ill have a look tonight

/cheer
  Reply With Quote
04-20-10, 10:40 PM   #4
upyursh
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 32
ok so I have it dynamically grabbing my emotes now, only thing that isnt working is when I add a new emote my options are not updating accordingly.

Is there a function to do this? do you want me to paste my entire lua file?

Thanks again

Upy
  Reply With Quote
04-20-10, 10:43 PM   #5
upyursh
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 32
Dont worry I gots it, had to recall the function that was building the listing
  Reply With Quote
04-21-10, 03:56 AM   #6
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Glad to hear it!
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » AceConfig (Ace3)


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