bitburner-src/markdown/bitburner.ns.prompt.md

37 lines
1.4 KiB
Markdown
Raw Normal View History

2021-10-30 18:34:14 +02:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [prompt](./bitburner.ns.prompt.md)
## NS.prompt() method
2022-03-17 21:50:46 +01:00
Prompt the player with an input modal.
2021-10-30 18:34:14 +02:00
<b>Signature:</b>
```typescript
2022-03-17 21:50:46 +01:00
prompt(
txt: string,
options?: { type?: "boolean" | "text" | "select" | undefined; choices?: string[] },
): Promise<boolean | string>;
2021-10-30 18:34:14 +02:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| txt | string | Text to appear in the prompt dialog box. |
2022-03-17 21:50:46 +01:00
| options | { type?: "boolean" \| "text" \| "select" \| undefined; choices?: string\[\] } | Options to modify the prompt the player is shown. |
2021-10-30 18:34:14 +02:00
<b>Returns:</b>
2022-03-17 21:50:46 +01:00
Promise&lt;boolean \| string&gt;
2021-10-30 18:34:14 +02:00
2022-03-17 21:50:46 +01:00
True if the player click “Yes”; false if the player clicks “No”; or the value entered by the player.
2021-10-30 18:34:14 +02:00
## Remarks
2021-10-30 21:46:34 +02:00
RAM cost: 0 GB
2021-10-30 18:34:14 +02:00
2022-03-17 21:50:46 +01:00
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 scripts execution is halted until the player selects one of the options.