mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 07:02:26 +01:00
37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||
|
||
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [prompt](./bitburner.ns.prompt.md)
|
||
|
||
## NS.prompt() method
|
||
|
||
Prompt the player with an input modal.
|
||
|
||
<b>Signature:</b>
|
||
|
||
```typescript
|
||
prompt(
|
||
txt: string,
|
||
options?: { type?: "boolean" | "text" | "select" | undefined; choices?: string[] },
|
||
): Promise<boolean | string>;
|
||
```
|
||
|
||
## Parameters
|
||
|
||
| Parameter | Type | Description |
|
||
| --- | --- | --- |
|
||
| txt | string | Text to appear in the prompt dialog box. |
|
||
| options | { type?: "boolean" \| "text" \| "select" \| undefined; choices?: string\[\] } | Options to modify the prompt the player is shown. |
|
||
|
||
<b>Returns:</b>
|
||
|
||
Promise<boolean \| string>
|
||
|
||
True if the player click “Yes”; false if the player clicks “No”; or the value entered by the player.
|
||
|
||
## Remarks
|
||
|
||
RAM cost: 0 GB
|
||
|
||
Prompts the player with a dialog box. If `options.type` is undefined or "boolean", 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" will show a drop-down field. Choosing type "select" will require an array or object to be passed via the `options.choices` property. The script’s execution is halted until the player selects one of the options.
|
||
|