Plugins can save settings in the Openplanet settings file, which can then be edited from within Openplanet's settings window. To define a setting, all you have to do is create a global variable and add a
Setting metadata line to it.
[Setting name="Something"] bool Setting_Something;
The following types are supported:
- Any enum
Settings can have default values. When they are not user-defined, the setting will be the default value, which is specified by the initial global variable value. The user can also choose to reset every setting back to its default value within Openplanet's settings dialog.
[Setting name="Amount"] int Setting_Amount = 10;
Note that settings that are set to their default value will not be saved in the settings. That means that if you change your default value, people who were previously on that default value will now also have your changed value.
Setting metadata supports a number of attributes depending on which type your setting variable is. All attributes are optional, however. The following attributes are supported for every type:
||The name displayed in the settings dialog.|
||The description displayed in the settings dialog, as a little question mark icon next to the setting with a tooltip.|
||The category for the setting. This will automatically create multiple tabs, where each category is its own tab.|
||Takes no value. Marks the setting so it will not be displayed in the Openplanet settings dialog.|
A few types allow a couple more attributes:
||The minimum possible value. When combined with
||The maximum possible value. When combined with
||Whether to make this a draggable setting rather than where the user must type the value.|
||Whether this is a color setting. Includes a color picker.|
||The maximum possible length of the string.|
||Takes no value. Marks this string as being a multiline input field.|
||Takes no value. Marks this string as being a password, masking the characters with asterisks in the settings dialog.|
Settings can be made hidden by using the
hidden attribute. This will make them not appear on the Openplanet settings dialog, which is useful if you want to programatically store some settings manually. Don't put too much content into these, however!
[Setting hidden] bool Setting_MyHiddenSetting;