718
edits
Kernelmethod (talk | contribs) (Add initial version of page with description of Options.xml) |
Kernelmethod (talk | contribs) (Add image of example settings; reorganize Options.xml attributes into a table) |
||
Line 1: | Line 1: | ||
[[Category:Modding]]{{Modding Info}} | [[Category:Script Modding]] | ||
{{Modding Info}}{{Modding Topic Prerequisites | Modding:C Sharp Scripting}} | |||
==Adding new options== | ==Adding new options== | ||
Line 16: | Line 17: | ||
</options> | </options> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
This produces a new section in the options menu, which appears as follows: | |||
[[Image:Modding-Options example.png|center|600px|alt=Example of custom settings added to the Options menu by a mod. This settings menu includes three new options: a checkbox for "Enable Foo", a combo selector for "Foo, Bar, or Baz?", and a slider labeled "Amount of foo to use".]] | |||
The <code><option>...</option></code> XML tag defines a new setting in <code>Options.xml</code>. This tag can have the following attributes: | The <code><option>...</option></code> XML tag defines a new setting in <code>Options.xml</code>. This tag can have the following attributes: | ||
{| class="wikitable" style="min-width: 50%;" | |||
! Tag | |||
! Meaning | |||
|- | |||
| <code>ID</code> | |||
| A unique ID corresponding to the option. This ID is referred to in the code when retrieving the value of the configured setting. | |||
|- | |||
| <code>DisplayText</code> | |||
| The text that should be displayed alongside the option in the settings menu. | |||
|- | |||
| <code>Category</code> | |||
| The area under which the option appears in the settings menu. In general, all of your options should go under a single custom category for your mod. | |||
|- | |||
| <code>Type</code> | |||
| Affects the widget that is rendered for the option, and the values that it can take on. There are multiple types available, including <code>Checkbox</code>, <code>Slider</code>, <code>Button</code>, <code>Combo</code>, and <code>BigCombo</code>. Each of these types has custom attributes that are specific to them; refer to the base game's <code>Options.xml</code> for a reference. | |||
|- | |||
| <code>Default</code> | |||
| The default value that the option should be set to, before any user configuration. | |||
|- | |||
| <code>SearchKeywords</code> | |||
| Additional keywords that players can use to find an option in the settings menu. | |||
|} | |||
==Using configured options in code== | ==Using configured options in code== | ||
{{Modding Navbox}} |