Ink Syntax Summary
Introduction
- ink is a scripting language for interactive storytelling, ideal for Choose Your Own Adventure-style stories and branching dialogues.
Basic Structure
- Content: Basic text in a
.ink
file is output directly.Hello, world!
- Comments: Use
//
for single-line and/* ... */
for block comments.// This is a comment /* This is a block comment */
- Tags: Use hashtags to mark lines with extra information.
A line of text. #tag
Choices
- Basic Choice: Indicated by
*
.* [Choice text] Outcome text
- Suppressing Choice Text: Use square brackets.
* [Choice text] Outcome text
- Multiple Choices: List choices with
*
.* [Choice 1] Outcome 1 * [Choice 2] Outcome 2
Knots and Diverts
- Knots: Sections of content, marked with
===
.=== knot_name === Content of the knot.
- Diverts: Move from one knot to another using
->
.-> knot_name
Branching and Flow Control
- Basic Branching: Combine knots, options, and diverts.
* [Choice] -> knot_name
- Glue: Use
<>
to avoid line breaks.Content <-> more content.
Includes and Stitches
- Stitches: Subsections within knots, marked with
=
.=== knot_name === = stitch_name Content of the stitch.
- Includes: Combine multiple files.
INCLUDE file_name.ink
Variables and Logic
- Global Variables: Defined with
VAR
.VAR variable_name = value
- Temporary Variables: Defined with
~ temp
.~ temp variable_name = value
- Logic: Use
~
for assignments and{}
for conditions.~ variable_name = value { condition: Content }
Functions
- Defining Functions: Use
=== function
.=== function function_name(param) === ~ return value
- Calling Functions: Use
function_name()
.~ result = function_name(param)
Lists
- Defining Lists: Use
LIST
.LIST list_name = item1, item2, item3
- List Operations: Add or remove items.
~ list_name += item ~ list_name -= item
Advanced Flow Control
- Tunnels: Use
-> knot_name ->
to create subroutines.-> knot_name ->
- Threads: Use
<-
to join multiple sections.<- section_name
International Character Support
- Identifiers: Support for non-ASCII characters in identifiers.