Who ink suits#
ink suits a story told through choices: a conversation, a journey, a choose-your-path tale with a lot of branching and rejoining. The reader picks from a list of options. If you want the reader to type commands and explore rooms, Inform 7 fits better.
Start an ink story#
- Open Create a Story and sign in.
- Under Create from scratch, choose Ink.
- Give it a title and pick a starter under Start from: Blank (an opening line and two choices), Branching paths (a hub you return to, one-time and repeatable choices, and a point where the paths meet) or Stats & state (variables, text that changes, and choices that depend on what the reader did).
- Press Start writing. The story editor opens with your script on one side and the story playing on the other.
The story is private to you until you publish it. To bring in a story you already wrote, use the Upload a story tab: it takes a .ink file or compiled ink JSON.
Your first story#
Replace the starter with this script. The preview plays it as you type.
VAR courage = 0
The ferry horn sounds twice. The last boat of the night is leaving.
* [Run for the ramp] -> ramp
* [Stay on the pier] -> pier
== ramp ==
~ courage = courage + 1
You jump the gap as the ramp lifts. A deckhand catches your sleeve.
-> crossing
== pier ==
You watch the lights shrink across the bay.
-> END
== crossing ==
The water is black and calm. {courage > 0: Your heart is still racing.}
* [Ask the deckhand where the boat docks]
"Northport, by dawn," she says.
* [Stand at the rail]
The wind does the talking.
- The engine settles into a low hum.
-> ENDChoose Run for the ramp, then either choice on the crossing: both lead to the same last line, because the - line gathers the two choices back together. Restart, at the top of the preview, plays the story from the start again.
Your script saves itself about a second and a half after you stop typing, and the top bar says Saved when it has. Each save that compiles updates the version that Playtest opens; see Saving your script.
The syntax#
An ink script is text with a few marks in it. Text prints as it is, a line at a time. Indentation is only for you to read: ink ignores it.
Text and comments#
Each line of text is a paragraph. // starts a comment to the end of the line, and /* ... */ comments out a block. The reader sees neither.
The station clock reads ten past midnight.
// Write the porter's scene here.See Content and Comments in Writing with ink.
Choices#
A line starting with * is a choice. The lines under it are what happens when the reader picks it. Text in square brackets shows in the choice but is left out of the story once chosen.
"Ticket, please," says the guard.
* [Hand it over]
You give him the stub. He punches a hole in it.
* "I lost it[."]," you say.
He sighs.A * choice can be chosen once; a + choice stays every time the reader comes back. A choice with a condition in curly braces shows only when the condition is true.
+ [Wait a little longer] -> platform
* {has_ticket} [Board the train] -> carriageSee Choices, Suppressing choice text, Sticky choices and Conditional choices in Writing with ink.
Knots#
A knot is a named section of the story, started with two or more equals signs. The name is one word with no spaces. Text above the first knot plays first; a knot plays only when the story is sent to it.
== platform ==
The rails hum. A light grows in the tunnel.See Knots in Writing with ink.
Diverts#
-> sends the story to a knot right away, with no input from the reader. -> END ends the story. Every path must end in a divert, a choice or -> END, or the story runs out of content.
The doors close behind you.
-> carriage
== carriage ==
The seats are empty. You sit by the window.
-> ENDTwo lines joined with <> (glue) print as one line.
See Diverts, Glue and Writing a knot in Writing with ink.
Stitches#
A knot can hold stitches, started with one equals sign. Send the story to one with knot.stitch; inside the same knot, the stitch's name is enough. Sending the story to a knot that has stitches starts its first stitch.
== carriage ==
= window_seat
The town slides past in the dark.
-> carriage.aisle_seat
= aisle_seat
Someone's coat brushes your shoulder.
-> ENDSee Stitches and The first stitch is the default in Writing with ink.
Gathers#
A line starting with - gathers the choices above it: whichever the reader picked, the story carries on from the gather. Use more dashes for choices nested inside choices.
* [Sleep]
You close your eyes.
* [Read]
You open the paper.
- The train slows for the next stop.See Gathers and Nested flow in Writing with ink.
Variables#
VAR declares a variable with a starting value: a number, true or false, or text in quotes. A line starting with ~ changes it. Curly braces print it.
VAR fare = 2
VAR has_ticket = false
~ fare = fare + 1
~ has_ticket = true
The fare is now {fare} coins.A knot's name also works as a test: {platform} is true once the reader has seen the platform knot.
See Global variables, Logic and Conditional choices in Writing with ink.
Text that depends on the story#
{condition: text} prints the text only when the condition is true, and {condition: this|that} picks one of two. For larger blocks, use an if block.
{has_ticket: You show your ticket.|You hope nobody asks.}
{ fare > 3:
"That's robbery," you mutter.
- else:
You pay without a word.
}See Conditional text and Conditional blocks in Writing with ink.
Text that varies each time#
Alternatives inside curly braces change on each visit. A plain list shows each item in turn and then repeats the last. & cycles, ! shows each once and then nothing, and ~ picks at random.
The guard {nods|nods again|has stopped noticing you}.
It is {&Monday|Tuesday|Wednesday}.
You flip a coin: {~heads|tails}.See Sequences, cycles and other alternatives in Writing with ink.
What the editor does for ink#
The editor shows your script on one side and the story playing on the other. Everything below is on the story editor guide too, with each control's place on a phone.
- The live preview plays the script as you type. Pick a choice to go on; after an edit, it replays the same choices so you stay where you were, and tells you when your edit changed that branch. Restart plays from the start. When the script does not compile, the preview keeps the last good text and shows the issues.
- The issues list under the script shows what the last save reported. An issue that names a line is a key: press it to jump to that line.
- Story map draws your knots and the links between them. You can add a knot, rename it, edit its text, link it to another knot or delete it, and the script follows. Save sits at the top of the map.
- Variables lists the variables your story declares and lets you tie each one to a faction, an item, a relationship, a quest flag or a stat in wilds.ai. This leaves your script as it is.
- Enhancements holds a scene picture and an ambient mood for each knot.
- AI co-writer, Suggestions and Lorebook help you write. Every suggestion the AI writes is compiled with your story before you see it, and nothing changes until you press Accept. Each AI action costs 1 credit on the free plan and 2 credits on a paid plan; a suggestion that does not compile is not charged. See the AI tools.
- Playtest opens the saved story on its play page in a new tab.
- Details holds the title, summary, tags, content rating, cover, audio, credits and publishing settings.
- Publish records a version of the story. Who can play it (Private, Unlisted or Public) is set under Details, in Publishing.
- Guide and Syntax, in the top bar, open this guide and its syntax section.
Saving your script#
The editor saves your script about a second and a half after you stop typing, and again when you leave the tab or close the editor. The top bar shows Saving, Saved, or Not saved with a Retry save key; your text stays in the editor until a save lands. Save, at the top of the Story map, saves at once. Each save compiles the story first. A script that compiles updates the version that Playtest opens. The editor still saves a script that does not compile. Its issues show under the script, and Playtest keeps opening the last version that compiled. A TODO: line or a warning shows in the issues as a warning and never keeps a script from compiling.
Fix common issues#
The editor compiles your script with inkjs 2.4.0, the JavaScript version of ink's compiler. Each issue starts with ERROR: or WARNING: and the line it is on. These ten are the ones writers meet most; the words in quotes are taken from the issue as ink writes it.
A divert to a knot that does not exist#
"target not found: 'name'". The name after -> does not match any knot or stitch. Check the spelling. Names must match letter for letter, so train_car and traincar are two different knots.
A loose end#
"Apparent loose end exists where the flow runs out. Do you need a '-> DONE' statement, choice or divert?" A knot or a choice ends without saying where to go next. Add a divert, a choice, or -> END.
The story runs out of content#
"ran out of content. Do you need a '-> DONE' or '-> END'?" The preview reached a point with no text, no choices and no ending. This often happens when the reader has used up every * choice in a loop. Make one choice sticky with +, or add a fallback choice: a * choice with no text, written * -> next_knot, which ink takes when no other choice is left.
A variable that was never declared#
"Unresolved variable: name". The script reads a variable that has no VAR line. Add VAR name = 0 (or false, or "text") near the top.
Changing a variable that was never declared#
"Variable could not be found to assign to: 'name'". A ~ line sets a variable that has no VAR line. Declare it first.
A VAR that starts from another variable#
"global variable assignments cannot refer to other variables, only literal values, constants and list items". A VAR line needs a plain value such as 3 or "Ana". Set it from another variable later, on a ~ line.
A name used twice#
"name has already been used" or "has the same name as a knot". Two knots, or a knot and a stitch, share a name. Rename one, and update the diverts that point to it.
else: without its dash#
"Saw the text 'else:' which is being treated as content. Did you mean '- else:'?" Inside an if block, each branch starts with a dash: - else:.
A ~ in the middle of a line#
"You shouldn't use a '' here - tildas are for logic that's on its own line. To do inline logic, use { curly braces } instead". Put the `change on a line of its own, or print the value with{name}`.
An arrow with nowhere to go#
"Empty diverts (->) are only valid on choices". A -> with no name after it works only as a fallback choice (* ->). Add the knot's name, or END.
The ink manual#
inkle's own guide, Writing with ink, covers the whole language, including functions, tunnels, threads and lists. Inky, inkle's desktop editor, writes the same .ink files you can upload here.