Skip to content
Mako edited this page Aug 27, 2016 · 3 revisions

Souvenir documentation

Souvenir is a game scripting language influenced by 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. String literals start with a right angle bracket followed by a space (> ) and run to the end of the line:

let Example = > The opening space is required, but not included in the output.

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

> Hello world.

Consecutive naked strings, 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 story file is divided up into knots. This terminology is borrowed from Ink, and the Souvenir version shares the same syntax:

== start
> Printing from knot "start."

== example
> Printing from knot "example."

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

== start
-> example

== example
-> start

Knots may take arguments:

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