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:


INCLUDE Dinner
INCLUDE GettingReady
CHAPTER 1: ASKING HIM OUT
I was unsure about asking him out on a date. What would we do? Where would we go?
I let it go for weeks.
Finally, I asked him out.
-> Chapter_2
=== Chapter_2 ===
CHAPTER 2: GETTING READY
Why hadn't I thought about what I was going to wear? Here I am, 30 minutes before the date and I haven't picked out my clothes!
* Pick out something good
-> Getting_Ready.Pick_Out_Something_Good
* Don't bother
-> Getting_Ready.Just_Grab_Something
-> Chapter_3
=== Chapter_3 ===
CHAPTER 3: EATING DINNER
-> Dinner


=== Dinner ===
But I hadn't made dinner plans! And they we were, standing outside his apartment.
He turned to me. "What should we eat?"
-> Pizza_Choices
=== Pizza_Choices ===
+ {Pizza < 1} [Pizza?]
-> Pizza
+ {Pizza} {Salad < 1} [Salad?]
-> Salad
+ {Pizza} {Salad} {Nothing < 2} [Nothing?]
-> Nothing
+ {Pizza} {Salad} {Nothing} [Sushi?]
-> Sushi
=== Pizza ===
He shook his head. "I don't like pizza."
-> Pizza_Choices
=== Sushi ===
"Sushi sounds good!"
-> DONE
=== Salad ===
"Not a salad."
-> Pizza_Choices
=== Nothing ===
{"We have to eat something!"|"Stop being silly!"}
-> Pizza_Choices

view raw

Dinner.ink

hosted with ❤ by GitHub


=== Getting_Ready ===
= Pick_Out_Something_Good
I took some time and picked out something good.
-> Chapter_3
= Just_Grab_Something
I just grabbed some clothes off the floor and ran out.
-> Chapter_3