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:link-reveal-goto

(link-reveal-goto: String, [String]) → Changer

This is a convenient combination of the (link-reveal:) and (go-to:) macros, designed to let you run commands like (set:) just before going to another passage. The first string is the link text, and the second is the passage name.

Example usage:

  • (link-reveal-goto: "Study English", "Afternoon 1")[(set:$eng to it + 1)] will create a link reading “Study English” which, when clicked, adds 1 to the $eng variable using (set:), and then goes to the passage “Afternoon 1”.
  • (link-reveal-goto: "Fight the King of England", "Death")[(alert:"You asked for it!")] will create a link reading “Fight the King of England” which, when clicked, displays an alert using (alert:), and then goes to the passage “Death”.

Details:

Note that there is already an idiom for checking if a passage was visited earlier in the game: (history: ) contains "Passage name" checks if the passage named “Passage name” was visited. So, you don't necessarily need to use this macro to record that the player has visited the destination passage.

Note also that there's no way to “cancel” traveling to the new passage once the link is clicked, unless you include (go-to:), (undo:) or another such macro is inside the hook.

See also:

harlowe/link-reveal-goto.txt · Last modified: 2019/04/16 02:46 by l