Skip to main content Svelte Highlight v7.23.1

Harlowe language preview

1. Setting a stat and branching on it

the (set:) and (if:) macros with a story variable
horizon-dark
(set: $health to 100)

(if: $health <= 0)[
    You collapse, defeated.
](else:)[
    You're still standing, though bruised.
]
atom-one-dark
(set: $health to 100)

(if: $health <= 0)[
    You collapse, defeated.
](else:)[
    You're still standing, though bruised.
]
github-dark
(set: $health to 100)

(if: $health <= 0)[
    You collapse, defeated.
](else:)[
    You're still standing, though bruised.
]
dracula
(set: $health to 100)

(if: $health <= 0)[
    You collapse, defeated.
](else:)[
    You're still standing, though bruised.
]
nord
(set: $health to 100)

(if: $health <= 0)[
    You collapse, defeated.
](else:)[
    You're still standing, though bruised.
]
github
(set: $health to 100)

(if: $health <= 0)[
    You collapse, defeated.
](else:)[
    You're still standing, though bruised.
]

2. A link to another passage

a passage link alongside a (link:) macro hook
horizon-dark
[[Go north->North Room]]

(link: "Search the room")[
    You find a rusty key under the floorboards.
    (set: $hasKey to true)
]
atom-one-dark
[[Go north->North Room]]

(link: "Search the room")[
    You find a rusty key under the floorboards.
    (set: $hasKey to true)
]
github-dark
[[Go north->North Room]]

(link: "Search the room")[
    You find a rusty key under the floorboards.
    (set: $hasKey to true)
]
dracula
[[Go north->North Room]]

(link: "Search the room")[
    You find a rusty key under the floorboards.
    (set: $hasKey to true)
]
nord
[[Go north->North Room]]

(link: "Search the room")[
    You find a rusty key under the floorboards.
    (set: $hasKey to true)
]
github
[[Go north->North Room]]

(link: "Search the room")[
    You find a rusty key under the floorboards.
    (set: $hasKey to true)
]

3. An inventory check

the (a:) array macro and a (if:) membership check
horizon-dark
(set: $inventory to (a: "sword", "shield"))

(if: $inventory contains "sword")[
    You feel ready for a fight.
](else:)[
    You should probably find a weapon.
]
atom-one-dark
(set: $inventory to (a: "sword", "shield"))

(if: $inventory contains "sword")[
    You feel ready for a fight.
](else:)[
    You should probably find a weapon.
]
github-dark
(set: $inventory to (a: "sword", "shield"))

(if: $inventory contains "sword")[
    You feel ready for a fight.
](else:)[
    You should probably find a weapon.
]
dracula
(set: $inventory to (a: "sword", "shield"))

(if: $inventory contains "sword")[
    You feel ready for a fight.
](else:)[
    You should probably find a weapon.
]
nord
(set: $inventory to (a: "sword", "shield"))

(if: $inventory contains "sword")[
    You feel ready for a fight.
](else:)[
    You should probably find a weapon.
]
github
(set: $inventory to (a: "sword", "shield"))

(if: $inventory contains "sword")[
    You feel ready for a fight.
](else:)[
    You should probably find a weapon.
]