The *else command is only ever used in combination with the *if command, and sometimes also including the *elseif (or *elsif ) command.
Usage
This command is used as follows:
*if (exam_passed) You passed the exam! *finish *else You failed the exam! *finish
For example, if the boolean (true or false) variable "exam_passed" is true, it will display this:
You passed the exam!
However, if the variable "exam_passed" is not true (i.e. is false), it will pass to *else and instead display this:
You failed the exam!
The above is a simple example as one or the other must be true (it's either true or false), but the *else command is most useful as a "catch-all", where any / all preceding *if or *elseif (or *elsif ) conditions are not met. *else should never be given a specific condition of its own as it essentially means "If none of the above conditions apply, then do this".
Note
In those cases where you are using complex *if / *elseif conditions, one of which is intended to always apply in order for your code to work as intended, consider using the final *else as a debugging aid. It could, for example, display an error message saying something like: "Error: none of the conditions in Label XYZ applied", which might also be followed by a listing of such as current relevant Stats values or any other variables checked in these conditions, to help track down why none of the vital conditions applied in this particular case.
Useful links
For more information on the "boolean" (true / false) data type, read the corresponding article.
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 |