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:undo

(undo: ) → Command

This Command stops passage code and “undoes” the current turn, sending the player to the previous visited passage and forgetting any variable changes that occurred in this passage.

Example usage:

You scurry back whence you came... (live:2s)[(undo:)] will undo the current turn after 2 seconds.

Rationale:

The (go-to:) macro sends players to different passages instantly. But, it's common to want to send players back to the passage they previously visited, acting as if this turn never happened. (undo:) provides this functionality.

By default, Harlowe offers a button in its sidebar that lets players undo at any time, going back to the beginning of the game session. However, if you wish to use this macro, and only permit undos in certain passages and occasions, you may remove the button by using (replace:) on the ?sidebar in a header tagged passage.

Details:

If this is the first turn of the game session, (undo:) will produce an error. You can check which turn it is by examining the length of the (history:) Array.

Just like (go-to:), (undo:) will “halt” the passage and prevent any macros and text after it from running.

See also:

harlowe/undo.txt · Last modified: 2017/10/10 00:39 (external edit)