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.
Inputs
While most ChoiceScript games use text and choices to drive their stories, there is also functionality to supply input: the commands *input_text and *input_number.
Text
The command *input_text, as it name implies, shows a text box for the user to enter text. The variable name should follow the command and will be where the entered text will be saved.
Numbers
Similar to *input_text, the command *input_number provides the user the ability to enter numbers instead of text. However, while *input_text allows for entering any amount of text, *input_number must be given a range from the minimum and to a maximum.
GitHub Gist Version:
We stood before the large gate and looked up at the guards. They looked down at us. There was a tense moment before they spoke. | |
[b]What's the password?[/b] | |
*input_number password 0 30 | |
*if password = 16 | |
We passed through gate. | |
*finish | |
*else | |
The guards grunted a response. "Wrong answer." | |
*finish | |