CJW (Message Wall | contribs) m (Fixed indentation issues with code example) Tag: Visual edit |
CJW (Message Wall | contribs) m (Fixed indentation in code sample.) Tag: Visual edit |
||
Line 10: | Line 10: | ||
== Usage == |
== Usage == |
||
Here's how to use it: |
Here's how to use it: |
||
− | *if happiness <= 10 |
+ | *if happiness <= 10<br> |
⚫ | |||
− | |||
⚫ | |||
− | <nowiki> </nowiki> You're very sad. |
||
⚫ | |||
− | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | |||
− | * |
+ | *elseif (happiness > 50) and (happiness <= 70)<br> |
⚫ | |||
− | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | |||
⚫ | |||
+ | *finish<br> |
||
⚫ | |||
+ | You're very happy!<br> |
||
*finish |
*finish |
||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | <nowiki> </nowiki> *finish |
||
This makes it so that only one of these conditions can be true. If the first condition isn't true (if happiness is equal to 30 for example) then it will check if the next *elseif condition is met, if it is not, it will move on to the next, and on and on until there are no more conditions to check. (In this example, if all the conditions fail, the output will default to "You're very happy!" because of the final [[else|*else]] statement.) |
This makes it so that only one of these conditions can be true. If the first condition isn't true (if happiness is equal to 30 for example) then it will check if the next *elseif condition is met, if it is not, it will move on to the next, and on and on until there are no more conditions to check. (In this example, if all the conditions fail, the output will default to "You're very happy!" because of the final [[else|*else]] statement.) |
||
Revision as of 21:57, 25 April 2020
The *elseif command (also spelled *elsif) is only used after an *if command to specify an alternative if the initial *if condition fails.
Usage
Here's how to use it:
*if happiness <= 10
You're very sad.
*finish
*elseif (happiness > 10) and (happiness <= 50)
You're sad.
*finish
*elseif (happiness > 50) and (happiness <= 70)
You're moderately happy.
*finish
*elseif (happiness > 70) and (happiness <= 90)
You're happy!
*finish
*else
You're very happy!
*finish
This makes it so that only one of these conditions can be true. If the first condition isn't true (if happiness is equal to 30 for example) then it will check if the next *elseif condition is met, if it is not, it will move on to the next, and on and on until there are no more conditions to check. (In this example, if all the conditions fail, the output will default to "You're very happy!" because of the final *else statement.)
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 |