Is there a way to create a statistic and not to show it to the readers?

Hey! This is my first topic here and my English is kinda bad, so I’m sorry if it’s hard to understand what I’m trying to ask.

I wanna know if there’s a a way to create a statistic and not to show it to the readers? I mean, I’m working in my first game right now and the relationship of the MC with their parents will matter in some dialogues, but as this is not so important to the game, I don’t wanna put they in the relationship stats. But at the same time, I would need the info of their relationship in private so the dialogues can be suitable. Is there a way to do that?

Sorry for any mistakes, and thanks for your time and possibly help!

2 Likes

Sounds like a regular variable would work?

2 Likes

Yup, you could just handle it the way you would a normal stat (i.e. create the variable in startup and modify it as you go along) but just leave it out of the stats file. Making a couple of comments whenever you call it might help you keep track of it as well!

2 Likes

You would have to go out of your way to show the variable in the choicescript_stats.txt through *stat_chart.

Otherwise, you can just use

*create relationship 0

And use checks

*if relationship > 50
Your relationship is good!
*elseif relationship < 50
Your relationship is in shambles!
5 Likes

Thank you so much! That helped a lot! :slight_smile:

1 Like

Thank you! I’m sure it’s obvious, but I’m like, totally new on this scripting thing, and wasn’t sure if that would work. It’s glad to hear is that simple :slight_smile:

2 Likes

Thank you! I was imagining something like that! :slight_smile:

1 Like

This is a great solution, but to be ULTRA careful, make sure that one of those is >= 50 or <= so 50 that a result of exactly 50 won’t cause the game to go haywire.

I cannot even tell you how much hair I ripped out of my skull in one game I was writing when it kept freezing, and I finally tracked it down to a situation like that (a result not foreseen in the *if stack).

4 Likes

If-elseif is bad practice anyway, it should be if-elseif-else, or plain if-else - this should take care of the exact 50 as well.

3 Likes

As long as you don’t *text, *percent or any other commands that are used to display stats on the choicescript_stats.txt file those stats will be hidden to the readers.

3 Likes

That was a great advice :slight_smile:! I would probably do this mistake and wouldn’t know how to find the solution for that lol

1 Like

Ngl, all the if-else stuff stills kinda complicated to me, I haven’t used it yet. But when I leran to use it properly, I will take your advice into consideration! :slight_smile:

Oooooh, thank you! :slight_smile:

Here’s my advice to you and anyone else who isn’t a pro coder so that you can always easily find those errors.

Let’s say you want to choose between two options (as in the OP).

*if A = true
  *goto A
*elseif B = true
  *goto B
*else
  something went wrong in the A/B stack!

That way, the “something went wrong” message will pop up if something manages to slip through your If/elseif stack. But if your stack does work just fine, the reader will never see the message, so you don’t lose anything.

I realize it seems absurdly pedantic to do it for just two choices, but when you get to a larger stack of 'em (a game I’m writing now has 12), then you’ll be glad to get the “something went wrong” message rather than an infinite freeze loop.

9 Likes

I have to say that you, sir (or madam? I’m sorry for assuming your gender), is a lifeguard. Definetly going to use this later

Sir is fine, although that’s what they called my dad :face_with_monocle:

It ain’t easy being an amateur coder and working with CS.

1 Like

Also, instead of a normal text line, make it a *bug so Quicktest and Randomtest can catch it.

4 Likes