- Part 1: Installing Inky and Common Terms
- Part 2: Choices and Knots
- Part 3: Sticky and Advanced Choices
- Part 4: Includes and Stitches
- Part 5: Alternatives, Sequences, Cycles, and Shuffles
- Part 6: Gather Points and Labelled Options
- Part 7: Global, Temporary, and Constant Variables
- Part 8: Knot Parameters and Functions
- Part 9: Tunnels and Threads
- Part 10: Lists
Ink is a scripting language for creating interactive fiction like choose-you-own-adventures and other vast, branching stories.
The ability to choose different options is core to how Ink works. By showing the user options, they can pick one and then follow different paths through the flow.
Choices are created with the * symbol. When a line starts with this symbol, it becomes a choice for the player. When multiple * symbols are used, they are all options in that set.
When used in a flow, Inky will present the choices in the middle of the screen.
Multiple uses of the * symbols signal new levels (sets) of choices. A single * symbol is the first and more * symbols signal that those choices lead to more.
When one choices leads to others, those will be shown after the content of the first choice.
When brackets are used within a choice, it is only shown in the choice itself. It is not part of the output.
This can be combined with other text in the choice to show one part in the choice (what the player clicks) and other in the result of the action.
Any text not in brackets will be shown in the output.
Reducing (and Adding Back) Choices
By default, a choice will remove itself once chosen. As designed, a choice is a one-time event. It is chosen and the others in the set are ignored. However, choices can be “added back” through using the plus “+” symbol. Instead of being removed, these choices can be used multiple times.
As introduced in the Common Terms, a knot is a selection of content. They are created through using using two or more equal signs (=) and the name of the knot. Optionally, and more commonly, they are also closed with three equal signs (=).
Note: Knots names cannot contain spaces, but can use the underscore.
Moving between knots is done through a divert. In Ink, this is an arrow, “->” that “points at” the knot to move to next.
Simply creating knots is not enough. Knots must not create dead ends in Ink. At a minimum, a knot must divert to a specially-named label called “DONE” to complete it.
Combined with brackets for choices, the output of an option can be placed in knots.
Loops with Knots
With both knots and diverts, a loop can be created where an option has a divert that points to a knot containing the original choice.
With a single choice within the set “pointing to” a DONE label, the others can be used to loop by diverting to the knot holding the choice.
GitHub Gist Version:
|It was our first date and we hadn't made dinner plans.|
|=== Pizza_Choices ===|
|He turned to me. "What should we eat?"|
|=== Pizza ===|
|He shook his head. "I don't like pizza."|
|=== Sushi ===|
|"Sushi sounds good!"|
|=== Salad ===|
|"Not a salad"|
|=== Nothing ===|
|"We have to eat something!"|