Content Patcher

Content Patcher

378k Downloads

[Content Patcher] Document additional config input types

WoosterUK opened this issue ยท 2 comments

commented

The GMCM hook-in was updated in 2021 to allow for numeric and text input (#602), but the documentation page does not appear to give examples. Reading the underlying code does not give a clear indication of how a mod author should set up a config schema to allow for these input types.

commented

So I did a bit more careful reading of the commit and managed to make an educated guess that the following would work, which it does:

"SliderTest": {
    "AllowValues": "0,1,2,3,4,5,6,7,8,9,10",
    "Default": 5
}

This produces a slides with allowed values from 0 to 10, with a default of 5.

It transpires that the allowed values have to be integers, and every single integer between the lowest and highest values has to be listed, for Content Patcher to recognise a valid range for a slider.

To get free text input, you give no allowed values, and specify any default you like:

"TextTest": {
    "Default": "freetext"
}
commented

Hi! Content Patcher's philosophy is that your ConfigSchema should match how your mod works, and the config UI that's built for it is an implementation detail that's subject to change.

For example, you might use a sequence of consecutive integers because that makes sense for your mod (not because it produces a particular UI in the config menu). Content Patcher will create a slider automatically in the UI currently, but maybe a future version will decide a dropdown works better if there's only a few values.

So with that philosophy, documenting all the rules for how it represents your ConfigSchema in the UI is harmful because you shouldn't be changing your ConfigSchema to fit the UI, and that could lead to breaking expectations when those rules change.

So I'll close this as won't fix since the specific rules are undocumented by design, but thanks for the suggestion!