Page 1 of 1

Button in mod settings

Posted: Wed Dec 11, 2019 6:18 pm
by darkfrei
Hi devs!
Can you please to add button to runtime mod settings. It can be useful for reset some values, that this mod has collected.

Re: Button in mod settings

Posted: Wed Dec 11, 2019 6:43 pm
by Bilka
What?

Re: Button in mod settings

Posted: Wed Dec 11, 2019 7:22 pm
by darkfrei
Bilka wrote:
Wed Dec 11, 2019 6:43 pm
What?
For example my mod has seasons and the player wants to reset the season to default one. Just open mod settings and click on the "reset season" button for it.

Re: Button in mod settings

Posted: Wed Dec 11, 2019 7:59 pm
by Bilka
So this?
Image

Re: Button in mod settings

Posted: Wed Dec 11, 2019 8:23 pm
by darkfrei
Bilka wrote:
Wed Dec 11, 2019 7:59 pm
So this?
No, I don't want to reset settings, but I want some event, that can be called from mod settings, may be with the by the on_runtime_mod_setting_changed.

Another example - the players wants to reset evolution in the mod about custom evolution, but he cannot use just checkbox for it. If he clicks just the button, the event will be run and the script can change the evolution factor to 0.

Re: Button in mod settings

Posted: Wed Dec 11, 2019 8:33 pm
by Bilka
You want a button for mod functionality mixed in with the mod settings, do I understand correctly?

Re: Button in mod settings

Posted: Wed Dec 11, 2019 8:39 pm
by darkfrei
Bilka wrote:
Wed Dec 11, 2019 8:33 pm
You want a button for mod functionality mixed in with the mod settings, do I understand correctly?
Yes, but this button can be used for changing mod's state.
2019-12-11T21_34_06-Window.png
2019-12-11T21_34_06-Window.png (33.95 KiB) Viewed 4304 times
Suggested button for mod settings:
2019-12-11T21_34_06-Window_a.png
2019-12-11T21_34_06-Window_a.png (30.44 KiB) Viewed 4298 times

Re: Button in mod settings

Posted: Wed Dec 11, 2019 9:22 pm
by Rseding91
I don't quite understand what you want. It sounds like maybe you want a way to individually reset some setting(s) to their default instead of all settings?

Re: Button in mod settings

Posted: Thu Dec 12, 2019 7:11 am
by darkfrei
Rseding91 wrote:
Wed Dec 11, 2019 9:22 pm
I don't quite understand what you want. It sounds like maybe you want a way to individually reset some setting(s) to their default instead of all settings?
No, just interface for mod settings. If I want to set anything in the global to it's default value, then I can click the button n the mod interface. Right now I can do the same with the checkbox, but the checkbox has two options.
The suggested button must have only one position and the event will be triggered the same way as by the checkbox.

Re: Button in mod settings

Posted: Thu Dec 12, 2019 7:21 am
by darkfrei
I can write the mod "Always Day", where the player has the mod setting checkbox "always day for all surfaces enabled" = true.

The script checks all surfaces where surface.always_day is false, set them to true and adds the list of surfaces into the global table.

Another mod adds new surfaces, some of them have surface.always_day as true, some as false.

For updating I need to switch off the mod setting to false, then set it to true for handing all new added surfaces.

With such suggested buttons I can update the script manually, all new surfaces will be handled the same as before just click the button without disabling and enabling this mod setting.

Re: Button in mod settings

Posted: Thu Dec 12, 2019 3:52 pm
by Rseding91
In that example, the mod should be listening to the surface_created event and setting the always_day value to true/false depending on the mod setting.

Re: Button in mod settings

Posted: Thu Dec 12, 2019 4:42 pm
by PyroFire
Rseding91 wrote:
Wed Dec 11, 2019 9:22 pm
I don't quite understand what you want.
It sounds more like a macro button.

For example, in Randotorio i have a seed setting.
You can either enter the seed manually, or click this hypothetical settings-macro-button to give you a random seed.

+1

It also makes me think of having a thing that lets us select from "settings presets" that are author-configured settings.

example:
In Warptorio2, brutal difficulty is the *Only* difficulty and i'm wondering if there's an easy way to simplify having the options to finely-tune the difficulty or select from a preset.

Re: Button in mod settings

Posted: Thu Dec 12, 2019 5:59 pm
by darkfrei
Rseding91 wrote:
Thu Dec 12, 2019 3:52 pm
In that example, the mod should be listening to the surface_created event and setting the always_day value to true/false depending on the mod setting.
Yo are right. But with the button I can set the current surface to ignore list, or restart the script, for example if another mod needs surface without always_day changing.

Re: Button in mod settings

Posted: Thu Jan 23, 2020 8:24 am
by darkfrei
Next issue: mod settings button to delete LuaRendering lines.

See bug report: https://mods.factorio.com/mod/PlayerTra ... 000cc1823e

The user has changed the time to very small and some of lines got time_to_live less than 1 tick.
It would be nice to start the event, that removes all lines.

Re: Button in mod settings

Posted: Thu Jan 23, 2020 10:24 am
by Klonan
darkfrei wrote:
Thu Jan 23, 2020 8:24 am
Next issue: mod settings button to delete LuaRendering lines.

See bug report: https://mods.factorio.com/mod/PlayerTra ... 000cc1823e

The user has changed the time to very small and some of lines got time_to_live less than 1 tick.
It would be nice to start the event, that removes all lines.
You can add a console command, or something

Re: Button in mod settings

Posted: Thu Jan 23, 2020 11:26 am
by darkfrei
Klonan wrote:
Thu Jan 23, 2020 10:24 am
You can add a console command, or something
Yes, I can add console command, that disables achievements-with-mods; hotkey, that is normally never must be used; GUI, that close small part of view and normally must be not clicked; I can add migration and all lines by new version will be deleted; also I can this script to the event.on_configuration_changes.

Finally, I can add the checkbox to the mod settings and check if it was changed. Yes, I can use the check box as a button to raise the event for script starting, but not the button itself.

Re: Button in mod settings

Posted: Thu Jan 23, 2020 11:32 am
by Klonan
darkfrei wrote:
Thu Jan 23, 2020 11:26 am
Klonan wrote:
Thu Jan 23, 2020 10:24 am
You can add a console command, or something
Yes, I can add console command, that disables achievements-with-mods;
Mod commands don't disable achievements:
https://lua-api.factorio.com/latest/Lua ... essor.html

Re: Button in mod settings

Posted: Sun Apr 04, 2021 6:53 pm
by nastyslave
+1 to need that sort of buttons!

Re: Button in mod settings

Posted: Mon Apr 05, 2021 9:20 pm
by curiosity
nastyslave wrote:
Sun Apr 04, 2021 6:53 pm
+1 to need that sort of buttons!
No. Buttons that have nothing to do with settings have no place in settings. Add a button or a command in-game, where it belongs. Not in settings.