Goto_scene
The *goto_scene command is used in the same general manner as an ordinary *goto, but instead of a label name reference within the same scene file, it requires a specific scene name to load; this being a particular .txt file in your "scenes" (..\mygame\scenes) folder. *goto_scene can load any scene file, whether or not that file is included in the *scene_list section of startup.txt. *goto_scene 命令的使用方式与普通的 *goto 大致相同,但区别在于:它需要的不是同一场景文件内的标签名引用,而是一个要加载的特定场景名称;这指的是你 "scenes" 文件夹(路径为 ..\mygame\scenes)中一个具体的 .txt 文件。*goto_scene 可以加载任何场景文件,无论该文件是否包含在 startup.txt 的 *scene_list 部分中。
Usage 用法
*goto_scene is one of two very different commands enabling the proper use of multiple different scene .txt files in your game (thereby essentially making it unlimited in scope and size); the other being the *finish command. *goto_scene 是两个截然不同的命令之一,它们使得在你的游戏中正确使用多个不同的场景 .txt 文件成为可能(从而在范围和规模上基本实现了无限可能);另一个命令是 *finish。
There are some key differences between *goto_scene and *finish: *goto_scene 和 *finish 之间存在一些关键区别:
*goto_scene allows you to jump to any scene in the scenes folder, whereas *finish only loads the next sequential scene in the startup.txt *scene_list.
*goto_scene 允许你跳转到 scenes 文件夹中的任何场景,而 *finish 仅加载 startup.txt 的 *scene_list 中下一个顺序的场景。
using *goto_scene, you can specify where in the called scene you wish to go by adding the name of a label in that scene. 使用 *goto_scene 时,你可以通过添加目标场景中某个标签的名称来指定希望跳转到该场景的哪个位置。 *goto_scene is typically used as follows: *goto_scene 的典型用法如下:
Where do you want to go?
*choice
#To the park.
You decide to go to the park.
*page_break End of Scene
*goto_scene park
#Home.
You decide to go home.
*page_break End of Scene
*goto_scene home
#To the City Hall.
You decide to go to City Hall.
*page_break End of Scene
*goto_scene cityhallThe scene referenced with a *goto_scene command must exist in the scenes folder. For example, for the above code to work properly, in the scenes folder for this game the following files must be present: 使用 *goto_scene 命令引用的场景必须存在于 scenes 文件夹中。例如,为了使上述代码正常工作,该游戏的 scenes 文件夹中必须包含以下文件:
cityhall.txthome.txtpark.txt
要跳转到被调用场景中的特定 *label,你可以这样写:
例如,如果"home.txt"文件包含多个 *label,其中一个名为 "Fire",你可以通过输入以下内容跳转到该场景的那个部分:
这将跳过home.txt场景中"fire"标签之前的任何内容。
Important note 重要提示
It is worth bearing in mind that any temp variables (and their current values) created in the current scene file will be lost from memory the instant that a new scene file is loaded using the goto_scene command. Where this may cause continuity problems in your story / scripting, you should instead define those variables using the create command in startup.txt. 需要记住的是,当前场景文件中创建的任何temp变量(及其当前值)会在使用goto_scene命令加载新场景文件的瞬间从内存中丢失。若这种情况可能导致故事/脚本的连续性出现问题,则应在startup.txt中使用create命令定义这些变量。
Advanced Scene Scripting Notes 场景与startup.txt [高级场景脚本说明]
Scenes intended to be loaded sequentially, using the finish command, must be included in the scene_list section of the startup.txt file located in the "scenes" (..\web\mygame\scenes) folder. However, if you only ever direct the scene file loading using the specific goto_scene [scene name] command, only your very first, opening scene file need be listed in the scene_list, as its only purpose is to direct a finish command. 计划通过finish命令顺序加载的场景,必须包含在位于"scenes"文件夹(..\web\mygame\scenes)内startup.txt文件的scene_list部分中。然而,如果仅通过特定的goto_scene [场景名称]命令来引导场景文件加载,则只需在scene_list中列出最初的开场场景文件,因为其唯一用途是引导finish命令的执行。
Note also that you should never use goto_scene to return to startup.txt from another scene file without also referencing a specific label to jump to. Doing so will cause ChoiceScript to reset all permanent variables back to their original default values (i.e. on loading it effectively reruns the entire list of create commands present in that file). Referencing a specific label in startup.txt, somewhere below all the create commands, will however avoid this problem. 还需注意,切勿在未指定具体label跳转目标的情况下,使用goto_scene从其他场景文件返回至startup.txt。否则将导致ChoiceScript将所有永久变量重置回初始默认值(即加载时实际上会重新执行该文件中所有create命令)。然而,若在startup.txt中所有create命令之后的位置指定具体label进行跳转,则可避免此问题。