Configuration options are configurable through the web interface, giving users of your script/plugin
the ability to change variables though the configuration options youe expose, without having to edit the source code.
To register an optoin you use the appropiate addOption* methods, or the startList method.
Default values and 'required'
You can provide a default value that is used when the field is not provided but
users can still put it to to the types appropiate empty value unless you set "required" to true
Top level options can only be required if you have a default value assigned to them.
The empty value for strings is an empty string ("") and setting required to true will require a non-empty string.
Example:
constxpNameSetting = script.settings.addOptionString("xp_name", { label:"XP point name", description:"Name to give xp points", defaultValue:"xp", required:true, })
constmessageXpCooldownSecondsSetting = script.settings.addOptionInteger("message_xp_cooldown_seconds", { label:"Message XP coooldown", description:"The time period between messages to wait before they're eligible for more XP", defaultValue:60, min:0, required:true, })
The list give you the ability to expose a option that users can add multiple items to
To create a list you define the schema, a set of options each item in the list needs to have.
An example for this is level roles for a leveling system
where each item would have a level integer option and a role option:
constlevelRolesSetting = script.settings.startList("level_roles") .addOptionInteger("level", { label:"Level", required:true, min:1, description:"The level at which the user gains the role" }) .addOptionRole("role", { label:"Level", required:true, description:"The role to assign the user" }).complete({ label:"Level Roles", description:"Roles to give users as they advance in levels", })
Configuration options for your script/plugins
Configuration options are configurable through the web interface, giving users of your script/plugin the ability to change variables though the configuration options youe expose, without having to edit the source code.
To register an optoin you use the appropiate addOption* methods, or the startList method.
Default values and 'required'
You can provide a default value that is used when the field is not provided but users can still put it to to the types appropiate empty value unless you set "required" to true
Top level options can only be required if you have a default value assigned to them.
The empty value for strings is an empty string ("") and setting required to true will require a non-empty string.
Example: