Learning ChoiceScript: Part 3: Scenes

Learning ChoiceScript

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.

Screenshot 2018-08-20 13.04.13

By default, encountering a *finish will mean that a scene transition will take place.

Scenes

However, there is also a command for forcing a scene transition: *goto_scene.

Screenshot 2018-08-20 13.09.50

Using *goto_scene, scenes can be used in multiple places and loops constructed where choices goto other, previous scenes.

GotoScenes

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.

Screenshot 2018-08-20 13.16.30

 

GitHib Gist Version:

You didn't survive the trip!
*ending

view raw
badendings.txt
hosted with ❤ by GitHub

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

view raw
house.txt
hosted with ❤ by GitHub

*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

view raw
startup.txt
hosted with ❤ by GitHub