Learning Ink: Part 5: Alternatives, Sequences, Cycles, and Shuffles

InkLogo

 

Learning Ink

 

Ink is a scripting language for creating interactive fiction like choose-you-own-adventures and other vast, branching stories.


 

Alternatives

In Ink, Alternatives are text within curly brackets, {}. They have already been introduced as part of determining if a knot (or stitch) has been visited. When used with text strings, they can be used to introduce “alternative” text.

1_Alternatives

 

Sequences

By default, the values within the curly brackets will move in sequence from one to another until it reaches the end. It will then stop at the last value and repeat it.

Sequences

 

Cycles

To have the text strings repeat, create a “cycle” of values using the “&” symbol within the curly brackets.

2_Cycles

Using cycles, values can be repeat within loops.

Cycles

Shuffles

Within alternatives, entries can also be selected at random. This is called a shuffle. It uses the tilde, ~.

3_Shuffle

For each run of the shuffle, a new value will be chosen.

Shuffle

 

GitHub Gist Version: