Page 1 of 1

Is there any way for the data stage to effect the settings stage?

Posted: Sat Mar 19, 2022 10:23 am
by Mernom
I want to modify my setting's localised description, to show certain values that will be useful for the player to define their settings (since the effect depends on the length of the longest technology dependency chain).
But the data.raw table is not accessible, and the setting itself only provides the value during the data stage, and no global variables are shared between them. Is there nothing I can do for this?

Re: Is there any way for the data stage to effect the settings stage?

Posted: Thu Mar 24, 2022 3:27 pm
by Rseding91
No. The reason is: Data stage is defined based off the values of the settings stage. If the settings stage could be defined based off the values of the data stage it would be an infinite loop.

Re: Is there any way for the data stage to effect the settings stage?

Posted: Mon Mar 28, 2022 3:23 pm
by darkfrei
Rseding91 wrote:
Thu Mar 24, 2022 3:27 pm
No. The reason is: Data stage is defined based off the values of the settings stage. If the settings stage could be defined based off the values of the data stage it would be an infinite loop.
Must be something like (but never will be implemented)
data-pre-settings
settings
data
data-updates
data-final-fixes?

Re: Is there any way for the data stage to effect the settings stage?

Posted: Tue Mar 29, 2022 10:31 am
by KiwiHawk
Rseding91 wrote:
Thu Mar 24, 2022 3:27 pm
No. The reason is: Data stage is defined based off the values of the settings stage. If the settings stage could be defined based off the values of the data stage it would be an infinite loop.
This makes sense for startup settings. Not so much for map and player settings. Ideal would be if map and player settings could be modified in data stage. No need for new stages!

Re: Is there any way for the data stage to effect the settings stage?

Posted: Tue Mar 29, 2022 9:36 pm
by ickputzdirwech
On a related note: I would really like to be able to conditionally create runtime settings based on the value of a startup setting.

My use case is a startup setting that enables a feature and multiple runtime settings to “fine tune” it. It really makes no sense having the runtime settings available if the startup setting is disabled but afaik there is now way around it at the moment.

And just wanted to add that there is already settings-updates and settings-final-fixes. Incase you want to modify the settings of another mod.

Re: Is there any way for the data stage to effect the settings stage?

Posted: Tue Mar 29, 2022 10:21 pm
by KiwiHawk
ickputzdirwech wrote:
Tue Mar 29, 2022 9:36 pm
On a related note: I would really like to be able to conditionally create runtime settings based on the value of a startup setting.
Map and player settings being modifiable in data stage would allow this.

Re: Is there any way for the data stage to effect the settings stage?

Posted: Wed Mar 30, 2022 7:19 am
by darkfrei
My question was: Why we have data.raw? I mean, why not just data? And why not settings.raw or data.settings?

Re: Is there any way for the data stage to effect the settings stage?

Posted: Wed Mar 30, 2022 7:37 am
by Pi-C
darkfrei wrote:
Wed Mar 30, 2022 7:19 am
My question was: Why we have data.raw? I mean, why not just data? And why not settings.raw or data.settings?

Code: Select all

for k, v in pairs(data) do
        log("k: "..k.."\tv: "..tostring(v))
end
will show:

Code: Select all

k: raw	v: table
k: is_demo	v: false
k: extend	v: function

Re: Is there any way for the data stage to effect the settings stage?

Posted: Wed Mar 30, 2022 11:11 am
by robot256
ickputzdirwech wrote:
Tue Mar 29, 2022 9:36 pm
On a related note: I would really like to be able to conditionally create runtime settings based on the value of a startup setting.
Not saying it won't work, just a thought. Procedurally generated setting names means having to detect what settings exist at runtime. It also means that if you change mods and load the game when that setting isn't created, it will be deleted from the settings file. When you change back and it is created again, you will have to set it again (unless you are loading a save file). For this reason, I try to set hidden=true rather than not create a setting at all, when the names are constant. It also avoids crashing code (often in other mods) that expects a particular setting to exist.

Re: Is there any way for the data stage to effect the settings stage?

Posted: Sun Apr 10, 2022 5:30 pm
by Mernom
For my purposes, I only need the setting's `localised_name` and/or `localised_description` to be accessible during data.