跳跃命令

<<jump>> 命令允许您在节点之间移动对话。它是通过写作来使用的 << 然后这个词 jump、一个空格,然后是要将叙述跳转到的节点的完整标题,然后是另一个 >>.

跳转到带有标题的节点 Rescue_the_Kitten ,例如,您可以编写行 <<jump Rescue_the_Kitten>>

跳转命令应始终放在自己的行上,并根据需要缩进。

使用跳转命令

例如,考虑以下对话,该对话可以使用嵌套选项在一个节点内构建,也可以使用选项和跳转命令分割到多个节点。之前的版本位于单个节点内,并且工作正常,但是之后的版本是跨多个节点构建的,并且更容易理解。

标签:之前

title: Start
---
Navigator: Where to, Captain?

-> Captain: I want to go back to earth!
    Navigator: Earth it is sir. 
    Navigator: This jump will take us 10 hours.
    Navigator: Permission to jump, sir?
    -> Captain: Granted, let's go!
        Navigator: On it, sir.
    -> Captain: Not yet. Just wait a moment.
        Navigator: Standing by, sir.
-> Captain: Second star to the left!
    Navigator: Can you be more specific?
    -> Captain: I cannot, no.
        Navigator: Right away, sir.
    -> Captain: ... that one *gestures*
        Navigator: Very good, sir.

Navigator: Being a Navigator sure is hard work!
===

选项卡:之后

title: Start
---
Navigator: Where to, Captain?

-> Captain: I want to go back to earth!
    <<jump Earth>>
-> Captain: Second star to the left!
    <<jump SecondStar>>
    

Navigator: Being a Navigator sure is hard work!
===

title: Earth
---
Navigator: Earth it is sir. 
    Navigator: This jump will take us 10 hours.
    Navigator: Permission to jump, sir?
    -> Captain: Granted, let's go!
        Navigator: On it, sir.
    -> Captain: Not yet. Just wait a moment.
        Navigator: Standing by, sir.
<<jump Done>>
===

title: SecondStar
---
Navigator: Can you be more specific?
    -> Captain: I cannot, no.
        Navigator: Right away, sir.
    -> Captain: ... that one *gestures*
        Navigator: Very good, sir.
<<jump Done>>
===

title: Done
---
Navigator: Being a Navigator sure is hard work!
===

将对话片段分成节点可以帮助编写更整洁的文件,随着文件的增长,这些文件更容易编辑。

当你使用 <<jump>> 命令,它们将在 Visual Studio Code 的 Yarn Spinner 的图形视图中显示为一条线,带有指向要跳转到的节点的箭头:

<> 命令在图形视图中可视化。

如果您使用 <<jump>> 命令跳转到不同的节点 .yarn 文件中,它将被可视化为一条通向小圆圈的线:

编写一些跳转命令

步骤1

写一个有几个节点的简单故事。

以合理的方式将您的故事分散到各个节点上。

步骤2

使用 <<jump>> 在故事中的节点之间移动的命令。

确保在每个节点中指定要跳转到的节点的名称 <<jump>> 命令。

步骤3

使用预览运行您的故事。

尝试一下,并确保跳跃的表现符合您的预期。

接下来,了解一下 Jump Command 的近亲, detour.md.