-
Notifications
You must be signed in to change notification settings - Fork 13
How to write in Yarn
Every Yarn script file (.yarn.txt file) is made of chunks called nodes (like passages in Twine). The player can only read one node at a time. Each line is like a separate line of dialogue:
Robert: Hello world.
Eddie: ... Who are you talking to?
Robert: The world!
To make players choose between going to different nodes, you can use a node option like this: [[OptionLabel|NodeName]]
. So to make the player go to a node called "Cookies" or a node called "Candy", you would write:
Do you want cookies or candy?
[[I choose cookies.|Cookies]]
[[I choose candy.|Candy]]
IMPORTANT NOTE: By design, Yarn Spinner only shows node options to the player at the very end of the node, after all the dialogue is finished.
You can also make players choose an option by putting ->
before each option. This is called a shortcut option.
When you indent (press [TAB]
) after a shortcut option, those indented lines become a response / branch of dialogue. This is faster and more convenient than creating another node, which is why we call it a shortcut option.
You can also nest another set of options after each one. Notice how picking "I choose cookies" will lead the player to another set of options, "Fresh baked cookies" and "Chocolate chip cookies":
Do you want cookies or candy?
-> I choose candy.
Sorry, we don't have any candy.
It was bad candy anyway. It wasn't fresh.
-> I choose cookies.
What kind of cookies do you want?
-> Fresh baked cookies.
Are you saying my cookies aren't fresh?
-> Chocolate chip cookies.
No chocolate chip. Don't be so basic.
If you type [[NodeName]]
(with no OptionLabel
) then Yarn will just jump to that node. That means you can use shortcut options like node options, except with more control and flexibility.
Do you want cookies or candy?
-> I choose cookies.
Now jumping to the cookies node...
[[Cookies]]
-> I choose candy.
[[Candy]]
And that's pretty much the basics of writing in Yarn and giving choices! If you want to do more, read the Yarn Spinner documentation: