选项
当你想让玩家决定说什么时,你可以使用选项。选项可让您向玩家显示多条潜在的对话台词,并让玩家选择其中之一。
选项是以 a 为前缀的行 ->。您可以编写希望玩家看到的选项,然后玩家选择其中之一。该选项的内容与任何其他对话一样。
例如,考虑以下代码:
演示.yarn
title: Start
---
Navigator: The quantum fluctuations are intensifying. We need to jump now.
Captain: But the calculations aren't complete. We could end up anywhere.
Navigator: The wormhole is collapsing. It's now or never.
Captain: Fine. Initiate jump sequence.
Navigator: Something's wrong. We're being pulled backward...
Captain: That's impossible. Unless...
Navigator: We're arriving before we left. We've become our own rescue mission.
-> Captain: Let's alter our trajectory and break this temporal loop!
-> Captain: We must complete the cycle. Our past selves depend on it.
===在此示例中,该行 Navigator: We're arriving before we left. We've become our own rescue mission. 会运行。
然后玩家将可以选择让队长说 Let's alter our trajectory and break this temporal loop!, 或者 We must complete the cycle. Our past selves depend on it.
组合在一起的选项一起交付,例如,考虑以下更新的脚本:
演示.yarn
title: Start
---
Navigator: The quantum fluctuations are intensifying. We need to jump now.
Captain: But the calculations aren't complete. We could end up anywhere.
Navigator: The wormhole is collapsing. It's now or never.
Captain: Fine. Initiate jump sequence.
Navigator: Something's wrong. We're being pulled backward...
Captain: That's impossible. Unless...
Navigator: We're arriving before we left. We've become our own rescue mission.
-> Captain: Let's alter our trajectory and break this temporal loop!
-> Captain: We must complete the cycle. Our past selves depend on it.
Navigator: Ayee! We're all going to die!
-> Captain: Nonsense! Keep yourself together!
-> Captain: AHHHH! We're all going to die!
===在此示例脚本中,这两个选项将一起提供:
-> Captain: Let's alter our trajectory and break this temporal loop!
-> Captain: We must complete the cycle. Our past selves depend on it.这些也将分别:
-> Captain: Nonsense! Keep yourself together!
-> Captain: AHHHH! We're all going to die!

同一节点中的两组选项分别显示。
选项和线路
选项可以有自己的行,这些行在选择选项时运行。如果选择不同的选项,它们将不会运行。要编写此内容,请_缩进_属于选项的行。
在以下代码中,将根据选择的两个快捷方式选项中的哪一个来运行不同的行。
title: Start
---
Navigator: The quantum fluctuations are intensifying. We need to jump now.
Captain: But the calculations aren't complete. We could end up anywhere.
Navigator: The wormhole is collapsing. It's now or never.
Captain: Fine. Initiate jump sequence.
Navigator: Something's wrong. We're being pulled backward...
Captain: That's impossible. Unless...
Navigator: We're arriving before we left. We've become our own rescue mission.
-> Captain: Let's alter our trajectory and break this temporal loop!
Navigator: Risky, Captain. We'd be writing ourselves out of existence.
-> Captain: We must complete the cycle. Our past selves depend on it.
Navigator: Then we're doomed to repeat this moment... forever.
===当玩家可以选择说“Let's alter our trajectory and break this temporal loop!“, 或者 ”We must complete the cycle. Our past selves depend on it.”
根据他们的选择,导航器会说“Risky, Captain. We'd be writing ourselves out of existence.“ 或者 ”Then we're doomed to repeat this moment... forever.". Finally, no matter what was selected, the line "Sounds good!“会跑。
选项中的选项
您还可以将选项嵌套在其他选项下面。例如,考虑以下 Yarn Spinner 脚本片段:
title: Start
---
Navigator: The quantum fluctuations are intensifying. We need to jump now.
Captain: But the calculations aren't complete. We could end up anywhere.
Navigator: The wormhole is collapsing. It's now or never.
Captain: Fine. Initiate jump sequence.
Navigator: Something's wrong. We're being pulled backward...
Captain: That's impossible. Unless...
Navigator: We're arriving before we left. We've become our own rescue mission.
-> Captain: Let's alter our trajectory and break this temporal loop!
Navigator: Risky, Captain. We'd be writing ourselves out of existence.
-> Captain: Damnit, Navigator! Nothing can stop me existing!
Navigator: *sigh* Very well, Captain.
-> Captain: By gods! You're right!
Navigator: But it's only solution, I fear.
-> Captain: We must complete the cycle. Our past selves depend on it.
Navigator: Then we're doomed to repeat this moment... forever.
-> Captain: If we're doomed, at least we'll be remembered as heroes.
Navigator: .. if anyone remembers us at all
-> Captain: Forever... forever... forever...
Navigator: Sir?
-> Captain: We must do it!
Navigator: As always, sir, you're right.
===在此示例脚本中,将同时传递以下选项:
-> Captain: Let's alter our trajectory and break this temporal loop!
-> Captain: We must complete the cycle. Our past selves depend on it.
然后,根据选择的选项,另一组选项将一起交付。
例如,如果玩家选择 Captain: Let's alter our trajectory and break this temporal loop! ,那么来自导航器的线路将被传送(Navigator: Risky, Captain. We'd be writing ourselves out of existence. )然后将为队长提供两个选项:
-> 船长:该死,导航员!没有什么可以阻止我的存在!
-> 队长:天哪!你说得对!
而如果玩家选择 Captain: We must complete the cycle. Our past selves depend on it. ,那么来自导航器的线路将被传送(Navigator: Then we're doomed to repeat this moment... forever.)然后将为队长提供三个选项:
-> Captain: If we're doomed, at least we'll be remembered as heroes.
-> Captain: Forever... forever... forever...
-> Captain: We must do it!

不同的选项组,使用颜色分组时显示。
测试选项
步骤1
为你的小故事添加选项。
考虑添加一些属于它们下面的选项的行。
步骤2
使用预览运行您的单节点叙述
