Commands
In Yarn Spinner, you can send instructions to your game through commands. Commands look like this:
1
<<wait 2>>
2
<<setsprite ShipName happy>>
3
<<fade_out 1.5>>
Copied!
Commands are sent to your game's Dialogue Runner, just like lines and options are. Commands are not shown to the player directly; instead, they're used for things like stage directions.
Yarn Spinner comes with some built-in commands; however, to get the most usefulness out of them, you'll want to define your own custom commands that make your game do what you need to.

Built-in Commands

There are two built-in commands in Yarn Spinner: wait, and stop.

wait

The wait command pauses the dialogue for a specified number of seconds, and then resumes. You can use integers (whole numbers), or decimals.
1
// Wait for 2 seconds
2
<<wait 2>>
3
​
4
// Wait for half a second
5
<<wait 0.5>>
Copied!

stop

The stop command immediately ends the dialogue, as though the game had reached the end of a node. Use this if you need to leave a conversation in the middle of an if statement, or a shortcut option.
1
// Leave the dialogue now
2
<<stop>>
3
​
4
// Leave the dialogue if we don't have enough money
5
<<if $money < 50>>
6
Shopkeeper: You can't afford my pies!
7
<<stop>>
8
<<endif>>
Copied!

Making Your Own Commands

You can create your own commands, so that your scripts can . For more information on how to create them in Unity games, see Creating Commands and Functions.
Last modified 6mo ago
Export as PDF
Copy link
Edit on GitHub