ChoiceScript Wiki
Advertisement

      A scene is the basic file of ChoiceScript, containing your story narrative as well as the scripting (simple programming, in essence, also often referred to as "the code") necessary to turn it into a ChoiceScript game. Scene files are located in the scenes folder of the game directory (..\web\mygame\scenes).

Format and naming

A scene file must use only basic text format so should only ever be edited using a standard Text Editor such as Notepad++. Furthermore, a scene file must always be saved with the file extension .txt. You may however name each individual file whatever you like: it is equally common to use descriptive names such as "dungeon.txt" as it is to use sequential names like "chapter3.txt". The actual players of your game do not themselves ever see your individual file names. Scene file names should not contain any spaces or capital letters.

When you create a new scene .txt file in your "scenes" folder (..web\mygame\scenes) remember to edit startup.txt and add the new scene name (excluding only the .txt file extension) to your *scene_list there, in sequential order. By this simple means you are effectively adding the future content of that file to your game.

Scene file size limitations

There is no hard and fast rule where the size of a single scene file is concerned, but generally speaking it is perhaps not wise to often exceed about 250k (or, say, 2,500 lines of code with dense narrative) due to possible issues with loading speed -- especially when played in a web browser with a poor internet connection. Bear in mind that this is very much a global medium and not everyone enjoys the latest technology.

Moreover, there is no limit to the actual number of individual scene .txt files you can include in your game, using the *finish and / or *goto_scene commands to string them together into a complete and (almost) seamless whole, loading each scene file in turn as required, and even reloading earlier files if needed. For this reason alone there is rarely a good reason to ever use excessive file sizes in your game.

Note that it is also possible to load new scenes completely at random, using *goto_random_scene, although this is rarely a good idea except for games of a very particular nature and design.

choicescript.stats.txt

In addition to your own scene files and startup.txt, there is one other essential game file always located in the "scenes" folder, called choicescript_stats.txt This file governs the appearance, layout and content of the Stats Screen when a player clicks the Show Stats button in your game. It can be edited in the same way as an ordinary scene file.

NB: If your game does not use Stats of any description, this file can be deleted. However, to avoid generating an error it will also be necessary to remove from your game the actual Stats Button itself. Doing so will probably render your game unpublishable by Choice of Games.

Next Tutorial Article: Variable types

Related articles

Advertisement