On to the fun stuff. Most of what you want to mess with is going to be in web/mygame/scenes, so let's go there.
The files that are already in here are for the tutorial game. You can open them up with notepad to see how some of the basic operations in ChoiceScript work, though it can be a little confusing if you're just starting out. This tutorial will cover what's in there, so don't fret too much about it. When you're ready to start, delete everything in the scenes folder except choicescript_stats.txt.
If you did delete choicescript_stats.txt, just open up notepad and save a blank file under that name. The contents of it aren't important right now.
Now, open up a plain text editor (such as notepad) and type up the first page of your game. Some people will start with an introductory paragraph to their game, others will jump right into the action. What you type is up to you.
At this point, you want to save the file in your web/mygame/scenes folder under any name you want. Just make sure of these two things:
You're well on your way to making a scene! However, it won't show up unless we tell ChoiceScript that we want it to, so let's do that now. Open web/mygame/mygame.js with your text editor and find the scene list.
The formatting from here on is tricky, so the easiest thing to do is replace what's already in the quotation marks. The first scene listed is "startup" so let's replace that with your scene's filename.
The rest of the scene names can be deleted, although it might be easier to simply change them as you go. Keep in mind that they will cause errors if you attempt to run the game with them still in place! Go ahead and save that file, but don't close it. You'll be using it again soon.
Congratulations! You have your first scene! It's pretty boring, though, so let's open up our first scene again and add to it.
If you want to add another page right after the one you just wrote, go to the next line and type in *page_break. Now you can begin on the next line to make your second page.
Eventually, you're going to want to put in a choice, but before you do, you have to make a major choice of your own. ChoiceScript will accept any formatting indentation that you choose to use as long as it's consistant. Remember this decision because you're going to be using it throughout the entire file.
For the purposes of this tutorial, I will be using four spaces everytime I indent, but use whatever's easiest for you.
To start a choice, type *choice on a new line. On the next line, indent the way you've chosen and type in #option1, where "option1" is the choice's text. Add as many choices as you like after that, each on it's own line to form a block of choices.
These choices all have to do something, so let's write in some effects. Go to a new line after your first choice and indent twice. This makes a block within your choice block. This new block has to end with either *finish, *goto_scene, or *goto. Otherwise, an error will occur in your game.
The *finish command will move the game to the next scene listed in your mygame.js file. Since you don't have another scene, this will simply end the game (or cause an error if you didn't remove the default scene names from the list).
The *goto_scene command works much like the *finish command, but it will move to a specified scene that you type in after the command. In my example, elsewhere_in_ocean.txt does not exist yet, and would cause an error.
The *goto command works like the *goto_scene command, but moves to a specified *label within the same scene. In my example, I added *label what_now after the choices so that it wouldn't cause an error.
For now, you probably want to stick with the *goto command, so make sure there's a *label to jump to after your *choice block that continues on with the story.
Now you've got a branching story in the works, but you probably want to use some stats pretty soon. The first thing you have to do is go back to your mygame.js file and declare these amazing stats. Find this section:
The rules for listing your stats are similar to the ones for listing your scenes, except it doesn't matter what order they're in and they must be listed here if you want them to apply to your entire game. Remember, no caps and no spaces when naming them! The basic format is
There are several diferent values you can use for your stats.
Either copy and paste the previous section with all of your starting stats, or erase the default stats and uncomment the last line by deleting the // and the space that follows it.
Congrats! Now your game has potential stats! In order for them to be of any use, however, you need alter them in your scene. In order to alter a stat, you use the *set command like this:
*set stat_name value
This will change the value to a new value. You can also try these to alter an existing numerical value:
*set stat_name +value
*set stat_name -value
*set stat_name stat_name2
*set stat_name /(stat_name2 *2)
It can get pretty complicated from there, but I'll go over those details once we're through with the basics. For most games, you probably won't need to do more than add or subtract values or enter a string of text within quotation marks.
*set stat_name "value"
While you could technically keep your entire game in a single scene, it's often easier to orgainize your work into different files (plus, it cuts down on the time it takes for your game to load).
To make another scene, just open up a new text document save it in the scenes folder.
Now, if you want it to load as soon as your first scene is done, go back to your mygame.js and list it right after your first scene.
By now, you probably want to see the fruit of your labor. Easy enough. Just save everything that you've been working on and open the web/mygame folder. To run your game, open index.html with a web browser.
To run your game, open index.html with a web browser. Be aware
If you come across an error, don't worry. IE and Firefox will tell you exactly where it is in the popup dialogue box.
With these few commands, you can do quite a bit with ChoiceScript. Try getting the hang of those before moving on to the next section.