[Suggestion] Story Variables and Conditional Branches

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:
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)
 
a little copy/paste to create more pages isn't that big of a deal
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.
 
(a little copy/paste to create more pages isn't that big of a deal)

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.
 
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.
 
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! :)
 
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.
 
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.

Is there a way to block certain text based on variables like the example below?
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:
[...]
Who rings the door?
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
It was your ex {ExName}. You still can't believe you slept with her during the dinner party. No matter how bad the break-up, you still feel strong attraction to her.

Thread 4B:
Condition "Sexed" = false
It was your ex {ExName}. You were surprised to see her at the dinner party. No matter how bad the break-up, you still feel strong attraction to her.
 
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.
 
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.
 
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
 
I am currently using numerical variables as a hackish workaround. I add zero to the clown_is_dead variable in the thread right before the clownicide one- this sets the variable up if it doesn't already exist but does not change its value if it does. I use clown_is_dead<1 as a precondition, and add one to the variable in the thread where I kill him. This gets the logic to work the way I want but does not tip the reader off too soon.

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.
 
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.

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.
 
Back
Top