FANDOM


      This article describes the layout structure of the ChoiceScript game directory and highlights the folders and files of most importance to you as a game developer.

ChoiceScript Game Directory

The main ChoiceScript directory (for our purposes) is as follows:

..\dfabulich-choicescript-515e4ef\web\mygame\scenes

Note that this part -- 515e4ef -- is the actual version number of the files contained herein. It is not sequential.

When you download a newer version (clicking that link will show you the current latest version number) you will need to copy everything from mygame and scenes to the new directory, after deleting the example files in those two new folders. Just to be on the safe side, however, don't delete the old directory itself yet. Instead, rename the main folder of the old version so the directory looks something like this:

..\OLD_dfabulich-choicescript-515e4ef\web\mygame\scenes

This will at least retain a then-working copy of your game, while you continue developing your game using the files copied to the new version folders. You can always delete it at a later date, once completely happy with how your game runs under the new version of ChoiceScript.

ChoiceScript Game Folders

The folders structure of a ChoiceScript game is as follows:

web

    mygame

        scenes

            choicescript_stats.txt

            startup.txt

            [your other scenes .txt files]

        credits.html

        index.html

        mygame.js

    .htaccess

    alertify.css

    alertify.min.js

    index.html

    navigator.js

    persist.js

    scene.js

    style.css

    ui.js

    util.js

All of these files will be explained below, but note that for most ChoiceScript game developers the only files of particular importance are those located in the "mygame" (..\web\mygame) and "scenes" (..\web\mygame\scenes) folders respectively: index.html, startup.txt, choicescript_stats.txt and the scenes .txt files you will create yourself. The other files listed above (predominantly .js -- JavaScript -- ones) are used by ChoiceScript for interpreting your story scripting and displaying your game, and should not generally need to be edited.

Individual ChoiceScript Folders

web

"web" is the main game folder. You can rename this folder to whatever you like.

mygame

"mygame" is the folder that contains everything you will need to edit (you can edit everything else as well but you just need more advanced knowledge of JavaScript / ChoiceScript to do that without causing game-stopping errors). You can also rename this folder to anything you like, e.g. a shortened version of your own game name, perhaps.

scenes

"scenes" is the folder that contains all the scenes in which you script your game, as well as the startup.txt and choicescript_stats.txt files.

Individual ChoiceScript Files

choicescript_stats.txt

The file "choicescript_stats.txt" is used to display important information about the game and it's protagonist. This is the file that controls what is displayed when the player clicks on the "Show Stats" button in game.

startup.txt

startup.txt is a vital file. The game will not start without it. This is where the title and name of the author of the game is set, where permanent variables that store the game's data are defined, and where the game's scenes are listed sequentially for reference by ChoiceScript.

index.html (in the mygame folder)

index.html is the file that you use to actually run your game (you can open it with any browser). The only thing you must not do is open it in Google Chrome; Google Chrome won't load external scripts locally (i.e. it won't run your game scenes) unless published on another website like ChoiceOfGames, Dashingdon or Webs.

This "index.html" is also the file to edit to change the displayed title of your game. You can also change the description of the game that search engines will see, and you can change the default text that is shown at the bottom of each page displayed in the game.

mygame.js

The JavaScript file mygame.js used to be very important to ChoiceScript game developers as described in its own article. While this file is still important and usable, everything it used to do is now done more simply in startup.txt. Few authors ever need to edit this file anymore.

.htaccess

These are not directly related to ChoiceScript, and are not necessary for it to work. Htaccess is a configuration file for web servers which has no important information.

index.html (in the web folder)

Nothing that you change here makes a difference (i.e. changing the font, pixel size and background color won't make a difference, since they are changed in the style.css file), but they are all needed so don't remove anything. The only thing you could change in this file and that would make a difference is the "Loading..." text, so that when the game loads, the text that's displayed while loading changes accordingly (N.B. this index.html file is not covered in the index.html article, because it only has one feature; everything of use concerning this file has been covered here).

navigator.js

This file is the file that makes the sceneNavigator in mygame.js and the *scene list command in startup.txt work properly.

persist.js

Has an unknown use.

scene.js

Interprets all the commands used in ChoiceScript (i.e. *set , *goto , *finish , *label etc.).

style.css

style.css controls the aesthetic display of the game, such as the background color of the game, its font and the color, width and position of the stats bars on the stats screen.

ui.js

Contains the loading procedure (you may notice it between scenes at most choicescript games), the stats button that displays, some of the more advanced commands (like *image and *share_this_game), that checks if a game is purchased or not (only if the game is published on ChoiceOfGames) and that displays advertisements (again, ChoiceOfGames only).

util.js

This is the file that handles the load/save system.

Related articles

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.