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-goto

(link-goto: String, [ String ]) → command

Takes a string of link text, and an optional destination passage name, and makes a command to create a link that takes the player to another passage. The link functions identically to a standard link. This command should not be attached to a hook.

Example usage:

  • (link-goto: "Enter the cellar", "Cellar") is approximately the same as [[Enter the cellar->Cellar]].
  • (link-goto: "Cellar") is the same as [[Cellar]].

Rationale:

This macro serves as an alternative to the standard link syntax ([[Link text->Destination]]), but has a couple of slight differences.

  • The link syntax lets you supply a fixed text string for the link, and an expression for the destination

passage's name. However, it does not provide any other means of computing the link. (link-goto:) also allows the link text to be any expression - so, something like (link-goto: "Move " + $name + "to the cellar", "Cellar") can be written.

  • The resulting command from this macro, like all commands, can be saved and used elsewhere.

If you have a complicated link you need to use in several passages, you could (set:) it to a variable and use that variable in its place.

Details:

As a bit of trivia… the Harlowe engine actually converts all standard links into (link-goto:) macro calls internally - the link syntax is, essentially, a syntactic shorthand for (link-goto:).

See also:

harlowe/link-goto.txt · Last modified: 2017/06/18 22:28 by l