[Suggestion] Story Variables and Conditional Branches

Discussion in 'Site Feedback' started by Semeny Licket, Sep 1, 2014.

  1. sepia

    sepia Virgin

    I only tested out a couple of simple things so I don't know if I'm the best at explaining this, but for instance if you wanted to track character relationships, you could create two variables, BOB and SUE. There's a way to put scripts into the links so that if certain choices are clicked it sets or changes them.

    There are basic IF THEN statements so that you can tell a link to take the reader to different pages depending on what amount the variables at, so you could have them get a variety of scenes or endings based on their relationships with Bob or Sue. This is the part I thought was the most useful, it would mean if I was keeping other parts of the story the same I wouldn't have to have separate copies of all the pages leading up to the different versions of their scenes.

    It looks like there's a way to have alternate text show up on a page based on the variables too but I didn't experiment around with that, though you could put something like %%BOB%% directly on the page to display the number to the reader if you wanted to. It looks like the writers there use it to track health for RPG style stories.

    But I don't know how practical any of that would be to implement here without a lot of programming.
     
    Last edited: May 15, 2016
  2. Mr.B.

    Mr.B. Moderator

    Honestly I prefer the actual chyoa system (to be improved, I guess)
    It should be clear what the reader is missing/can't access (actually, I'm not sure if on chyoa the reader can see what choice is blocked and the requisites for it..if not, that's a mistake imo) as it should be clear in the "story tree" which are the different paths (a little copy/paste to create more pages isn't that big of a deal)
     
  3. gene.sis

    gene.sis CHYOA Guru

    well... that depends on the intended use.
    e.g. if you set up a strip game
    I've seen a story like that on chyoa and it branched out in about 50 or 100 branches when the story was only 3 chapters deep.
    If you add the chance to dress up at the beginning, you can multiply all possible sets of clothing (and even colors) with the possible orders of undressing them.
    So then it is a big deal.
     
  4. sepia

    sepia Virgin

    For a smaller scale story, maybe, but if you're talking about hundreds of pages it does become one. Having global scripts tracking things throughout the story would be immensely helpful in some situations too. A dungeon romp style adventure with stats for arousal and health, hunger, tiredness, submission vs dominance, clothing and armor levels tracked, and alternate monster encounters depending on class and gender and other factors is something I've thought about a lot and would love to do, but without something like this to streamline it all I'd be looking at thousands of pages with most of them duplicates except for a few lines.

    The exact same system isn't needed of course, but if there were an easy way to track variables and run simple scripts on a site like this it would open up so many possibilities.
     
    gene.sis likes this.
  5. Mr.B.

    Mr.B. Moderator

    I'm talking about real stories, not strip poker on text or similar experiments.
    What renders a story good to read is a mix of good writing and a reasonable number of variations. By reasonable I mean it can happen, when you design a complex story, to have multiple paths with a lot of common text...from 3 to 5 different paths, rarely more. And we have linked threads, plus the new "game" system. We don't need a new system (that can be incompatible with what we already have).
    All my personal opinion oc.
     
  6. Javalar

    Javalar Really Experienced

    Oh.

    I wasn't aware that the system of variables and conditions was so new here on CHOYA. I joined after it was introduced and just started my first story using this right away. It was just what I was looking for and it feels great so far! :)
     
  7. umbra

    umbra Experienced

    I think I misunderstood how variables were going to be used. Is there a way to block certain text based on variables like the example below?

    Example; Var Sexed = True
    Var ExName = Poison Ivy

    It was your ex {ExName}. [if Sexed = True (You still can't believe you slept with her during the dinner party.) else (You were surprised to see her at the dinner party.)] No matter how bad the break-up, you still feel strong attraction to her.

    Text displayed would be
    It was your ex Poison Ivy. You still can't believe you slept with her during the dinner party. No matter how bad the break-up, you still feel a strong attraction to her.
     
  8. gene.sis

    gene.sis CHYOA Guru

    There are two different variable functionalities:
    1. Immersion variables of type string. They can be defined at the customize field on the chapters page and used with curly brackets inside the text.

    2. Variables for conditional branches of type number(integer), percentage(integer) and boolean. They can be defined on the "edit chapter" page. Related conditions can be defined on the same page. Currently, variables and conditions can only be used for branching.

    There isn't a way to use conditions directly within the text yet.

    At the moment, you can use following structure:

    Thread 2A/2B:
    You made a decision, where the boolean variable "Sexed" is set(changed) to true or false.

    Thread 3:
    Answers:
    It was your ex {ExName} <- Thread 4A. Only clickable if Sexed is set on true
    It was your ex {ExName} <- Thread 4B. Only clickable if Sexed is set on false

    Thread 4A:
    Condition "Sexed" = true
    Thread 4B:
    Condition "Sexed" = false
     
  9. umbra

    umbra Experienced

    Yeah. I was afraid of that. I was trying to avoid having multiple threads that where functionally similar but descriptively different. Just means I have to readjust how I was going to start.

    Edit. Thank you.
     
  10. Flauros

    Flauros Virgin

    It is kind of possible to perform text substitutions using variables. Mainly because Chyoa doesn't prevent authors from placing Javascript inside their chapters.

    As such, it's possible to write a script which peeks at the description lists in the sidebar and extracts the (numerical) variables. Then you can compare them against conditions and make substitutions accordingly.

    I've had some success with this method in my drafts, but I don't really recommend it. It's a very hackish, brittle way of doing things - like trying to force a Twine story into Chyoa's interface by use of Javascript. And I think it could be a nightmare to coordinate it with other authors.

    In fact, I'm surprised that Chyoa gives authors so much access to Javascript in the first place. I don't think that's intentional.
     
    Friedman likes this.
  11. bsnick

    bsnick Experienced

    https://chyoa.com/chapter/Joanne-refuses-to-answer-such-an-invasive-question.242327

    I typed up the chapter, and even before putting in the follow-up question tried to add a variable. Since it seems to default to a check/uncheck variable I clicked on the % option below, removed the check/uncheck variable, put the name into the % variable, then the percentage amount (100%). Then I clicked on the name, thinking to change it and was kicked to the screen that says 'Your chapter has been submitted and awaits approval'. I went back into it via editting the page, and the variable was no longer there. Repeating the above steps produced the same result.

    In another branch I tried to make the percentage on another attribute a negative number. Instead it came out as a positive
     
  12. lordxorph

    lordxorph Experienced

    .
     
    Last edited: Jul 5, 2018
  13. lordxorph

    lordxorph Experienced

    .
     
    Last edited: Jul 5, 2018
  14. gene.sis

    gene.sis CHYOA Guru

    Variables could maybe get an attribute "invisible". This could be used to save NPC-attributes (attitude, arousal, ...), or own stats, you are not sure about (remaining stamina, time to orgasm, ...).
     
    moonblack and lordxorph like this.
  15. lordxorph

    lordxorph Experienced

    .
     
    Last edited: Jul 5, 2018
  16. Javalar

    Javalar Really Experienced

    Some interesting ideas here. Keep it coming!
     
  17. umbra

    umbra Experienced

    If you're trying to hide something, you could add dummy variables and, while less than ideal, misleading or uninformative variable names. If you see a variable labeled MeetSlutpuppy, your probably not going to be looking for dead clowns to use your example. I agree having the option to hide variables from readers would be nice. I can think of another way but it's convoluted and probably not worth the effort unless you've finished writing your story.
     
  18. Friedman

    Friedman Administrator

    Thanks for the hint! We've removed this potential security risk. But it seems as if you were the first who used JS in chapters.
     
    Flauros likes this.
  19. Flauros

    Flauros Virgin

    That's probably for the best.

    However, this seems to have introduced a slight bug. The links no longer display properly on the author's version of the linking pages.

    Example: http://i.imgur.com/Y3LGxAd.png
     
    Last edited: Jun 5, 2016
    Friedman likes this.
  20. lordxorph

    lordxorph Experienced

    .
     
    Last edited: Jul 5, 2018
    Friedman likes this.