[if else] branches in a chapter

Discussion in 'CHYOA General' started by Hexenweib, Jan 14, 2024.

  1. Hexenweib

    Hexenweib Virgin

    Hi hey hi and hello!

    I am working on a quite interactive story with lots of variables being tracked and running in the background.
    I know it's possible to do "{if *value*<32}here would be awesome text only visible to some readers {endif}.

    Now I wanted to do something like a notesheet where the reader can see some of the hidden tracked values and get a different text based on how high the value is.
    Is that even possible? And if yes, what's the command for that?

    Thank you and have a great day!
     
    MidbossMan likes this.
  2. MidbossMan

    MidbossMan Really Really Experienced

    Yes, I do some things like that in a few of my game stories! Goodbye Girls, for instance, has dossiers you can check that get filled out with more info as you reach values or milestones of points.

    You've got the right idea with the if and endif statements already. As for how to create a notesheet the player can reference to see their achievements / unlocks / etc., there's two ways I'd recommend depending how your story is built:

    1) If you're doing a hub like I often do, i.e. looping back to a chapter that most other branches build off of, make a new chapter there called "Notesheet" or whatever you like. Put your content there. Instead of making a link chapter that goes back or adding more chapters to that, simply instruct the player to hit previous chapter. This way, they can view all of those secrets, then get right back to the story! It also only requires one chapter and no links this way.

    2) if you're instead doing a single long story that doesn't loop back to a hub (typical style I see), I'd recommend adding the notesheet as a choice, either every chapter or at specific checkpoints you like. The player can go in, view the secrets, then hit previous chapter to go right back where they were in the story! You don't have to make a new chapter each time you want to let them in to view the secret notes-- you can just use a link chapter instead, if you like. That may get confusing if the player isn't in game mode, since I'm not positive previous chapter will function the same in that case.
     
  3. Hexenweib

    Hexenweib Virgin

    Oh, That wasn't the problem.
    I wanted to know if a command exists to cap the if statement. As in A message gets displayed at low level, another gets displayed at mid level in a particular stat and so on. ( 1 - 10 Oh wow, that wasn't much, 11 -20 Getting better here!, etc.)
     
  4. moonblack

    moonblack CHYOA Guru

  5. Hexenweib

    Hexenweib Virgin

    Exactly! Thank you very much!
     
  6. gene.sis

    gene.sis CHYOA Guru

    I guess you want to do sth like
    Strength: {if strength < 6}Weak!{elseif strength < 11}Average!{elseif strength < 16}Strong!{else}Very strong!{endif}
    In that case, you need to make sure that you check the values in the right order. If you go from low to high values, use <. If you go from high to low values, use >.

    If you want to show the actual number, you could do
    Strength: {strength}


    That should be the easiest way in the described case.
    But if you want to have some additional chapters there, there would be another way.
    Let's say the story builds along a timeline but you still can visit a shop from time to time. So you might want to create the shop environment only once and jump to it and then back to the story.
    To do that, create a link chapter to the shop's entrance chapter. Within the link chapter, set a variable "origin" (or sth) to 1.
    When the reader is ready to leave the shop, provide a link chapter with the condition "origin" = 1 that links back to the origin chapter. (Make sure that the destination chapter doesn't have Score Changes or it might mess up the reader's Score.)
    When you link to the shop from another chapter, set "origin" to 2 and provide another link chapter to go back with the condition "origin" = 0. (And so on.)
    (I haven't tested this yet but I think it should work.)
     
    Last edited: Jan 15, 2024