Stat Dependant Text

Okay, I’m not sure the title makes any sense so I’ll do my best to explain as I haven’t seen anything that could help me. But, of course, that doesn’t mean an answer doesn’t exist- it just means I haven’t yet found it.

I meant to ask some time ago but it’s becoming important as I continue writing. I want to have text that depends on the player’s stats. For example:

*if (bold >= 55)
     Susan didn't hesitate to wink at the young man, which caused his face to turn cherry red.
    *goto whatever
*if (bold <= 40)
     Susan ducked her head down, feeling a heat rise to her cheeks and a sense of embarrassment.
     *goto whatever

How do I know what variable to pick for this? Is it dependent on stats that I may have in testing? Do I calculate the total percentage per choice that affects the bold stat? Or is it entirely random? Hopefully, this makes sense- :joy:

Also, while I’m here… How does someone code romance? I have a point system for my ROs, so would it be like “you have 8 romance points with this RO so you have the option to make it official or not”.


What variable to pick depends on the situation you set. Choicescript runs the code if the variable you picked meets the requires you set. So *if (bold >= 55) will run the code indented under it, if the bold variable is 55 or over. Otherwise, the code gets skipped.

You can learn more with the community tutorial for scene scripting with a “Scripting conditional text” section.

Or go to the CoG tutorial which has a “Setting and Checking Variables (aka “Stats”)” section.


So… is it still kind of like picking a number at random and not a number I pick based on stats I have when playing in testing?

I think I see your problem! bold is a variable you set yourself, meaning you get to decide what values bold takes on. For example, you could have something earlier in your story like:

"Susan, do you consider yourself brave?"
    #"Yes I consider myself brave!"
         *set bold 60
    #"No, I'm more of a shy gal."
        *set bold 20

(Please excuse my possibly bad indents; tab does not work in forum posts apparently :unamused:)

You could decide to set Susan’s bold variable randomly! ChoiceScript has a thing for randomness! Rand | ChoiceScript Wiki | Fandom

Which, in this case, you could say something like:

Susan is born!
*rand bold 0 100

Which would set ‘bold’ to a number between 0 and 100 randomly, so the player has no say in its determining.

There’s also no rule that says ‘bold’ has to be between any certain numbers, i.e., out of 100. You could also have something like

"Susan, do you consider yourself brave?"
    #"Yes I consider myself brave!"
        *set bold 2
    #"No, I'm more of a shy gal."
        *set bold 0

Bold can take on any metric you so desire! It can be percentage-wise, out of 10, out of 20, out of 3, etc.

You could possibly even do something where you have two other variables, brave and brash, and then later you set bold to brave + brash, if that’s what you prefer!

You have the choice (haha) to make it in whatever way aids your story!


I use opposing stats if that makes any difference? I’m early into writing this next chapter and someone mentioned I should include more variables in writing depending on stats, and I’m like " :open_mouth: Yeah, you’re right!" But I don’t know how to pick the number to determine the flavor text. Such as bold being over a certain number to get certain text. But I’m guessing I just pick it kind of at random…?

“I think if a character is going to flirt back, their bold stat should be at least 50% or more.” Do I even make sense? What is English.

Ohhh, I see what you mean now! Oops! So you’re picking the ‘cutoff’ the bold has to be, in order to unlock the flavor text, at random.

Yeah! That works. I guess it’s important to take into account what ‘stat increases’ so to say the player has had available, so you don’t accidentally create un-reachable flavor text. You could also do it like ‘I need bold to be at least TWICE as timid’ and then set that inequality. But it’s up to you!

1 Like

I should’ve put it in the post but I didn’t think it would make a difference :joy:

I think I understand? I guess??? Lord help me.

What do you mean? Like how do you implement that? The easiest that I could think of right now would be:
This is the simplest form I can think of right now.

in the startup.txt you can put

*create carson_relationship 0

And on some scenes, you can add:

Carson stares at you with a smile.

     #Smile back, trying your best not to blush.
          *set carson_relationship +1
          Blah blah romance

     #Smile back in a friendly manner.
          Blah blah friendly stuff

"Let's go," he says.

Do note that if you require the players to have a “8” relationship points, you will have to make sure that the players can actually reach that goal.

And on the big scene, you can put:

After the dinner, Carson gives you a wide smile.

     *selectable_if (carson_relationship = 8) #Start a relationship with Carson.
          "I like you!"
          *goto relationshipcarson
          *goto goodbyecarson

*label relationshipcarson
You kiss him deeply.

*label goodbyecarson
You bid him farewell.

The first choice will only be selectable if they meet the requirement.

There are so much ways to implement this, but this could possibly work.

(Sorry if it looks messy, my phone is being dumb right now :sweat_smile:)

1 Like

I wasn’t sure how to ask it-- believe it or not, how I asked in the post is the most coherent out of my varieties. :upside_down_face:

My brain isn’t really here to today because even this is lost on me a little. Good grief. I’d like to do flavor text based on relationship stats too but the variable number still confusues me even though it seems to be I just pick at random. Or do “relationship = 4, so this scene comes” or “relationship = 8, so this scene comes up”.

Oh, well you can try…

I’ll use the same code from before.

*if (carson_relationship = "0")
     *goto carsonhatesyou
*if (carson_relationship = "4")
     *goto carsonlikesyou
*if (carson_relationship = "8")
     *goto carsonlovesyou

*label carsonhatesyou
I hate you!

*label carsonlikesyou
I like you!

*label carsonlovesyou
I love you!

You can expand what happens on inside the specific labels.

Man… I’m so sorry Carson. What did I do to deserve this hate? :joy:
Thank you for answering! I’ll keep this thread up a bit just in case as I want to be certain on the flavor text. Even looking at other’s code only helps so much because I’m still like “how do you pick the number??”, although it’s probably just context/situation depending, as another said.

1 Like

Oh, another thing. If you just want to add like a couple of sentences, then you can just not put the *label and *goto and do something like this directly

*if (carson_relationship = "8")
     He kisses you.
He takes a seat at the far end of the room.

If the requirement is met, you’ll see:

He kisses you. He takes a seat at the far end of the room.

If the requirement is not met, then it will just display it as

He takes a seat at the far end of the room.

Also, ignore the cringey writing lmao.

But if you need massive amounts, then you might need to use *goto_scene where it essentially puts you to another txt file. It’s all about preference, really. You just have to find what works for you best.

The links @StorybookParagon gave is much more comprehensive and makes much more sense, so you might want to check those out.

The only way to really pick a good number is through play testing. Go through your game and pick some of the options that increase the stat you’re testing and then look at the stat screen to see how high that stat is. Then you know what a reasonable number is.

If your choices are balanced (i.e. there is an equal opportunity to increase each stat the same amount) then testing one variable should give you a pretty good idea for the others as well.

Please let me know if that makes sense! I’d be happy to elaborate. You can pm me too!

1 Like

I’ve thought about doing that too! I started to in one test but it also seemed the most tedious route, while of course possible.
@whitebear It lets you do that? Dang, I assumed I had to do *label and *goto

Pick a threshold, then play your game a bunch of times and see if it feels like you’re getting the flavor text at the right times based on the choices you’ve made. There’s no absolute right answer; it’s all game-dependent.

But with that said, here are a few guidelines I’d offer to start you off.

If you just want people who’ve tended to make more bold choices than timid choices to get “bold” flavor text, then give the flavor text for anything over 50.

If you want to add text for something only a crazy bold person would do, then make it over 70. (And the opposite for timid.)

All this partly depends on how much you add to the “bold” stat every time someone makes a bold choice (or subtract from it with every timid choice). If you’re using fairmath, as lots of ChoiceScript games with opposed stats do, then 70 is a good high threshold, since it’s a massive challenge to get above 80% using fairmath and you’d only expect that to happen if (a) “bold” is a major stat in your game with lots of choices that affect it and (b) someone picks the bold-boosting choice every single time.

Or as CoG advises in the fairmath section here:

  • On average, Fairmath has half the effect of simple addition. So, for example, %+ 20 usually only gives the player about 10 more points.
  • If you want to give a small bump, make it %+10 . If you want a large boost, make it %+40 .
  • A player with a skill of 50% has average ability.
  • A skill of 60% is good; 70% is excellent.
  • 80% skill is almost impossible.

If on the other hand you’re adding a straight +5 to the stat every time, then maybe it would be easier to get to 80% and you’d go a little higher with your “crazy bold” threshold–again, depending in part on how many choices the player is given.


Wow! So the ideal is still to playtest a few times and see what stats I have at the end to determine the variable. I am using Fairmath but I should see if it’s possible to get up to 80%, now I’m curious. If it is, I might want to edit the code a little.

No, it doesn’t require those stuff. It can be used for flavors.

* if (happy = "false")
     I was already mad, and seeing them do that made me angrier. "Can you stop?"

     "Sorry." I hear them sigh.
*if (happy = "true")
     Seeing them do that made me chuckle.

"I'll see you later, okay?" I say, before leaving the apartment.

Choicescript Wiki is awesome. Here’s *if. Choicescript Wiki looks better in desktop version, so if you’re using your phone, set it to desktop view on that page, just a tip.

Yes! I have a habit of using the other one because my eyes find it “easier” I guess.

That’s weird… because whenever I tried to do that, CSIDE was like “ah, no, you need to do that stuff. You need a *goto”. Unless I’m remembering wrong- either way. I’ll try it the way you showed so I don’t have to do unnecessary steps.

Best practice is to do

rather than

If you are doing something true/false. It is when you do *if/*else or *if/*elseif/*else that you need to have a *goto after each one.

*If/*if, unless done very carefully, can lead to some confusing bugs.


I do *if, followed by *elseif or *else. But that makes sense.