Harlowe

Equivalent functionality in Harlowe 3.2.1

Examples taken from the Harlowe online documentation

Harlowe and Moontale have fundamentally different use-cases! This guide is not exhaustive - in particular, it does not cover Styling, Input, Transitions, and utility functions.

Hooks vs. Render functions

In Harlowe, a Hook is a specific instance of content in a passage. A Hook can be hidden or shown at will, causing it to be inserted/removed from the passage text. A Hook name, when used in code, acts like a selector and is used to modify all Hooks with that name.

In contrast, Moontale render functions are a set of instructions for displaying content. Render functions can be combined with Changers, stored and retrieved like normal variables, and used in-line with other text as many times as desired. It is not possible to select and mutate text segments that have already been outputted; instead, use a variable to control what is outputted in a given block and call reload() to make the changes visible.

Syntax

The following syntax is identical in both Harlowe and Moontale:

  • [[Passage]]

  • [[Link->Target]]

  • [[Target<-Link]]

  • ~~Strike through~~

  • *Emphasis*

  • **Strong emphasis**

  • $variable

  • Special passage tags: startup, header, and footer

Harlowe

Moontale

[[Label -> $target]]

$Link(target)[Label]

//Italics//

*Italics* or _Italics_

''Bold''

**Bold**or __Bold__

<custom-tag>Text</custom-tag>

$Style.custom_tag[Text]

|foo)[Text] or [Text](foo|

$Name.foo[Text]

|foo>[Text] or [Text]<foo|

$Name.foo[Text] $foo

(show: ?foo)

$If(foo)[ ... ]

{$ foo = true; Reload() $}

?Passage

Passage.content (a Render Function)

?Page, ?Sidebar, ?Link

⚠️ Not supported

[==

[ - Content blocks are closed automatically

`[[ ]]`

<$ '[[ ]]' $>

``Single grave: ` ``

Single grave: `

<$ $> {$ $}

<$ '<$ $'..'> {$ $}' $>

See The parser is dumb

* Bulleted item

* Bulleted item 2

** Indented bulleted item

* Bulleted item

* Bulleted item 2

* Indented bulleted item

0. Numbered item

0. Numbered item 2

0.0. Indented numbered item

1. Numbered item

1. Numbered item 2

1. Indented numbered item

==>, =><=, <==>, and <==

$Align.right[, $Align.center[, $Align.justify[, and $Align.left[

===><=, =><===== etc.

⚠️ Not supported

You'd need custom tags for this

|==, =|||= etc.

⚠️ Not supported

You'd need custom tags for this

# Heading

# Heading

{ Single

line }

New line

Single

line \

New line

Single \

Line

\ text

New line

Single

Line

text \

New line

(set: $foo to 5)

(put: 5 into $foo)

{$ foo = 5 $}

(set: num-type $foo to 5) and friends

⚠️ Not supported

May be possible using Typed Lua

(set: _foo to 5)

⚠️ Not supported

Use global $foo or local foo in code blocks

(move: $foo into $bar)

{$ bar = foo; foo = nil $}

(print: $foo)

$foo (but note the edge-cases!)

(set: $foo to (print: $bar))

$Name.foo[$bar] or {$ foo = function() Show(bar) end $}

(if: $legs is 8)

$If(legs == 8)

(hidden:)

$If(false) if you really need it - but you probably want to use name

(if: x is 5)[Show] (else:)[Hide] (else:)[Show]

$If(x == 5)[Show Show] $Else[Hide]

(for: each _item, ...$array)

$ForEach(array) with value as the iterator, or $ForEach(array, 'key', 'item')

(for: each _value, 2, 4, 6, 8)

$ForEach{2, 4, 6, 8}

(for: _ingredient where it contains "petal", ...$reagents)

$ForEach(reagents)[$If(string.find(value, 'petal') [ ... ]]

(for: each _i, ...(range:1,10))

$Repeat(10)

(either: "a", "b", "c")

$Random('a', 'b', 'c')🚧

(either: ...$array)

$Random(table.unpack(array))🚧

(cond: x is 1, "a", x is 2, "b")

<$ {'a', 'b'}[x] $>

(cond: x is 'a', 1, x is 'b', 2)

<$ {a = 1, b = 2}[x] $>

(v6m:)[ \(`A`)/ ]

<$ '\(`A`)/' $>

(print: "**foo**")

(verbatim-print: ?hookName)

⚠️ Not supported

It may be possible to do this by overriding the output functions to convert tags into Markdown tokens

(enchant: 'gold', (text-colour: yellow))

$Enchant('gold', color.yellow)[

Note the rules on Immutability; this must be done before the text you want to change 🚧

(enchant: ?ghost, (text-style: 'outline'))

{$ ghost = Style.outline $}

This must be done before using ghost as a changer. 🚧

(change: 'gold', (text-colour: yellow))

⚠️ Not supported

It's not possible to change existing output

(enchant-in: ?frog, (text-colour: green))

$With{frog = Combine(frog, Color.green)}[

🚧

(print: (hooks-named: $companionType))

<$ _G[companionType] $>

(a: 'foo', 'bar')

{'foo', 'bar'}

(dm: 'a', 1, 'b', 2)

{a = 1, b = 2}

(ds: 'foo', 'bar')

{foo = true, bar = true}

(all-pass: _num where _num > 1 and < 14, 6, 8, 12, 10, 9)

All({6, 8, 12, 10, 9}, function(it) it > 1 and num < 14 end)

🚧

(set: $foo to (macro: num-type _x, [(print: _x + 5)]))

{$ function foo(x) show(x + 5) end $}

(history:) contains "Cellar"

Visited["Cellar"]

🚧

(metadata: "rarity", 5)

{$ Passage.rarity = 5 $}

(passage: "Cellar")

Passages["Cellar"]

(passages:)

Passages

Note that this is a map keyed by the passage name

Last updated