Startup.txt

startup.txt is one of the two default text files (the other being choicescript_stats.txtarrow-up-right) required by every ChoiceScript game, which cannot be renamed and must follow a prescribed format. startup.txt是每个ChoiceScript游戏必需的两个默认文本文件之一(另一个是choicescript_stats.txt),该文件不可重命名且必须遵循规定的格式。

startup.txt can be found in the "scenes" (..\web\mygame\scenes) folder of your ChoiceScript directory. startup.txt位于你的ChoiceScript目录中的"scenes"文件夹(..\web\mygame\scenes)内。

NB: All other text files you create for your game (collectively referred to as its "scene filesarrow-up-right") should also be placed in the "scenes" folder. However, you are free to name additional scene files whatever you like, provided that there are no spaces or capital letters used in the file name and that each name is unique. 注意:你为游戏创建的所有其他文本文件(统称为"场景文件")也应放置在"scenes"文件夹中。不过,你可以自由命名其他场景文件,只要文件名中不使用空格或大写字母,且每个名称都是唯一的即可。

What is startup.txt used for? startup.txt 有什么用途?

Game title and author name 游戏标题与作者姓名

startup.txt serves three main purposes. The first is to name your game using the *titlearrow-up-right command and identify the Author using the *authorarrow-up-right command. These should be the first two commands used in that file (with the only exception being any *commentarrow-up-right inserted at the very top). startup.txt 主要服务于三个目的。首先是使用 *title 命令为游戏命名,并使用 *author 命令标识作者。这两个命令应该是该文件中首先使用的命令(唯一的例外是在最顶部插入的任何 *comment 注释)。

Listing scenes 场景列表

The second essential purpose of startup.txt, and the next command listed in this file, should be your game's *scene_listarrow-up-right. Immediately below this command (and indentedarrow-up-right accordingly) is where you list the new scenearrow-up-right files as you add them to your game, which tells ChoiceScript in what sequence your scenes are intended to appear in the game. Think of them as Chapters in an ordinary book: ChoiceScript needs to know that chapter2 (or whatever you choose to call your scene) follows chapter1, in sequence. Then, when ChoiceScript hits an end-of-scene *finisharrow-up-right command in one scene file, it will know -- from the *scene_list in startup.txt -- exactly which scene file it should load next. startup.txt 的第二个核心用途,也是该文件中列出的下一条指令,应是游戏的 *scene_list。紧接此指令下方(并相应缩进)的位置,用于列出添加到游戏中的新场景文件,这告知 ChoiceScript 游戏中各场景的预设出现顺序。可将它们视作普通书籍中的章节:ChoiceScript 需要知道 chapter2(或您为场景命名的任何名称)按顺序接在 chapter1 之后。这样,当 ChoiceScript 在一个场景文件中遇到 *finish 场景结束指令时,它将根据 startup.txt 中的 *scene_list 准确知道接下来应加载哪个场景文件。

Declaring permanent variables 声明永久变量

The third important purpose of startup.txt is to "declare" the permanent variablesarrow-up-right that your game will use to store necessary information -- game data, in essence -- for use in your story scripting and on the game's Stats Screenarrow-up-right. This essential information includes the unique name of each variable, its data typearrow-up-right (either numeric, string or boolean) and the default starting value each will contain. Default variables are declared in startup.txt using a series of *createarrow-up-right commands: there is no real limit to the number of these you may use. startup.txt的第三个重要用途是"声明"游戏将用于存储必要信息(本质上是游戏数据)的永久变量,以便在故事脚本和游戏状态屏幕中使用。这些核心信息包括每个变量的唯一名称、数据类型(数值型、字符串型或布尔型)以及每个变量将包含的默认初始值。默认变量在startup.txt中使用一系列*create命令进行声明:这些命令的使用数量实际上没有限制。

Example syntax 示例语法

*title My First ChoiceScript Game

*author Jane Doe

*scene_list
    startup
    chapter1

*create name "Unknown"
*create gold 0
*create backpack false

In this example, our startup.txt file has the game title and scene_list commands properly preceding the list of starting game variables. Our first two scene files - startup and chapter1 - are also listed as required (and that list will grow as we create new scene text files for our game and add them to the scene_list in sequential order). 在这个示例中,我们的startup.txt文件已正确地将游戏标题和场景列表命令置于起始游戏变量列表之前。我们最初的两个场景文件——startup和chapter1——也已按要求列出(随着我们为游戏创建新的场景文本文件并按顺序将其添加到场景列表中,该列表将不断扩展)。

In addition, we have created and named the first three of our game variablesarrow-up-right, each of which is using a different data typearrow-up-right, although there is no real limit to the number of variables we may createarrow-up-right and add here as our game grows and develops -- which is one of the reasons why it's generally a good idea to begin the story itself in the next scene file in the scene_list (in this case 'chapter1'). 此外,我们已经创建并命名了前三个游戏变量,每个变量都使用了不同的数据类型。尽管随着游戏的成长和发展,我们可以创建并添加的变量数量实际上没有限制——这也是为什么通常建议在scene_list中的下一个场景文件(本例中为'chapter1')中开始故事本身的原因之一。

Notes 注意事项

Although the example game which comes with your ChoiceScript download also uses startup.txt to immediately launch into the first part of the example story scripting, note that this is not strictly necessary. For your own game, you may prefer, as some experienced authors do, to limit the use of startup.txt to just the three vital requirements described above, and to start your actual story / game scripting in the first proper scene file. However, startup should still be the very first 'scene' listed under scene_list, regardless. 虽然随ChoiceScript下载附带的示例游戏也使用startup.txt来立即启动示例故事脚本的第一部分,但请注意这并非绝对必要。对于您自己的游戏,您可能更倾向于像一些经验丰富的作者那样,将startup.txt的使用限制在上述三个关键需求范围内,并在第一个正式场景文件中开始实际的故事/游戏脚本编写。但无论如何,startup仍应是scene_list下所列的第一个"场景"。

Note that you do not need to use a *finisharrow-up-right command in startup.txt if it does not contain any actual story scripting; if the last line in this file is a create it will automatically load the next scene in the scene_list. 请注意,如果startup.txt不包含任何实际的故事脚本,则无需在此文件中使用finish命令;若该文件的最后一行是create命令,系统将自动加载*scene_list中的下一个场景。