Apologies if this is covered somewhere but I have not been able to find it.
Basically I just want an example of how to do a dropdown style setting. I.e. a setting where the user can only pick from a predefined list.
A list of key-value pairs would be best, but a list of strings would also suffice.
So far I have only found examples of boolean and double settings.
Settings.lua dropdown example
Re: Settings.lua dropdown example
This example is from Logistic Train Network:
Greetings, steinio.
Code: Select all
{
type = "string-setting",
name = "ltn-interface-log-level",
order = "aa",
setting_type = "runtime-global",
default_value = "2: notifications",
allowed_values = {"0: off", "1: errors", "2: notifications", "3: expanded scheduler messages", "4: debug"}
}
Re: Settings.lua dropdown example
Awesome, thanks! These help a lot.
Re: Settings.lua dropdown example
http://lua-api.factorio.com/latest/LuaSettings.html does not indicate anything, but is it possible to add hover-over / help tooltips?
I.e. when the player hovers over the setting, can I display text that explains it better?
Also, even better, can I do similar help text per option in the setting dropdown?
I.e. when the player hovers over the setting, can I display text that explains it better?
Also, even better, can I do similar help text per option in the setting dropdown?
Re: Settings.lua dropdown example
This is possible by adding it in the locale.cfg fileUberWaffe wrote:http://lua-api.factorio.com/latest/LuaSettings.html does not indicate anything, but is it possible to add hover-over / help tooltips?
I.e. when the player hovers over the setting, can I display text that explains it better?
Also, even better, can I do similar help text per option in the setting dropdown?
[mod-setting-description]
my-setting-name=What I want to say
Re: Settings.lua dropdown example
@Nexela: Ah, thanks! That will be perfect.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Settings.lua dropdown example
I remember when I first started using it, I didn't have a clue what I was doing here.
I basically managed to piece everything I needed together from this post:
viewtopic.php?f=34&t=32890&start=40#p258222
I basically managed to piece everything I needed together from this post:
viewtopic.php?f=34&t=32890&start=40#p258222
Re: Settings.lua dropdown example
By the way, I updated the first post on that: viewtopic.php?f=34&t=32890bobingabout wrote:I remember when I first started using it, I didn't have a clue what I was doing here.
I basically managed to piece everything I needed together from this post:
viewtopic.php?f=34&t=32890&start=40#p258222
If you want to get ahold of me I'm almost always on Discord.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Settings.lua dropdown example
I noticed after I posted.Rseding91 wrote:By the way, I updated the first post on that
It was a bit of a struggle back on day 1, I didn't even know you could use order tags, and all my settings have that un-needed per_user option because that's what all the examples I was looking at had.