An Aku'mai Servant
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.
|