Learning ChoiceScript: Part 2: Choice, Finish, and Ending

Learning ChoiceScript

ChoiceScript is a scripting language from Choice of Games LLC for creating choose-you-own-adventure games.


 

Optional: Installing and Using ChoiceScript IDE

While ChoiceScript can be written in any text editor, it is often more convenient to use use a dedicated development environment when working on a game. To that end, installing ChoiceScript IDE (CSIDE) is a good recommendation.

Screenshot 2018-08-19 22.51.00

It can be found on its GitHub webpage, and builds can be found on its Releases page. (As of this writing, the current version is 1.1.3. Once installed, it will update to the latest stable version.)

Choice

As introduced in Part 1, ChoiceScript uses commands (keywords proceeded by the star, *, symbol) to change settings like the title and name of the author. Choice is another one of theses.

Screenshot 2018-08-19 22.53.48

Central to ChoiceScript is this command, choice. In order to make decisions, users interact with choice blocks. These start with the command *choice and, for each internal option, is indented with a single hash, #, marking how it should appear. On a new line and indented underneath the options are its outcomes; these blocks will be shown if the choice is made.

Choice

However, when *choice is used without two other keywords, *finish or *ending, ChoiceScript will get confused. After making a choice, something else should happen.

 

Finish

Screenshot 2018-08-19 23.07.11

The command *finish signals the end of a scene. If another scene is after the current one, ChoiceScript will transition to the next one. Otherwise, the game will end.

Choice

 

Ending

Screenshot 2018-08-19 23.12.26

The command *ending works similar to *finish. However, instead of ending the scene, it ends the game. Using the command *ending means that play should end immediately. (Using either *finish or *ending in a single scene game have the same outcome.)

 

Chaining Choices

Screenshot 2018-08-19 23.17.54

A scene need not contain only one choice. The result of making a decision in a scene can lead to more choices. Until ChoiceScript encounters a *finish or *ending, the scene continues.

ChainingChoices

 

GitHub Gist Version:

*title Example
*author Dan Cox
Where will we visit?
*choice
#The woods
We went into the woods!
It was a dark and scary place, but with our lantern, we were able to make our way deeper.
Deep in the woods, we came across a river. Did we try to cross it?
*choice
#Cross river
We did not make it across the river and were swept downstream to our doom!
*ending
#Did not cross river.
We didn't bother with the river and made our way along the path deeper and deeper into the woods.
*finish
#The mountains
We went into the mountains
*finish
#The lake
We went to the lake
*finish

view raw
startup.txt
hosted with ❤ by GitHub