Skip to content
Mako edited this page Dec 9, 2023 · 3 revisions

Souvenir documentation

Souvenir is a game scripting language influenced by languages like Ink and Erlang.

String syntax

Souvenir is designed for games that intermingle textual narration and dialogue with control flow logic. As such, textual output has a high priority. Interpolated string literals, or "quotes," start with a right angle bracket followed by a space (> ) and run to the end of the line:

let Example = > Spaces at the beginning of a quote are not included in the output.

A string literal on a line by itself is interpreted as a print statement. This is called a naked quote:

> Hello world.

Consecutive naked quotes, unless separated by blank lines or other statements, will have their contents concatenated together:

> This line, and those that follow,
> will appear as one long line in
> the output.

This syntax is designed to allow more-or-less arbitrary punctuation inside the string, while reducing the burden on writers of tracking where it begins and ends:

> "No," I snarled. "*YOU'RE* an animal!"

Basic control flow

A Souvenir script is divided up into pages.

:: start
> Printing from page "start."

:: example
> Printing from page "example."

Control flow jumps to a new scene using the divert operator (->). Here's a program that runs in an infinite loop, jumping back and forth between two scenes:

:: start
-> example

:: example
-> start

Scenes may take arguments:

:: example(Counter)
-> example(Counter + 1)
Clone this wiki locally