bitburner-src/doc/source/netscript/basicfunctions/prompt.rst
MageKing17 ae15914efa Update netscript documentation.
Unfortunately, I haven't used most of the specialty APIs yet, so I'm not intimately familiar with where their documentation might be wrong. I figured some fixes were better than no fixes, and I can always make more fixes later.

Fixes #1023.
2021-07-06 00:18:22 -07:00

24 lines
704 B
ReStructuredText

prompt() Netscript Function
===========================
.. js:function:: prompt(txt)
:RAM cost: 0 GB
:param string txt: Text to appear in the prompt dialog box.
:returns: ``true`` if the player clicks "Yes".
Prompts the player with a dialog box with two options: "Yes" and "No". This
function will return true if the player click "Yes" and false if the player
clicks "No". The script's execution is halted until the player selects one
of the options.
Example:
.. code-block:: javascript
cost = getPurchasedServerCost(8192);
answer = prompt("Buy a server for $"+cost);
if(answer) {
purchaseServer("my server", 8192);
}