User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

harlowe:prompt [2017/10/09 20:39] (current)
Line 1: Line 1:
 +**(prompt: // [[harlowe:​String|String]],​ String//) -> //​String//​**
 +When this macro is evaluated, a browser pop-up dialog box is shown with the first [[harlowe:​string|string]] displayed,
 +a text entry box containing the second string (as a default value), and an "​OK"​ button to submit.
 +When it is submitted, it evaluates to the string in the text entry box.
 +=== Example usage: ===
 +''​%%(set:​ $name to (prompt: "Your name, please:",​ "​Frances Spayne"​))%%''​
 +=== Details: ===
 +This is essentially identical to the Javascript ''​%%prompt()%%''​ function in purpose and ability. You can
 +use it to obtain a string value from the player directly, such as a name for the main character.
 +But, be aware that as the box uses the player'​s operating system and browser'​s styling, it
 +may clash visually with the design of your story.
 +When the dialog is on-screen, the entire game is essentially "​paused"​ - no further computations are
 +performed until it is dismissed.
 +=== See also: ===
 +[[harlowe:​alert|(alert:​)]],​ [[harlowe:​confirm|(confirm:​)]]
harlowe/prompt.txt ยท Last modified: 2017/10/09 20:39 (external edit)