User Tools

Site Tools


Sidebar

Passage markup

basics

coding

extra

list

section

whitespace

Macros

basics

colour

data structure

date and time

game state

live

maths

number

revision

saving

showing and hiding

string

styling

url

deprecated

Types of data

Special keywords

Special passage tags

harlowe:confirm

(confirm: String) → boolean

When this macro is evaluated, a browser pop-up dialog box is shown with the given 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 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/confirm.txt · Last modified: 2017/06/18 22:46 by l