Want to support CHYOA?
Disable your Ad Blocker! Thanks :)

Chapter 2 by gene.sis gene.sis

Choose from different showcases:

Limit Values (Positive Minimum) e.g. Age

Settings

You can see the working example here.


The settings of this chapter:
Conditions:
-

Score Changes:
00 Age - 100000
00 Age - 18
00 Age + 100000
00 Age + 18

Notes: The variable "Age" doesn't exist before this chapter. For that reason, its initial Score is 0 before the Score Changes are carried out. Due to the Score Changes, the variable will be changed to the minimum value of 18.

Chapter source code:
{if@ variable > 100000}**Please start the Game Mode on the right tab under "Score" or click [here](https://chyoa.com/story/Conditional-Branches-Showcase-%28examples%29.9950?game=start) before navigating back to this chapter.**{else}A numerical variable has a minimum value of -100000 and a maximum value of 100000. Sometimes, other limits are necessary. In this example, the minimum value of the variable Age is limited to 18. You can use the chapter options to modify the variable Age, but it will not fall below 18.

The current value of the variable Age is ____**{Age}**____.{endif}

Notes:
Whenever the chapter is accessed, the same value is first subtracted and then added to the variable Age. In the given example, any Age of
18 or above will keep its original value. If Age is lower than 18, the first two Score Changes of Age - 100000 and Age - 18 will lead to a value below -100000. As numerical variables can only have values from -100000 to 100000, the value will be capped at -100000. The third and fourth Score Changes of Age + 100000 and Age + 18 will then result in Age to be 18. (As it isn't possible to have Score Change values above 100000, the calculation needs to be performed in two steps for each direction.)

For a numerical variable, the Score Change values need to be 100000 and minimum value.
For a progress variable, the Score Change value needs to be minimum value . As progress variables have their minimum at 0, only one Score Change is necessary for each direction.

What's next?

Comments

      More fun
      Want to support CHYOA?
      Disable your Ad Blocker! Thanks :)