Shadow Lines
Shadow lines let you reuse the same line in multiple places, without having to create duplicate copies.
Shadow lines are copies of other lines, but don’t create a duplicate entry in the string table.
This can be useful if you want to re-use an existing line in more than one place, which can be important when each line has in-game assets like voice-over recording.
Shadow lines are marked using the #shadow: hashtag. When you use the #shadow: tag, you specify the line ID of another line, which is called the source line. The source line must have an explicit #line: hashtag to identify it.
This example uses shadow lines:
title: Tavern
---
Ava: Hello, barkeep!
Guy: Hi there, how can I help?
Ava: I should go. #line:departure
===
title: Kitchen
---
Ava: Greetings, chef!
Guy: What are you doing back here?
Ava: I should go. #shadow:departure
===The script contains six lines, but only five of them have their own text in the string table. The second “I should go.” is a shadow line, so it has no text of its own, and points to the source line departure instead:
| ID | Text | Node | Tags |
|---|---|---|---|
line:ca5016c4 | Ava: Hello, barkeep! | Tavern | |
line:5c6011b3 | Guy: Hi there, how can I help? | Tavern | |
line:departure | Ava: I should go. | Tavern | |
line:eea29255 | Ava: Greetings, chef! | Kitchen | |
line:4d37f6cb | Guy: What are you doing back here? | Kitchen | |
line:sh_db07f1bc | (none) | Kitchen | shadow:departure |
When Yarn Spinner compiles your scripts, it takes the text out of every line and option and puts it in a string table, a list of each line’s ID and its text. Your compiled script only keeps the line IDs. When a line runs, your game looks its ID up in the string table to get the text to show.
This is how localisation works. To translate your game, you make a copy of the string table in another language, with the same IDs. Voice-over works the same way: each audio file is matched to a line ID.
A shadow line has its own ID, but no text of its own. When it runs, your game uses the source line’s text, translation and voice-over instead. So “I should go.” only needs to be translated and recorded once.
Shadow lines are required to have the same text in the Yarn script as their source line, but are allowed to have different hashtags (in addition to the #shadow: and #line: hashtags).
Now put it in a game
That's the Yarn language. Next, set up Yarn Spinner in your game engine, and run your scripts in a game of your own.


