I have two numbers in my mod settings, one should be greater than the other - is it possible to set its minimum value to the value of the other one?
Alternatively, this is a runtime-per-player setting so I could check it in on_configuration_changed action and set it to a different value, however all the data I can see is read only. Is it possible to change player's mod setting with a script?
Dependency between mod settings
Re: Dependency between mod settings
Edit: My initial answer was wrong, in 0.17 it is possible to change mod settings (see below). Changing the limit is still impossible, as it is set at the data stage.
Last edited by eduran on Sat Apr 06, 2019 7:08 pm, edited 1 time in total.
Re: Dependency between mod settings
Thanks. I was already thinking that I can print a message to the player, but the idea of using different value internally is great. I will have to do some code refactoring, because currently I have calls to player.mod_settings all over the place 

Re: Dependency between mod settings
Actually, I was wrong. Apparently 0.17 added a way for mods to change their settings:
Code: Select all
settings.get_player_settings(player_index)[setting_name] = { value = new_value }
Re: Dependency between mod settings
Nice! Thanks a lot!
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Dependency between mod settings
I heard they were going to add this, but didn't see anything about it in the changelogseduran wrote: Sat Apr 06, 2019 7:07 pm Actually, I was wrong. Apparently 0.17 added a way for mods to change their settings:
Code: Select all
settings.get_player_settings(player_index)[setting_name] = { value = new_value }
does anyone know what version this was done in?
Re: Dependency between mod settings
0.17.0, it's in the scripting section of the changelog.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Dependency between mod settings
thanks
seems a bit of an odd way to do it though. why not do this?
Code: Select all
settings.get_player_settings(player_index)[setting_name].value = new_value
Re: Dependency between mod settings
That was my first idea, too. I could not make it work that way. So I posted the version that does work.
Probably just a stupid mistake in my test code
Probably just a stupid mistake in my test code
