I'm probably going about this the wrong way, so I'm hoping for guidance as to what direction I should be pushing.
My addon is "Reforgenator". It has internal models for reforging that have a smidgeon of structure. Each model has a stack-rank list of attributes, and a set of rules for reforging stats up to some cap. The structure looks like
My current task is to expose this to editing in the config frame. I got a basic screen working with the layout defined in XML like so (lots of detail elided), which I then add to the Blizzard options panel via InterfaceOptions_AddCategory:
But when I extend this pattern to use the template for the reforging part, the window gets rather tall. Tall enough to not fit inside the options frame, so something else has to be done.
This is the only part of the options that isn't built by AceConfigDialog, and it's really been rather more hassle than I'd like. Can I recast this problem into something that could be built by AceConfigDialog? If not, is there a better scrolling solution than FauxScrollFrame?
I'm sure you could do this with xml, but I wouldn't do it that way. I'd do it all in Lua.
chatOutput = {
order = 40,
type = "select",
name = L["Chat Output Type"],
desc = L["Where to print the res message. Raid, Party, Say, Yell, Guild, smart Group, or None"],
values = {
["0-none"] = L["None"],
group = L["Group"],
guild = L["Guild"],
party = L["Party"],
raid = L["Raid"],
say = L["Say"],
whisper = L["Whisper"],
yell = L["Yell"]
},
get = function() return self.db.profile.chatOutput end,
set = function(info, value) self.db.profile.chatOutput = value end
},
Sorry for the horrid formatting, but the important parts you want are the type = "select" and the values = {}, and all this is done in AceConfig. For long lists, it conveniently provides a scroll button on the side.
First, thanks for responding. I appreciate your time and efforts in educating me. Second, let me state up front I'm trying to understand how to apply this guidance rather than arguing with it. If if sounds like I'm being difficult, then I'm just explaining my confusion badly.
I can see how to use this mechanism to manage lists of single objects, but I'm not entirely clear on how to use it for lists of repeating groups of more complex objects.
Assume there are four steps in the reforging process. Each step is described by two select boxes: one to select the attribute, and one to select the cap.
options.rule1 = {
type = 'group',
args = {
stat = {
type = 'select',
name = 'Stat',
values = {
"ITEM_MOD_HIT_RATING_SHORT" = _G["ITEM_MOD_HIT_RATING_SHORT"],
"ITEM_MOD_EXPERTISE_RATING_SHORT" = _G["ITEM_MOD_EXPERTISE_RATING_SHORT"],
...
},
get = function() ... end,
set = function() ... end,
},
cap = {
type = 'select',
name = 'Cap',
values = {
"MeleeHitCap",
"SoftExpertiseCap",
...
},
},
userdata = {
type = 'input',
name = 'Values',
},
}
}
Rule #2 looks just like this, as do rules #3 and #4. Do I need to copy out this table three more times? Or is there a mechanism for capturing the "repeat" nature in the options table?
And for the other component of a rule, there is an ordering of the eight reforgable attributes. My first thought, UI-in-XML-wise, was a label with two buttons for each stat, and then stack eight of them in a chunk so the user can click the up and down buttons to change the position of things in the stack; this would be somewhat like the sections in the flyout panel in the new character sheet where you can rearrange the order of "Melee", "Spell", "Ranged", "Defense", etc. Do you have any suggestions on how to implement that, or a different way to present it so it's possible in the constraints of the ACD options table?
Rule #2 looks just like this, as do rules #3 and #4. Do I need to copy out this table three more times? Or is there a mechanism for capturing the "repeat" nature in the options table?
Not inherently, but you can do things to help alleviate the maintenance burden. Two things off the top of my head, one easier, one more invasive:
First, write a generalized pair of get/set functions for that group of options. Set them in the group table entry (or even higher in the options tree if warranted). The first argument, typically called 'info', is a table that will tell you which option was clicked; you can use that to distinguish the unique bits of each option from the common parts.
Secondly, you might consider generating the options in a loop, something like this pseudocode:
local all_stats = { table of tables here, in some format easy for you to maintain }
local function rule_get (info)
local index = info[#info] -- will match 'i' below unless I've forgotten something
-- use all_stats[index] to retrieve data
end
local function rule_set (info, value)
-- similar to rule_get
end
options.rule = {
type = 'group',
args = {},
get = rule_get,
set = rule_set,
}
for i = 1, #all_stats do
options.rule.args[i] = {
type = 'select',
name = plucked out of all_stats[i],
values = plucked/generated out of all_stats[i],
order = i,
}
end
The design challenge in this scenario is carefully constructing 'all_stats' in some way that won't drive you batshiat insane over time. Properly done, adding new stats, new rules, new features, will involve less repetitiveness.
My addon is "Reforgenator". It has internal models for reforging that have a smidgeon of structure. Each model has a stack-rank list of attributes, and a set of rules for reforging stats up to some cap. The structure looks like
My current task is to expose this to editing in the config frame. I got a basic screen working with the layout defined in XML like so (lots of detail elided), which I then add to the Blizzard options panel via InterfaceOptions_AddCategory:
But when I extend this pattern to use the template for the reforging part, the window gets rather tall. Tall enough to not fit inside the options frame, so something else has to be done.
This is the only part of the options that isn't built by AceConfigDialog, and it's really been rather more hassle than I'd like. Can I recast this problem into something that could be built by AceConfigDialog? If not, is there a better scrolling solution than FauxScrollFrame?
Sorry for the horrid formatting, but the important parts you want are the type = "select" and the values = {}, and all this is done in AceConfig. For long lists, it conveniently provides a scroll button on the side.
I can see how to use this mechanism to manage lists of single objects, but I'm not entirely clear on how to use it for lists of repeating groups of more complex objects.
Assume there are four steps in the reforging process. Each step is described by two select boxes: one to select the attribute, and one to select the cap.
Rule #2 looks just like this, as do rules #3 and #4. Do I need to copy out this table three more times? Or is there a mechanism for capturing the "repeat" nature in the options table?
And for the other component of a rule, there is an ordering of the eight reforgable attributes. My first thought, UI-in-XML-wise, was a label with two buttons for each stat, and then stack eight of them in a chunk so the user can click the up and down buttons to change the position of things in the stack; this would be somewhat like the sections in the flyout panel in the new character sheet where you can rearrange the order of "Melee", "Spell", "Ranged", "Defense", etc. Do you have any suggestions on how to implement that, or a different way to present it so it's possible in the constraints of the ACD options table?
Not inherently, but you can do things to help alleviate the maintenance burden. Two things off the top of my head, one easier, one more invasive:
First, write a generalized pair of get/set functions for that group of options. Set them in the group table entry (or even higher in the options tree if warranted). The first argument, typically called 'info', is a table that will tell you which option was clicked; you can use that to distinguish the unique bits of each option from the common parts.
Secondly, you might consider generating the options in a loop, something like this pseudocode:
The design challenge in this scenario is carefully constructing 'all_stats' in some way that won't drive you batshiat insane over time. Properly done, adding new stats, new rules, new features, will involve less repetitiveness.
Then, write your get/set/validate/etc functions to use "info.handler" to determine which frame/savedvars-subtable/etc to operate on.