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.
Scenes
In Part 2, the commands*finish and *ending were introduced. Depending on if there was another scene or not, *finish would act like *ending. If there was another scene, however, the game would progress forward.
Scenes are listed with the *scene_list command as part of the startup file. Like other commands, it should be on a line by itself and the scenes (other files) should be listed under it and indented on their own lines.
By default, encountering a *finish will mean that a scene transition will take place.
However, there is also a command for forcing a scene transition: *goto_scene.
Using *goto_scene, scenes can be used in multiple places and loops constructed where choices goto other, previous scenes.
In order for either the default *finish or *goto_scene to work, scenes need to exist as files. Those listed as part of *scene_list will be run in order. Others can be accessed through using the *goto_scene command.
GitHib 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
You didn't survive the trip! | |
*ending |
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
Finally, we arrived at the house. | |
Did we knock on the door or try to barge in without warning? | |
*choice | |
#Knock on the door | |
*finish | |
#Barge in! | |
We got caught in a trap! | |
*goto_scene badendings | |
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 | |
*scene_list | |
startup | |
house | |
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! | |
*goto_scene badendings | |
#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 | |