How do I define gender variables?

I’m having trouble with defining a variable, I assume, given then error I’m getting. This is the code put in at the beginning:

*create gender ""
*create female ""
*create male ""
*create mc_himher ""
*create mc_hishers ""
*create mc_heshe ""
*create mc_manwoman ""

And then further into it, where you can choose your gender (haven’t decided if I want to include nonbinary yet), it looks like this:

*choice
	#Boy.
		*if (gender = male)
			*set gender "male"
			*set mc_himher "him"
			*set mc_hishers "his"
			*set mc_heshe "he"
			*set mc_manwoman "man"
		*goto kiss_scene
	#Girl.
		*if (gender = female)
			*set gender "female"
			*set mc_himher "her"
			*set mc_hishers "hers"
			*set mc_heshe "she"
			*set mc_manwoman "woman"
		*goto kiss_scene

So I try a quicktest, and I keep getting this error in CSIDE of: Non-existent variable 'he’, for the text below.

Dad mustered an understanding smile when we broke apart. "$!{he}'s always like this."

I know this has been asked a thousand times, and it’s very likely I missed my answer somewhere on the forum. I’m sure the answer is so simple it’s stupid, but I can’t figure it out to save my life. Can anyone explain to me, a frustrated noob, why it says it’s non-existent? I looked in the forum, I looked through the CS tutorial someone made, and I’m just as confused. I’m awful at this, send help. :upside_down_face:

1 Like

Here’s a help.
"$!{mc_heshe}'s always like this."

Thank you! I knew it had to be something as simple as that, and yet I couldn’t figure it out. How would it work with NPCs you could change genders of? I assume like:

*create Ash
*create Ash_himher
*create Ash_hishers
etc etc

And then in reading, it would be as $!{ash_himher} right?

Correct. Still, I’d recommend on staying consistent on your capitalization convention. It helps a long way if you have a complex code.

1 Like

Definitely. Thank you for answering, I feel so stupid now.:joy:

Is it possible to bother you again for another question-?:upside_down_face:

Shoot 'em up. Even though I’m not answering, there’re others who will. Besides, we don’t have much time writing/reading only permission without the actual thing asked – as ironic as I say this since I haven’t slept my entire night; hurray friday!

1 Like

Thank you kindly!
So glad it’s friday ugh

So how should I write the stats? I don’t have the script for it, but when trying to create it, I couldn’t simply write “text name”, even when I included a choice to choose a name and set it. Instead, no matter how I wrote it in the stat file, it said name was a nonexistent variable. Does that make sense? I can probably type it out and paste it here if need be.
On top of that, I couldn’t hide character selections in the stats; they would be hidden until they’re met in the story. I tried to include options for each character where, upon selecting them, you’d go to a screen giving out more details. Yet the text for each character all loaded under one option, despite all of them being labeled.
I’m horrible at explaining, so I have no issue giving screenshots and such if needed.

Oho, one by one.

  1. On name, you have to declare the variable
    *create name ""

    This creates a string (text) variable called name, which currently empty. Do this on your 'startup.txt' file (which would be your "master" file where you declare all variables, all cheevos, etc etc.---as such, it's recommended to use the file exclusively for those; no story in it).

  2. Hiding stats is a matter of doing conditional checks `*if`, not `*label`. There're ways of doing it, but for the sake of learning,
    do this:
    1. For all characters you want to hide, do this (with X is the name of said characters)
      *create char_x_unlock false
    2. In your stats screen, continuing from step 1, do this
      *if char_x_unlock
         Text for char X.
      *if char_x2_unlock
         Text for char X2.
      etc.
      This will hide the text for char X as long as its unlock variable remains false. As such--
    3. In your normal text passage, whenever you want to "unlock" a character, add this code
      *set char_x_unlock true

I’ve created a name already, which is why I was annoyed that it wasn’t working. I have it like this:

*comment MCs Name
*create firstname ""
*create surname ""
Summary

I made a little test choice to see if choosing a name would make a difference like this:

*Choice
	#Jennie
		*set firstname "Jennie"
		*goto this
	#Carly 
		*set firstname "Carly"
		*goto this

I did the same for surnames:

*Choice
	#Smith
		*set surname "Smith"
		*goto this
	#Apple
		*set surname "Apple"
		*goto this

Yet, when I try to test it, I get this: Non-existent variable ‘name’.
And below is all I have in the stats right now as I deleted everything in it, thinking somehow, maybe, it was causing issue:

[b]Stats[/b]

*stat_chart
	text name
	text haircolor
	text eyecolor

Because you don’t have variable “name”. You would need to put in stats ${firstname} ${surname} to make that work.

Also, if you absolutely want “name” to be both first and last name, you can also do something like this-

*choice
     #Jennie
         *set firstname "Jennie"
         *set name "Jennie"
         *goto whatever
     #Alex
           *set firstname "Alex"
           *set name "Alex"
           *goto whatever

*label whatever
*choice
      #Smith
           *set surname "Smith"
           *set name & " Smith"
           *goto whatever_else
      #Apple
          *set surname "Apple"
          *set name & " Apple"
          *goto whatever_else

And then stats would be the same as you showed it.

Keep in mind the space for last names (the *set name " Apple" bit, else it will make the name one word.

I must be doing something wrong, because it won’t work still. I even added this and it didn’t work.

*create name ""

I edited the stats to look like this:

[b]Stats[/b]

*stat_chart
	text ${firstname} ${surname}
	text haircolor
	text eyecolor

And in testing, I got the message: choicescript_stats line 4: Invalid expression, couldn’t extract another token: ${firstname}

I swear, I’m making this way more complicated than it needs to be and even still, it’s extremely disheartening. :pensive:

Wait, I goofed a bit and see a bit of an issue-

First, my bad- if you do it as a *stat_chart, then you don’t need the ${} bit.

So

*stat_chart
    text firstname

The other issue is I don’t know if you can do both firstname and surname on the same line underneath a stat_chart.

One thing you can do is nix the *stat_chart for the name all together (or use the example I posted above, with the & bits to combine the firstname and surname.

So it would end up just as-

Name: ${firstname} ${surname}

OR- if you decided to do the thing I mentioned above, with the & bits, it would be-

*stat_chart
    text name 

I took out the *stat_chart entirely and just did your second option with {firstname} {surname}. After a quick test, I didn’t get an error, so I assume it works! Thank the heavens, thank y o u.

Now I just gotta figure out how to set up the mini character bios properly.

1 Like

Not a problem. Let me know if there ends up being an issue with it or if you need any more help!

1 Like

Actually, yeah! One thing, Szaal gave an answer for hiding stats, but I’m not too certain how to implement the *if statements. I assume, following their example, it’s something like this?:

*if char_John_unlock
       percent John
       #John's bio
           *goto John_bio
*if char_Lisa_unlock
      percent Lisa
     #Lisa's bio
            *goto Lisa_Bio
etc etc

I think I may have tried that once, I just remember all the bios, for some reason, showing up as one long thing, instead of properly divided up to each character.

A way I would do it is-

*if char_John_unlock
   *stat_chart
         percent John John (It's written twice on purpose, assuming "John" is a
            numerical relationship variable. The first "John" is the variable, the 
           second "John" is to show who it is you're talking about. Another way to
           show it is-
            percent john_relationship John
            to keep things from being confusing.)
   John's bio paragraph stuff

*if char_Lisa_unlock
     *stat_chart
           percent Lisa Lisa
      Lisa's bio paragraph stuff

Unless! You want each bio to have it own’s page all together (to go to by choice. Otherwise, the above should work fine and help keep things from getting cluttered.

For a bit of extra info-

You can’t use text or percent without a *stat_chart (it’d likely end up literally writing out ‘percent John’ or ‘text name’. You can’t use a # without a *choice, and it won’t go anywhere.

(sorry for all the edits!)

1 Like

Edits are fine, don’t worry! Although I don’t understand how to fix yet another issue, starting to think I’m cursed. I tried plugging stuff back in but I get another error of: choicescript_stats line 10: invalid indent, expected at least one row
I tried indenting (with tab), and didn’t make a difference, which is why I tried testing it that way it’s displayed below, mostly out of curiosity, not because I thought it’d work. I had it the very first time, and now I can’t get it work at all?:

*stat_chart
opposed_pair cautious
impulsive
opposed_pair stubborn
flexible
opposed_pair believer
secular
opposed_pair friendly
aloof
percent strength
percent knowledge
Summary

Lord help me I am so stupid, I apologize for this.

Haha, no worries! We all start somewhere.

When you indented, did you make sure to indent line 10?

Ideally, I believe it should look like this-

*stat_chart
    opposed_pair cautious
       impulsive
    opposed_pair stubborn
       flexible
    opposed_pair believer
       secular
    opposed_pair friendly
       aloof
    percent strength
    percent knowledge

I think I did, and it still didn’t work? Or something? I’m honestly not even sure anymore. I plugged your stuff in, and this is what it all looks like:

*stat_chart
	opposed_pair cautious
		impulsive
	opposed_pair stubborn
		flexible
	opposed_pair believer
		secular
	opposed_pair friendly
		aloof
	percent strength
	percent knowledge
*line_break
*if char_Cassius_unlock
	*stat_chart
		percent Cassius
		#Cassius's bio
		*goto Cas_bio
*if char_Freya_unlock
	*stat_chart
		percent Freya
		#Freya's bio
		*goto Fre_bio

Except now, strangely, I have this error: choicescript_stats line 24: invalid line; this line should start with ‘percent’, ‘text’, or 'opposed_pair’
Line 24 is #Cassius’s bio. I’m???