Ah. Well I've updated the main post with correct informationsparr wrote:Artifact of people trying to follow the original not-really-documentation from this thread, and a bunch of examples based on that.Rseding91 wrote:Where did "per_user" come from? It's not used in any context when it comes to mod settings.
[0.15] Mod setting/config interface - give your input
Re: [0.15] Mod setting/config interface - give your input
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
Here's my big thanks to those who reverse engineered Factorio so we can implement mod settings before the official doc is ready.
And thank you Rseding for implementing this amazing setting system and the official doc.
So far so good. That 4 types of settings are very useful. I believe we can leave the other advanced types like item-setting, color-setting, list-setting for the future.
It would be more handy if int-setting and double-setting display a slider when minimum_value and maximum_value are defined but not allowed_values.
If it is implemented, please also consider an option for making the slider non-linear (something like the slider of logistic request item count).
And thank you Rseding for implementing this amazing setting system and the official doc.
So far so good. That 4 types of settings are very useful. I believe we can leave the other advanced types like item-setting, color-setting, list-setting for the future.
It would be more handy if int-setting and double-setting display a slider when minimum_value and maximum_value are defined but not allowed_values.
If it is implemented, please also consider an option for making the slider non-linear (something like the slider of logistic request item count).
Re: [0.15] Mod setting/config interface - give your input
Thanks to all posters here for explanations and examples - RSO will be getting bunch of settings based on this.
I would also like to propose a dummy setting - I'd like to have a short warning displayed around some of settings. It would be good to have a setting without value that we could simply add and position with order sort.
I would also like to propose a dummy setting - I'd like to have a short warning displayed around some of settings. It would be good to have a setting without value that we could simply add and position with order sort.
Re: [0.15] Mod setting/config interface - give your input
Settings can have descriptions (tooltips) so you can easily set those up. They will display when you hover over the setting name in the GUI.orzelek wrote:Thanks to all posters here for explanations and examples - RSO will be getting bunch of settings based on this.
I would also like to propose a dummy setting - I'd like to have a short warning displayed around some of settings. It would be good to have a setting without value that we could simply add and position with order sort.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
I did use those. I'm still expecting bug reports based on general rule that users don't read all the stuff just skim over itRseding91 wrote:Settings can have descriptions (tooltips) so you can easily set those up. They will display when you hover over the setting name in the GUI.orzelek wrote:Thanks to all posters here for explanations and examples - RSO will be getting bunch of settings based on this.
I would also like to propose a dummy setting - I'd like to have a short warning displayed around some of settings. It would be good to have a setting without value that we could simply add and position with order sort.
Idea was to have warning directly on list not on mouse over.
I added also direct print in game after setting change and I'm hoping it will be enough.
Re: [0.15] Mod setting/config interface - give your input
wouldn't be a bad idea, I already have "bug" reports from users who didn't manually reset the mod settings.orzelek wrote:I did use those. I'm still expecting bug reports based on general rule that users don't read all the stuff just skim over itRseding91 wrote:Settings can have descriptions (tooltips) so you can easily set those up. They will display when you hover over the setting name in the GUI.orzelek wrote:Thanks to all posters here for explanations and examples - RSO will be getting bunch of settings based on this.
I would also like to propose a dummy setting - I'd like to have a short warning displayed around some of settings. It would be good to have a setting without value that we could simply add and position with order sort.
Idea was to have warning directly on list not on mouse over.
I added also direct print in game after setting change and I'm hoping it will be enough.
My Mods: mods.factorio.com
Re: [0.15] Mod setting/config interface - give your input
What purpose do these serve?Rseding91 wrote:
- localised_name (localised string, optional)
- localised_description (localised string, optional)
Shouldn't they be in locale/{language}/locale.cfg? Otherwise you can only do a single language...or is that outdated doc?
Time to poke about some mods that make use of settings.lua.
[edit]
Seems to be outdated.
Sample settings.lua
Code: Select all
data:extend({
{
name = "my-setting-name",
type = "bool-setting",
setting_type = "runtime-per-user",
default_value = true,
},
})
Code: Select all
[mod-setting-name]
my-setting-name=Localized setting name
[mod-setting-description]
my-setting-name=Localized setting description
Re: [0.15] Mod setting/config interface - give your input
It's if you want to explicitly override the localized name or description, or you want to use some other key than [mod-setting-name/description].setting-name.
You could for example use the same l10n string for an item/recipe/whatever and the setting.
You could for example use the same l10n string for an item/recipe/whatever and the setting.
Re: [0.15] Mod setting/config interface - give your input
I mostly need localised_name when populating data.raw with a script.
Setting different ore richness for any ore added by mods would be a possible scenario.
Setting different ore richness for any ore added by mods would be a possible scenario.
My Mods: mods.factorio.com
Re: [0.15] Mod setting/config interface - give your input
folk wrote:It's if you want to explicitly override the localized name or description, or you want to use some other key than [mod-setting-name/description].setting-name.
You could for example use the same l10n string for an item/recipe/whatever and the setting.
Ah...That makes sense. Thanks you two!Optera wrote:I mostly need localised_name when populating data.raw with a script.
Setting different ore richness for any ore added by mods would be a possible scenario.
Re: [0.15] Mod setting/config interface - give your input
Did I miss something or we can't have a multiple choice combo box setting (string or int type) with localized values?
Factorio Mod Portal Notifier - https://fac-notify.ml/
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Re: [0.15] Mod setting/config interface - give your input
No localized values for multiple choice combo, unfortunately.
Also like orzelek and others I would like to have a way to put up just explanatory text. In my case I'm not using a mouseover box because I want to include a link to an image gallery. Instead I plan on using a string input with a single allowed value that just says "Ok!" or something.
Also like orzelek and others I would like to have a way to put up just explanatory text. In my case I'm not using a mouseover box because I want to include a link to an image gallery. Instead I plan on using a string input with a single allowed value that just says "Ok!" or something.
Re: [0.15] Mod setting/config interface - give your input
Can we perhaps get a setting for string-setting that ensures whitespace is trimmed from the input?
Trim obviously means start and end, so " test " would become "test".
It might be useful to have the ability to set a validate function on the setting, like
Or similar. Obviously the example given above is only for demonstration.
It could also just be a string property like allowed_pattern="%S" that the engine matches towards given input before accepting it. Or forbidden_pattern=. Or both.
http://www.lua.org/manual/5.2/manual.html#6.4.1
Alternatively, allow mods to manipulate LuaSettings to fix any weird input that should not be allowed. This might be possible already? I haven't tried.
Would it be possible for settings.get_player_settings(p)[setting].value to be nil for empty string-settings? It's more efficient for us to check |if setting then| than |if setting and setting:len() ~= 0 then|. Not really important.
Trim obviously means start and end, so " test " would become "test".
It might be useful to have the ability to set a validate function on the setting, like
Code: Select all
{
type = "string-setting",
name = "folk-shuttle-ignore-stations",
setting_type = "runtime-per-user",
default_value = "",
allow_blank = true,
validate = function(input)
return not input:find("%s")
end,
}
It could also just be a string property like allowed_pattern="%S" that the engine matches towards given input before accepting it. Or forbidden_pattern=. Or both.
http://www.lua.org/manual/5.2/manual.html#6.4.1
Alternatively, allow mods to manipulate LuaSettings to fix any weird input that should not be allowed. This might be possible already? I haven't tried.
Would it be possible for settings.get_player_settings(p)[setting].value to be nil for empty string-settings? It's more efficient for us to check |if setting then| than |if setting and setting:len() ~= 0 then|. Not really important.
Re: [0.15] Mod setting/config interface - give your input
I'll add support to localize each dropdown option as well as support to auto-trim manual strings.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
I love this idea. It is so much more flexible than just having a list. Brainstorm ideas that would use this:folk wrote:Code: Select all
validate = function(input) return not input:find("%s") end,
input with no spaces
input that is a valid filename
input that is the name of an item / technology (until we get a data picker input type)
input that is 4-8 characters long
input that is a checksum-valid credit card number (ha!)
-
- Filter Inserter
- Posts: 302
- Joined: Fri Mar 18, 2016 4:34 pm
- Contact:
Re: [0.15] Mod setting/config interface - give your input
A color setting type would be useful, with a color-picker GUI and returning the {r,g,b,a} table (or just {r,g,b}?).
Re: [0.15] Mod setting/config interface - give your input
Until then, for https://mods.factorio.com/mods/folk/folk-colorequipment I just allow inputs of comma-separated rgb hex values, which allows easy copying from sources like https://www.materialui.co/flatuicolors (expand the sidebar, click a color to copy to clipboard at least on linux).justarandomgeek wrote:A color setting type would be useful, with a color-picker GUI and returning the {r,g,b,a} table (or just {r,g,b}?).
data.lua: https://hastebin.com/yakulajata.lua
control.lua: https://hastebin.com/ojalozaned.lua
parse.lua: https://hastebin.com/taruvuxeba.lua
I've not fuzzed the rgb-hex parser or even tested it extensively to make sure it doesn't break on weird input, but it seems to do alright.
I don't know if inputting "HTML" color codes is easier than 0-1 - or whatever else - for normal people, but I prefer it.
-
- Filter Inserter
- Posts: 302
- Joined: Fri Mar 18, 2016 4:34 pm
- Contact:
Re: [0.15] Mod setting/config interface - give your input
I (obviously) opted for the clunkier but more-data-pure choice of using four doubles with names suffixed -r,-g,-b,-a for each color setting. I should probably go back and properly limit them to 0-1 though...folk wrote:Until then, for https://mods.factorio.com/mods/folk/folk-colorequipment I just allow inputs of comma-separated rgb hex values, which allows easy copying from sources like https://www.materialui.co/flatuicolors (expand the sidebar, click a color to copy to clipboard at least on linux).justarandomgeek wrote:A color setting type would be useful, with a color-picker GUI and returning the {r,g,b,a} table (or just {r,g,b}?).
data.lua: https://hastebin.com/yakulajata.lua
control.lua: https://hastebin.com/ojalozaned.lua
parse.lua: https://hastebin.com/taruvuxeba.lua
I've not fuzzed the rgb-hex parser or even tested it extensively to make sure it doesn't break on weird input, but it seems to do alright.
I don't know if inputting "HTML" color codes is easier than 0-1 - or whatever else - for normal people, but I prefer it.
Re: [0.15] Mod setting/config interface - give your input
I'm definitely going to be adding more mod setting types once this initial wave of 0.15 bugs is taken care of. Probably another 2 weeks and then I'll start on stuff like this.
Right now setting types I'm going to add are:
Right now setting types I'm going to add are:
- Prototype picker (any prototype type) - which will simply give the string prototype name but the GUI will have a drop-down of all options
- Color picker (similar to the train one but with alpha as well)
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15] Mod setting/config interface - give your input
How about a signal picker?Rseding91 wrote:Prototype picker (any prototype type) - which will simply give the string prototype name but the GUI will have a drop-down of all options