Keeping mod settings and mod setting descriptions in sync

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Keeping mod settings and mod setting descriptions in sync

Post by Pi-C »

First, I want to wish a happy new year to everybody! :-)

I've found a problem with settings of a mod I've just installed. Here's the settings definition:

Code: Select all

    {
        type = "int-setting",
        name = "central-rails-rail-count",
        setting_type = "runtime-global",
        default_value = 2,
        minimum_value = 1,
        maximum_value = 10,
        order="hamster1"
    },
This is the matching description:

Code: Select all

-- Locale file
[mod-setting-description]
central-rails-rail-count=How many rails per side to install. Defaults to 1.
As you can see, the description ("Defaults to 1") doesn't fit the real default_value. These things happen if you change values in one file, but then forget to update the description as well -- I've been guilty of this myself previously. I think it would be useful if things like default, minimum, and maximum value of a setting would be accessible within the locale files, so that the values in the description would always be in sync with the actually allowed settings, something like:

Code: Select all

[mod-setting-description]
central-rails-rail-count=How many rails per side to install. Defaults to __MOD_SETTINGS_MAP__central-rails-rail-count__default_value__.
As far as I can see, it isn't possible to do this yet. Could you implement such a feature, please?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Keeping mod settings and mod setting descriptions in sync

Post by eradicator »

I'd prefer having a tooltip stating default/min/max/etc on every mod setting value element (text field, listbox, checkbox) generated automatically.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Keeping mod settings and mod setting descriptions in sync

Post by Honktown »

eradicator wrote:
Thu Jan 02, 2020 3:02 pm
I'd prefer having a tooltip stating default/min/max/etc on every mod setting value element (text field, listbox, checkbox) generated automatically.
Minimum and maximum are there in numerical boxes... only if you enter a value outside of the range (the box goes red). Sadly no default value anywhere.
I have mods! I guess!
Link

Rseding91
Factorio Staff
Factorio Staff
Posts: 13210
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Keeping mod settings and mod setting descriptions in sync

Post by Rseding91 »

I could add a setting to mod settings that makes them show defaults/values/ranges in the tooltip along with the description.

Would that address this?
If you want to get ahold of me I'm almost always on Discord.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Keeping mod settings and mod setting descriptions in sync

Post by Pi-C »

Rseding91 wrote:
Wed Feb 26, 2020 4:22 pm
I could add a setting to mod settings that makes them show defaults/values/ranges in the tooltip along with the description.

Would that address this?
It sounds like it would. :-)

A bit off-topic, I just noticed that in modsettings, there is a scrollbar for start-up and per-player settings, but not for map settings. The list of map settings does fill more than fits on the screen, and I can use the mouse wheel to scroll down the list, but it looks strange that the scrollbar is missing. Should I file a separate bug for that?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Keeping mod settings and mod setting descriptions in sync

Post by Optera »

Could we also have a way to read default, min and max values during data stage?
For example I'd like to only change a stack size to setting.value when setting.default_value == item.stack_size.

Probably should start a new post for this.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13210
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Keeping mod settings and mod setting descriptions in sync

Post by Rseding91 »

Optera wrote:
Wed Feb 26, 2020 4:39 pm
Could we also have a way to read default, min and max values during data stage?
For example I'd like to only change a stack size to setting.value when setting.default_value == item.stack_size.

Probably should start a new post for this.
No, that's exactly what can never be done because it's a cyclic dependency.

data stage is defined using mod settings. Now you want mod settings defined using data stage. It just doesn't work :)


Nevermind that, I miss-read what you asked for.
If you want to get ahold of me I'm almost always on Discord.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13210
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Keeping mod settings and mod setting descriptions in sync

Post by Rseding91 »

Pi-C wrote:
Wed Feb 26, 2020 4:35 pm
Rseding91 wrote:
Wed Feb 26, 2020 4:22 pm
I could add a setting to mod settings that makes them show defaults/values/ranges in the tooltip along with the description.

Would that address this?
It sounds like it would. :-)

A bit off-topic, I just noticed that in modsettings, there is a scrollbar for start-up and per-player settings, but not for map settings. The list of map settings does fill more than fits on the screen, and I can use the mouse wheel to scroll down the list, but it looks strange that the scrollbar is missing. Should I file a separate bug for that?
You mean this one? viewtopic.php?f=11&t=74891

It might be resolved in the next release. If you have a save with mods to reproduce it and it still happens in the next release then yes make a new report.
If you want to get ahold of me I'm almost always on Discord.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Keeping mod settings and mod setting descriptions in sync

Post by Pi-C »

Rseding91 wrote:
Wed Feb 26, 2020 5:12 pm
Pi-C wrote:
Wed Feb 26, 2020 4:35 pm
A bit off-topic, I just noticed that in modsettings, there is a scrollbar for start-up and per-player settings, but not for map settings. The list of map settings does fill more than fits on the screen, and I can use the mouse wheel to scroll down the list, but it looks strange that the scrollbar is missing. Should I file a separate bug for that?
You mean this one? viewtopic.php?f=11&t=74891
I see more or less the same thing, but in my case, it is the map settings where the scrollbar is missing, while the startup settings are OK.
It might be resolved in the next release. If you have a save with mods to reproduce it and it still happens in the next release then yes make a new report.
I got the save file from somebody who reported a crash in one of my mods. I'll try to reproduce it later with my own game, but I guess I'd get permission to forward the original file if necessary.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding interface requests”