The *input_number command allows the player to input a number into a field.
It works the same way as *input_text, with two major differences:
- the player is only allowed to input numeric characters and when writing the command,
- it's not enough to specify a variable; you have to specify a minimum and maximum number so that the player can't write a number smaller than the minimum one or higher than the maximum one you specify
Usage
In order to use this command, you must *create a variable in startup.txt (or create a *temp (temporary) variable in the scene file) to be modified by the player's input.
*temp coins 0 How many gold coins do you have? *input_number coins 50 100
In this example, the player may input a certain number of "coins", which modifies the "coin" variable. The game will only allow the player to input a number between 50 and 100.
Known input_number Bug
Note that there is a known *input_number related game-stopping bug when playing a ChoiceScript game using Microsoft's Internet Explorer. It does not occur in any other browsers, and there is no known workaround.
| More commands / functions | |
| Choice | *choice, *fake_choice, *disable_reuse, *hide_reuse, *allow_reuse, *selectable_if |
|---|---|
| Variable | *create, *temp, *set, Arithmetic operators, *delete, *input_number, *input_text, *print, *rand |
| Conditional | *if, *elseif, *else, Multireplace |
| Goto | *label, *goto, *goto_scene, *goto_random_scene, *gosub, *gosub_scene, *finish |
| Formatting | Bold text, Italic text, *image, *line_break, *page_break, *link, *stat_chart |
| Miscellaneous | *comment, *scene_list, *title, *author, *achieve, *achievement, *check_achievements, *bug, *ending, *more_games, *share_this_game, *show_password, *script, Implicit Control Flow |