User Tools

Site Tools



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

Link to this comparison view

harlowe:confirm [2017/10/09 20:39]
harlowe:confirm [2017/10/09 20:39] (current)
Line 1: Line 1:
 +**(confirm: // [[harlowe:​String|String]]//​) -> //​[[harlowe:​Boolean|boolean]]//​**
 +When this macro is evaluated, a browser pop-up dialog box is shown with the given [[harlowe:​string|string]] displayed,
 +as well as "​OK"​ and "​Cancel"​ button to confirm or cancel whatever action or fact the string tells the player.
 +When it is submitted, it evaluates to the [[harlowe:​boolean|boolean]] true if "​OK"​ had been pressed, and false if "​Cancel"​ had.
 +=== Example usage: ===
 +''​%%(set:​ $makeCake to (confirm: "​Transform your best friend into a cake?"​))%%''​
 +=== Details: ===
 +This is essentially identical to the Javascript ''​%%confirm()%%''​ function in purpose and ability. You can
 +use it to ask the player a question directly, and act on the result immediately.
 +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:​prompt|(prompt:​)]]
harlowe/confirm.txt ยท Last modified: 2017/10/09 20:39 (external edit)