code, howto, Ink

Learning Ink: Part 4: Includes and Stitches

InkLogo

 

Learning Ink

 

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


 

Including Files

For better organization in more complex projects, Ink stories can be broken up into files. These can then be “included” through using the “INCLUDE” keyword.

1_INCLUDE
ChoicesAndKnot.ink

Once broken up, knots in other files can be called by their names like they would if they were in the same file.

2_Dinner
Dinner.ink

This allows for using diverts and knots across files, branching off into other parts and returning to others through having files be those locations, people, or other logical sections of a much longer flow.

Included

 

Stitches

Like breaking a project into different files, knots can also be broken into parts called stitches.

3_GettingReady

Within a knot, a stitch is defined with a single equal sign “=”. Just like knots, they can also be a section to be diverted to. However, as stitches are within knots, they must be referenced as such. A stitch takes its location as the knotName.stitchName with a dot between the two.

4_Stitches

Combined with the INCLUDE keyword, stitches in other files can be reached through including the file and then using their knot name followed by their stitch name.

Stitched

 

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