Detour Command
Learn about detour and return, which let you temporarily move to another node, then return.
Last updated
Was this helpful?
Learn about detour and return, which let you temporarily move to another node, then return.
Last updated
Was this helpful?
In addition to using the Jump Command to move between nodes, you can also use a detour
command. A detour
command looks very simlar to jump: it takes a single parameter with the title of the node you want to move to, but unlike the jump command the detour command will return to the node that called it.
The detour command works much like the jump command, except it will return to the node it detoured from after that node is done. Here’s an example of it in action:
If the player replies No?
to the guard’s question, Yarn Spinner will detour to the node titled Guard_Backstory
and run its contents. When the end of that node is reached, Yarn Spinner will return to the node titled Guard
, and resume from just after the detour
statement.
When you detour
into a node, Yarn Spinner runs the content from that node just as if you’d used a jump
statement. When you reach the end of the node, or reach a return
command, Yarn Spinner will return to just after the detour
command. A return command looks like <<return>>
. There are no parameters.
You can return early from a detoured node by using the return
command. Doing so will return to just after the detour
command as though the end of the node had been reached, for example:
When you detour into a node, that node can itself detour into other nodes. If a detoured node uses a jump
command to run another node, the return stack is cleared. If you detour
into a node, and that node jumps
to another node, Yarn Spinner won’t return to your original detour
site.
Next up, learn about Variables in Yarn Spinner Scripts.