Working with user input

For some more complex cases, you might need to get user input to control how your patches are applied or change the values you’re using in your patches. For this reason, Sicario supports some basic input types that will be shown to users when they enable your mod in a build process.

Defining Inputs

Inputs need to be separately defined in a special _inputs key in your mod file:

{
    "_meta": {
        //trimmed for brevity
    },
    "_inputs": [
        {
            "id": "uniqueIdHere",
            "type": "number",
            "message": "This will be shown to users",
            "default": "5" // REQUIRED
        }
    ],
    "FilePatches": {
        //trimmed for brevity
    }
}

When the user enables a mod that defines inputs, Sicario will show a collection of input fields (grouped by mod) for the user to enter their own values. The message field is what will be shown to users, and you must define a default value or the input may not be shown or parsed correctly.

Using Inputs

Now that’s easy but where do those values go? They are available in any templated fields!

The id of your input is the important part as that will be how you access your input’s final value in the patch definition. For example, if we define this input:

"_inputs": [
    {
        "id": "customRollRate",
        "type": "number",
        "message": "Enter a turn rate",
        "default": "200" //note that this is always a string!
    }
]

We can then use the value from this input in a patch with a template, the special inputs object and the id of our input:

"ProjectWingman/Content/ProjectWingman/Blueprints/Data/AircraftData/DB_Aircraft.uexp": [
        {
            "name": "Stat Changes",
            "patches": [
                {
                    "description": "Set RollSpeed for all aircraft",
                    "template": "datatable:{'BaseStats*'}.{'RollSpeed*'}",
                    "value": "FloatProperty:{{inputs.customRollRate}}",
                    "type": "propertyValue"
                }
            ]
        }
    ]
}