Réglages et actions
Déclarer des réglages et des boutons, lire leurs valeurs, et les réglages dans les dépendances.
4 archives dans cette catégorie
-
Settings let the people who run your package change what it does without touching its code. Add a setting showed the basics, and Declarations keeps the compact schema with the full list of error texts. Where the declaration goes A package declares its settings in one place: an object exported as parameters from its index.js. Each key is the name of a setting, the name your script reads later in values, and each value describes the setting. /** @type {BehaviorParameters} */ export const parame
- 0 commentaires
- 2 vues
-
Once your package declares settings, its script reads their current values from asterobot:parameters. It can also react the moment someone applies a change. asterobot:parameters is the reference for the module. values import { values } from "asterobot:parameters"; values has one property per setting your package declares, named by its key: values.maxAnswers for a setting declared as maxAnswers. Each value has the type of its setting: a boolean for bool, a string for string, a regular number fo
- 0 commentaires
- 2 vues
-
An action is a button your package adds to the bot's page. Clicking it calls a function of the running script, with values the person can fill in first. Actions suit one-off things someone decides while the bot plays: report something, say something, move on to the next step. For a choice that should last, declare a setting instead. Declare an action Actions are declared next to settings, as an object exported as actions from index.js. Each key is the action's name, and each value describes th
- 0 commentaires
- 2 vues
-
A package can use other packages of the library, its dependencies, and each of them can declare settings and actions of its own. A script only reads the settings of its own package, and a bot's Settings tab shows each package's settings apart. Dependencies covers declaring and importing them. Each package reads its own settings Every package gets its own copy of asterobot:parameters. Whichever file imports it, values holds the settings declared in the index.js of the package that file belongs
- 0 commentaires
- 4 vues