mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
DOC: ns.prompt()
: explain the various options
Elaborate on the effects of `options.type` and `options.choices`. Break the explanation into bullet points for clearer presentation. Thanks to @Snarling for pointing out that the default is to create a boolean dialog box.
This commit is contained in:
parent
a368c6904e
commit
473e6a2674
29
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
29
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -6600,12 +6600,29 @@ export interface NS {
|
|||||||
* @remarks
|
* @remarks
|
||||||
* RAM cost: 0 GB
|
* RAM cost: 0 GB
|
||||||
*
|
*
|
||||||
* Prompts the player with a dialog box. If `options.type` is undefined or "boolean",
|
* Prompts the player with a dialog box. Here is an explanation of the various options.
|
||||||
* the player is shown "Yes" and "No" prompts, which return true and false respectively.
|
*
|
||||||
* Passing a type of "text" will give the player a text field and a value of "select"
|
* - `options.type` is not provided to the function. If `options.type` is left out and
|
||||||
* will show a drop-down field. Choosing type "select" will require an array or object
|
* only a string is passed to the function, then the default behavior is to create a
|
||||||
* to be passed via the `options.choices` property.
|
* boolean dialog box.
|
||||||
* The script’s execution is halted until the player selects one of the options.
|
*
|
||||||
|
* - `options.type` has value `undefined` or `"boolean"`. A boolean dialog box is
|
||||||
|
* created. The player is shown "Yes" and "No" prompts, which return true and false
|
||||||
|
* respectively. The script's execution is halted until the player presses either the
|
||||||
|
* "Yes" or "No" button.
|
||||||
|
*
|
||||||
|
* - `options.type` has value `"text"`. The player is given a text field to enter
|
||||||
|
* free-form text. The script's execution is halted until the player enters some text
|
||||||
|
* and/or presses the "Confirm" button.
|
||||||
|
*
|
||||||
|
* - `options.type` has value `"select"`. The player is shown a drop-down field.
|
||||||
|
* Choosing type `"select"` will require an array to be passed via the
|
||||||
|
* `options.choices` property. The array can be an array of strings, an array of
|
||||||
|
* numbers (not BigInt numbers), or a mixture of both numbers and strings. Any other
|
||||||
|
* types of array elements will result in an error or an undefined/unexpected
|
||||||
|
* behavior. The `options.choices` property will be ignored if `options.type` has a
|
||||||
|
* value other than `"select"`. The script's execution is halted until the player
|
||||||
|
* chooses one of the provided options and presses the "Confirm" button.
|
||||||
*
|
*
|
||||||
* @param txt - Text to appear in the prompt dialog box.
|
* @param txt - Text to appear in the prompt dialog box.
|
||||||
* @param options - Options to modify the prompt the player is shown.
|
* @param options - Options to modify the prompt the player is shown.
|
||||||
|
Loading…
Reference in New Issue
Block a user