code, howto, Ink

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:

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s