Modding:Options: Difference between revisions
Kernelmethod (talk | contribs) m Improvements to the code examples |
Add beta content, update kernelmethod's mod link to gitlab |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category: | [[Category:Modding]] | ||
[[Category:Modding - Miscellanea]] | |||
{{Modding Info}}{{Modding Topic Prerequisites | Modding:C Sharp Scripting}} | {{Modding Info}}{{Modding Topic Prerequisites | Modding:C Sharp Scripting}} | ||
==Adding new options== | ==Adding new options== | ||
In some cases it may be desirable to add tunable settings to your mod | In some cases it may be desirable to add tunable settings to your mod so that players may configure it to their liking. In these cases, you can piggyback off of Qud's built in options menu by merging your own settings into <code>Options.xml</code>. | ||
Here's an example of a custom <code>Options.xml</code>: | Here's an example of a custom <code>Options.xml</code>: | ||
Line 76: | Line 77: | ||
=== Enabling and disabling XML === | === Enabling and disabling XML === | ||
{{Betamoddingcontent}} | |||
Options can be used to conditionally enable XML using the [[Modding:Mod_Configuration#Directory_Structure|Directories]] array in the mod's <code>manifest.json</code>. | |||
For a solution that works in the stable version of the game, check out the [https://gitlab.com/kernelmethod/qudmods/-/tree/main/SubmoduleManagement submodule-management] mod. | |||
==Type Errors== | |||
If <code>Options.xml</code> contains a syntax error, it will be listed in the <code>Player.log</code> as normal. However, type errors are only evaluated on opening the in-game options menu. The menu will fail to open and you'll see an error in the <code>Player.log</code>: <code>---> (Inner Exception #0) System.FormatException: Input string was not in a correct format.</code>. If you save the game without opening the options menu, this erroneous value will then be stored in <code>PlayerOptions.json</code> and, because those values are only regenerated on close of the options menu, you will need to manually edit and correct the file. | |||
{{Modding Navbox}} | {{Modding Navbox}} |