*hide_reuse is one of four specifically *choice-related, conditional command, affecting the display of one or more options (the others being *allow_reuse, *disable_reuse and *selectable_if).
It is only useful when the same *choice is repeated several times, like in a menu or a conversation with a character, where most of the #options end up looping back to the main *choice.
Usage
*hide_reuse can be used in two completely different, separate ways:
- it can hide a single option after the player uses that option,
- it can hide all the used options in the entire scene except for any given a separate condition.
However, it should be noted that either purpose of this command is only of use in those cases where you specifically intend to allow the re-use of some or all parts of a particular *choice statement. In most cases a *choice statement is used only once within a particular scene, so a *hide_reuse condition will not be needed.
Hiding a single option after using it once
The following code uses *goto and *label to re-use the same *choice statement when the player chooses either of the first two options. In essence, it allows the player to eat and sleep as many times as they wish -- until they become bored of doing so and opt instead to Go outside.
*label Home What do you want to do? *choice #Eat. You eat and are not hungry anymore. *goto Home #Sleep. You sleep for 10 hours. *goto Home #Go outside. You go outside. *finish
With the addition of a *hide_reuse condition on the Eat and Sleep options, we can still allow this *choice to be re-used, but hide (i.e. not display) any option previously chosen, so the player can Eat or Sleep only once before that option disappears, so finally leaving only the Go outside option available. As follows:
*label Home What do you want to do? *choice *hide_reuse #Eat. You eat and are not hungry anymore. *goto Home *hide_reuse #Sleep. You sleep for 10 hours. *goto Home #Go outside. You go outside. *finish
Note: Remember to always have an exit *choice #option to let the player escape the loop (i.e. the "#Go outside" option above)! You will get a "No selectable options" error if all the options have been exhausted and there is no escape option.
Hiding all the options in the entire scene when used once
Alternatively, we can make all *choice options act as if they have the *hide_reuse condition, by simply placing the *hide_reuse command on a line of its own near the very top of each scene file, before any actual *choice.
*hide_reuse *label Home What do you want to do? *choice #Eat. You eat and are not hungry anymore. *goto Home #Sleep. You sleep for 10 hours. *goto Home #Go outside. You go outside. *finish
In the above example, each option will be displayed only until it has been selected by the player, and thereafter it will be hidden, due to that prevalent *hide_reuse command at the top of the scene. However, it's also possible to override a prevalent *hide_reuse command with its opposite, *allow_reuse:
*hide_reuse *label Home What do you want to do? *choice #Eat. You eat and are not hungry anymore. *goto Home *allow_reuse #Sleep. You sleep for 10 hours. *goto Home #Go outside. You go outside. *finish
In the above example, Eat will be selectable only once (due to the prevalent *hide_reuse) but the player will be allowed to Sleep as many times as they like.
We can also use a *temp command and additional conditional code to limit the number of times a particular option may be chosen. The following example will now allow the player to choose "Sleep" only three times before that option is hidden:
*hide_reuse *temp count 1 *label Home What do you want to do? *choice #Eat. You eat and are not hungry anymore. *goto Home *if count < 4 *allow_reuse #Sleep. *set count + 1 You sleep for 10 hours. *goto Home #Go outside. You go outside. *finish
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 |