Tea stories are made up of passages — named blocks of text and markup that the engine displays one at a time. You move between passages through links. Variables let you track what the player has done and branch the narrative accordingly. This guide walks you through all three concepts with working code you can copy directly into Twine 2 or aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
.twee file.
Make sure you have Tea installed before continuing. See Installing Tea for setup instructions.
What you’ll build
A minimal two-passage story where the player picks up a key, and the next passage reacts to whether they have it. Along the way you’ll use<<set>> to store a value, <<if>> to branch on it, and [[link markup]] to navigate between passages.
Create your starting passage
Every Tea story needs a passage named Start. In Twine 2, double-click on the canvas to create a new passage and name it The
Start. In Twee, write:[[Text|PassageName]] syntax creates a clickable link. The text before the pipe (|) is what the player sees; the name after it is the passage to navigate to.Set a variable when the player clicks a link
Tea’s story variables start with The
$ and persist for the entire playthrough. Use <<set>> to assign a value. Update your Start passage to set $hasKey when the player picks up the key:<<link>> macro runs the code inside its body silently when clicked, then forwards the player to the named passage. Here it sets $hasKey to true before navigating.The
to keyword is Tea’s TwineScript syntax for assignment. You can also use the standard JavaScript = operator: <<set $hasKey = true>>.Branch on a variable with `<<if>>`
In the destination passage, use outputs
<<if>> to show different text depending on whether the player grabbed the key:<<if>> evaluates its condition and renders the matching branch. The <<else>> branch renders when the condition is false or undefined. Close the block with <</if>>.Variables in passage text are interpolated automatically — you can write $hasKey anywhere in your prose and Tea substitutes its current value. For example:Your inventory: true if $hasKey is true.Add a final passage
Add the destination passage so the story has somewhere to go:
[[Play again|Start]] sends the player back to the beginning. Tea preserves history so they can also use the back button in the UI bar.Complete example
Here is the full story as a single Twee file you can save and compile:Next steps
Macro reference
Explore all built-in macros for control flow, audio, DOM manipulation, and more
TwineScript variables
Learn how story variables, temporary variables, and expressions work
Link markup
Setter links, arrow separators, and image links
State and saving
Understand history, sessions, and save slots