Learning ChoiceScript
- Part 1: Playing “My First ChoiceScript Game”
- Part 2: Choice, Finish, and Ending
- Part 3: Scenes
- Part 4: Using Variables
- Part 5: Text Formatting and Images
- Part 6: Fairmath
- Part 7: Inputs
- Part 8: Labels and Subrountines
- Part 9: Meta Commands
- Part 10: Customizing the Stat Screen
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.
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.
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.
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
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.
Ending
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
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.
GitHub Gist Version:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*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 | |