Skip to main content
A custom settings category is a tab on the settings screen, after the game’s own: Display, Graphics, Audio and the rest. Its rows look and behave like the game’s: the arrow keys and a pad move through them, left and right change a value, and the column beside them shows each row’s description. The map keeps nothing. It shows the values you give it, tells you when the player changes one, and leaves saving and applying them to you.

Calls

A category belongs to the resource that registered it. Only that resource can update it, remove it or set its values, and it is removed when that resource stops. Registering an id another resource owns is refused.

Fields

The category

A setting

What happens

onChange(id, value, previous) is called on the client when the player changes a row, with the setting’s id, its new value and the one it had. An action calls it with the action’s id and no values. Return false to refuse a change: the row goes back to the value it had and the player is told it was not accepted. Anything else keeps the new value. An onChange that throws refuses the change too, and the error is written to the console. Save the value, apply it and send it to your server from onChange. When the value changes on your side (loaded from a database, or forced by the server) call SetSettingValue. It does not call onChange, and an open settings screen shows the new value at once.

Errors

RegisterSettings answers false and writes the reason to the console when the category or any setting does not read: a missing id or label, an unknown type, a value that does not fit its type or is not one of its options, a slider whose min is not below its max. Nothing is registered. SetSettingValue answers false for a value the setting cannot hold, for an action, and for a category of another resource. A category registered or removed while the settings screen is open appears or disappears the next time it opens; a change to one already shown is drawn at once.

Example