Skip to main content
Yarn Spinner is a dialogue scripting language designed for games. This guide covers the syntax essentials for writing NONMP dialogue.

Node Structure

Every dialogue segment is a node. Nodes have three parts:
A single .yarn file can contain multiple nodes.

Dialogue Lines

Basic dialogue uses the format Speaker: Text:

Line IDs

Add #line:identifier to tag lines for localization:
Write dialogue in English directly in your .yarn files. Line IDs connect to translation entries in CSV localization files (e.g., zh-cn.csv). See Project Development for the localization workflow.

Player Choices

Use -> to create options the player can select:
Indented content under an option runs when that option is selected.

Nested Choices

Options can contain more options:

Variables

Store and retrieve values with variables:
Access variables in dialogue:

Conditionals

Use <<if>>, <<elseif>>, and <<else>> for branching:

Conditional Options

Show options only when conditions are met:

Commands

Commands trigger game actions. Wrap them in <<command>>:
Common command patterns:

Yarn Reference

See all available commands and functions.

Jumping Between Nodes

Use <<jump>> to move to another node:

Functions

Call functions to get values from the game:
Many functions take integer IDs rather than string names. Character IDs, item IDs, and value IDs are defined in the game’s internal data tables. See the Functions Reference for parameter types.
Use functions in expressions:

Functions Reference

Browse all available query functions.

Comments

Add comments with //:

Complete Example

Next Steps

Quest Creation

Create map events and custom quests.

Visual Commands

Control backgrounds, characters, and effects.

Game Commands

Manage battles, items, and game state.

Functions

Query player and game information.