Line Groups
To give your dialogue more variety, you can also provide lines in a line group. When lines are in a line group, Yarn Spinner will choose one of them for you.
Line groups are collections of lines that begin with a => symbol:
title: Start
---
Captain: Navigator, fire the glitter torpedoes! That'll confuse the enemy ships!
=> Navigator: *sighs deeply* Sir, we don't have 'glitter torpedoes.' Those were in your dream last night.
=> Navigator: *eyes roll skyward* Captain, weaponizing craft supplies is not part of standard space combat protocol.
=> Navigator: *Slumps shoulders in defeat* I'll... make a note in the log that you suggested tactical glitter, sir.
===In this example, the Captain will say “Navigator, fire the glitter torpedoes! That'll confuse the enemy ships!”, and then Yarn Spinner will choose one of the subsequent lines to respond with.
Line groups are useful for running ‘barks’: collections of short lines that need to run in response to an in-game event. It can be useful to think of them like Yarn Spinner’s existing options -> syntax, but instead of the player choosing which content to run, the computer picks it for you:
title: Start
---
=> Guard: Halt!
=> Guard: No entry!
=> Guard: Stop!
===You can attach conditions to lines in a line group, to ensure that they only run when it’s appropriate to do so. Conditions can be any true or false expression, and can also be combined with the once keyword to ensure that a line can only run once:
title: Start
---
=> Guard: Greetings, citizen.
=> Guard: Hello, traveller.
Guard: Stay vigilant. // runs after 'Hello, traveller.'
=> Guard: Hail, adventurer! <<if $player_is_adventurer>>
=> Guard: I used to be an adventurer like you, but then I took an arrow in the knee. <<once if $player_is_adventurer>>
===flowchart TD
lg_pick{"Pick one available line"}
lg_greet["Guard: Greetings, citizen."]
lg_hello["Guard: Hello, traveller."]
lg_vigilant["Guard: Stay vigilant."]
lg_hail["Guard: Hail, adventurer!"]
lg_knee["Guard: I used to be an adventurer like you, but then I took an arrow in the knee."]
lg_pick --> lg_greet
lg_pick --> lg_hello
lg_hello --> lg_vigilant
lg_pick -->|"if $player_is_adventurer"| lg_hail
lg_pick -->|"once if $player_is_adventurer"| lg_kneetitle: Start
---
<<declare $usedToBePirate = false>>
// Narrator asks a question
Narrator: Did you used to be a space pirate?
-> Yes.
<<set $usedToBePirate = true>>
-> Nah.
// Onwards to space (presumably)...
=> Pirate: Arr! I'm a space pirate!
Pirate: Give me all the space money!
=> Pirate: Give me your space money! I'm a space pirate!
=> Pirate: Yarr! Your space money or your life!
=> Pirate: Arr, you look like me old crewmate! <<if $usedToBePirate>>
Pirate: Yarr, I'm still gonna rob yeh!
=> Pirate: You may have left the pirate life, but I'll still be robbin' yeh! <<if $usedToBePirate>>
Player: Oh no! A space pirate!
-> Hand over your (space) money.
<<jump Robbery>>
-> Ignore them.
<<jump Ignore>>
===
title: Robbery
---
=> Pirate: I'll take all your money! Yarr!
=> Pirate: All the space money! Now!
=> Pirate: Gimme half your money! <<if $usedToBePirate>>
Pirate: On account of yeh be an old crewmate.
Pirate: Yeh understand? Just a one-time thing.
Player: Oh no, I was robbed!
===
title: Ignore
---
Narrator: You run...
=> Pirate: Yarr, you escaped me this time!
=> Pirate: Arr! I'll let you go. <<if $usedToBePirate>>
Pirate: But only this once.
Pirate: And only because you were once a pirate!
===A line in a line group can also have additional lines belonging to it, which will run if the item is selected.