How do I set gender variables?

I just got to the gender thing, and there are four main routes to this story I am making, for the four elements. Will I have to make eight different story paths, four for “she, her, hers, herself” and four for “he, him, his, himself”, or is there a way to cut it back down? I mean, I completely accept that I have to write several different stories, but double that is just going to be too much.

2 Likes

in the startup file

*create he ""
*create him ""
*create his ""

in-game choice:

I prefer...
*choice
    #She/ her/ her
        *set he "she"
        *set him "her"
        *set his "her"
        *goto next
    #He/ him/ his
        *set he "he"
        *set him "him"
        *set his "his"
        *goto next

Then you can just use ${he} to have choicescript spit out the according variable.
I’d also recommend you take a look at this thread, there are some great links for beginners ^^

2 Likes

Thank you so much! You know, you have been a big help to me tiranka.
Another question, could I just . . .
*choice
#She/ her/ her
*set “” “she”
*set “” “her”
*set “” “her”
*goto next
#He/ him/ his
*set “” “he”
*set “” “him”
*set “” “his”
*goto next

1 Like

I’m not sure if you can create an empty variable but I highly doubt it tbh

No idea what you’re trying to ask with that — start with intent rather than an example. Best I can say is, no, that example you posted won’t do anything.

Hm. So I could do
*choice
#She/ her/ her
*set “X” “she”
*set “X” “her”
*set “X” “her”
*goto next
#He/ him/ his
*set “X” “he”
*set “X” “him”
*set “X” “his”
*goto next

if you *create x you can use it for 1 variable like x = he/she/whatever, but you won’t be able to use it for all pronoun variables

you’d have to use x = he, x1 = him, x2 = his etc.

in your example you’d end up with x= her/his because choicescript reads it from top to bottom and you are basically telling it to set x and then reset it to something else and reset it again

always remember it’s a computer and needs exact instructions, it won’t be able to think like you want it to and it certainly doesn’t know what pronoun you want to write at which point

Ah. So, if I end up doing
*choice
#She/ her/ her
*set “X” “she”
*set “Y” “her”
*set “Z” “her”
*goto next
#He/ him/ his
*set “X” “he”
*set “Y” “him”
*set “Z” “his”
*goto next
. . . would it replace, say, the x in “excited” and make it “ehecited” or “eshecited”?
My goal here is to avoid doubling the work I have to do on this story.

I recommend checking out the links on this page: Master List: Links for Beginners

It will answer a lot of your questions.

6 Likes

alright, thank you.

Just as a quick note for something that hasn’t been addressed in the thread: you can’t have variable names in quotations in choice script. Variables are different from the written content of your story since they can, well, vary, and that their “names” will never be displayed. There are certain conventions that denote a variable name (no quotations or other certain characters, you can’t have spaces in a multi-word variable name, etc. The choice script wiki says that you can’t have capital letters in variable names either, but to my testing this doesn’t throw any errors. Maybe it’s just a stylistic thing?). Numbers, at anywhere but the front, are alright! So is _ to separate letters in the name. However, there’s a whole host of things that aren’t valid names!

Here are examples than run:

*create variable_name "my name"

*create variable_name2 "my name"

rather than these examples below, which will all throw errors:

*create "variable_name" "my name"

*create variable""name "my name"

*create variable%name "my name"

*create variable$name "my name"

*create variable name "my name"

Think of variables like a box! You can put whatever you’d like in the box. Numbers, names, etc. However, you need to label each box so that you can find it again and actually use what’s inside, and you have to follow certain rules when labeling these boxes. We don’t actually care about the label itself, we care about the contents of the box! But we need to be able to find the box to unpack it, and that’s why the labels are important. We’re able to tell choice script to “unpack” the box by enclosing the variable name in something like this.

${variable_name}

Totally second looking at the wiki/choicescript introduction! It can be a big help.

2 Likes
${name}, What do you identify as?
*fake_choice
	#Male
		*set sex "male"
		*set he "he"
		*set son "son"
		*set his "his"
		*set him "him"
		*set boy "boy"
		*goto prologue
	#Female
		*set sex "female"
		*set he "she"
		*set his "her"
		*set son "daughter"
		*set him "her"
		*set boy "girl"
		*goto prologue
	#I don't identify as either of those.
		*set sex "Non-binary"
		*set he "they"
		*set son "child"
		*set his "theirs"
		*set him "them"
		*set boy "child"

If you’re interested, this is what I used to code for other gender related words like son or boy. You do need to create a variable for each one though

1 Like