Difference between revisions of "Bot Playground/Store/User settings"

From SmartBots Developers Docs
Jump to: navigation, search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{DISPLAYTITLE:Script user settings}}
 +
 
The most of scripts are supposed to be configurable for the user.  The configurable options could be like group name, various messages and such.
 
The most of scripts are supposed to be configurable for the user.  The configurable options could be like group name, various messages and such.
  
Line 12: Line 14:
 
* the setting "friendly" name as user sees it
 
* the setting "friendly" name as user sees it
 
* the optional hint for the user
 
* the optional hint for the user
 +
 +
All settings are string values (if you need a number or UUID you should do a transform in your script).
  
 
== Accessing user settings from script ==
 
== Accessing user settings from script ==
Line 23: Line 27:
 
== Specifying settings while developing scripts ==
 
== Specifying settings while developing scripts ==
  
You can specify the settings values for your own script while in development:
+
You can specify the settings values for your own script (while in development) on a "Settings" tab:
  
 
[[Image:Store-user-settings-2.png|center|728px]]
 
[[Image:Store-user-settings-2.png|center|728px]]
  
 
New settings become available here as soon as you add them on "Bot Store > User settings" screen.
 
New settings become available here as soon as you add them on "Bot Store > User settings" screen.
 +
 +
== Asking user for settings ==
 +
 +
User sees the settings right after purchasing the script:
 +
 +
[[Image:Store-user-settings-3.png|center|728px]]
  
 
== Settings and releases ==
 
== Settings and releases ==
  
When you develop your script the user settings
+
When you do a new [[Releases|release]], the current settings list is being saved along with the release. Thus, upcoming "User settings" changes won't affect the previous releases:
 +
 
 +
[[Image:Store-user-settings-4.png|center|550px]]
 +
 
 +
Thus, you can safely rename, add or remove settings while developing an updated version of the script. Updated/removed settings won't cause already purchased versions to crash.
 +
 
 +
{{NavMenu}}
 +
__NOTOC__

Latest revision as of 17:47, 29 August 2022


The most of scripts are supposed to be configurable for the user. The configurable options could be like group name, various messages and such.

Please note that user's bot name is not a setting. User selects the bot while purchasing your script.

Configuring settings

Store-user-settings-1.png

There are three values you specify:

  • the setting variable name as your script sees it (see below)
  • the setting "friendly" name as user sees it
  • the optional hint for the user

All settings are string values (if you need a number or UUID you should do a transform in your script).

Accessing user settings from script

User setting can be accessed from your script using userSettings object:

console.log("Using group: " + userSettings.group_name);

Specifying settings while developing scripts

You can specify the settings values for your own script (while in development) on a "Settings" tab:

Store-user-settings-2.png

New settings become available here as soon as you add them on "Bot Store > User settings" screen.

Asking user for settings

User sees the settings right after purchasing the script:

Store-user-settings-3.png

Settings and releases

When you do a new release, the current settings list is being saved along with the release. Thus, upcoming "User settings" changes won't affect the previous releases:

Store-user-settings-4.png

Thus, you can safely rename, add or remove settings while developing an updated version of the script. Updated/removed settings won't cause already purchased versions to crash.