How to create a Gender variable?

From there, you can mess around with pronouns. I’d personally use a binary system with 1 = male, 0 = female, or vice versa. Then you could set up a variable for every paired set of pronouns and titles you’d need and have them all reliant on the gender variable.

For example:

*if gender = 1
*set gender1 “he”
*set gender2 “his”
*set gender3 “Mr.”
*set gender4 “King”
*set gender1 “she”
*set gender2 “her”
*set gender3 “Ms.”
*set gender4 “Queen”
*goto etc

From then on, whenever you need one of those pronouns, you can simply use "$!{gender1} or whatever you need. Something like:

“The messenger staggers in, his face a mask of raw terror. ‘Let me through! I need to see the $!{gender4}!’ he screams.”

Disclaimer, that setup is extremely messy, feel free to play around with it.

1 Like

I’m still having some problems with setting it up. I’ll show the coding.

*create gender 0(startup.txt)[I have not yet renamed the documents]
*set gender 1 (startup.txt)
*if gender=0 (animal.txt)
bladdy blah
halb yddalb

I’ve probably gone wrong somewhere [*set Aquos_Boost “Captain Obvious”] and am having a few problems defining where.

First off, don’t change the name of startup.txt, that has to stay the same. But on to your problem, I’m not sure without seeing the exact code.

Okie dokie; I won’t change startup.txt. I’ve tried getting around the issue by using percentages; 0%=Female and 100%=Male, but I don’t think it’ll work too well in the long run.

The gender code was broken up over several documents; that’s probably why it wasn’t working. Should I end up sending the script to you, I’d have to send 3 documents or so over.

Yeah, I can help you out if you want to send them over. I’ll pm you.

Just to put in my input, I have a ‘sample’ gender variable that I made which I use all of my gender variables from,

*if (Gender = “Female”)
-> *set him “her”
-> *set his “hers”
-> *set she “she”
-> *goto
-> *set him “him”
-> *set his “his”
-> *set she “he”
-> *goto

Then, if I need it, I just put ${him} which changes it to him or her depending on the gender, and so on. For gender variables for more than one person I change the
*set him “her” bits to things like
*set shim “her”
with the s identifying WHO.

EDIT: A smidgen more of advice, even though you might find it easier to do it a different way, for gender, to make it work with the what I put above, you can also put it in as
*create Gender “”

Then when they choose their gender you can just put it as
*set Gender “female” and so forth

And last thing, about writing their name? I think what you want is this

#My name is-
-> *input_text name
-> *set Name “$!{name}”

His/Hers is a tricky one. His can be Her or Hers. I usually default it to her and then try and remember (and usually fail) if I need a hers. I did make my variables female to try and circumvent that problem only I bumped into her can mean him or his, so either way it’s not ideal and you do need to remember or have beta testers.

It’s easier to get around the her=him/his than it is to get around the his=her/hers, just because there are many other ways you can express the possessive his/hers without the sentence seeming off. You sort of need the him/her pronouns. Because of this, I usually just go the {he}, {him}, ${his}, etc. route when it comes to setting up those variables.

I also found that designating the specific gender is easier if you just use:

*if (male)
  Male specific text.
*if (male = false)
  Female specific text.

Reduces the amount of possible errors that strings or having multiple variables handling it could cause.

Personally I’m finding understanding this a little difficult. I’m 14 but have a moderate understanding of information technology, although a minimal understanding of coding.

Aquos, I suggest having a look at the existing games on the site and looking at their code. I find reading the code of other games really helps my own understanding. You can look at the code by typing scenes after the url of any game and then reading the text files. So for Choice of Romance it’s

If you go to and then scroll down a bit you can see how they set their gender variables.

I’ll try to explain simpler though. You have four choices for dealing with gender.

  1. The first is just don’t let the player set theirs, and make no gender assumptions. That’s done on Mobile Armor Marine. It can be useful for certain types of stories but for others it won’t work.

  2. Use the goto command and have two versions of the game, one male, one female. Then you just use find and replace to rewrite each section depending on what gender the player chooses. This isn’t ideal, it’s a lot of work. But what you basically do is

        *goto_scene female1
        *goto_scene male1

  1. You set a gender variable.

You do that by first creating the gender variable in the startup file.

*create male
*create female

And then including

        *set female true
        *set male true

And then any time gender is relevant you do

*if female
    The man calls you Ma'am.
*if male
    The man calls you Sir.

You can also do that with one variable just having a male variable say and then instead of saying *if female say *if male=false

Is this making sense so far?

The fourth choice is the one that most people use. I still trip up when doing it though. It involves creating and then setting pronoun variables.

So you do

*create sex
*create he
*create boy

And then

What sex are you?

        *set sex "male"
        *set he "he"
        *set boy "boy"
        *set sex "female"
        *set he "she"
        *set boy "girl"

And then when you’re typing things you include the pronouns in a variable bracket and if you’re female it will automatically use the female pronoun and if you’re male it will use the male one.


${he} was a ${boy}

Will show, if you’re male

he was a boy

And if you chose female

she was a girl

Is this making sense? Have you read the wiki?

I create the following variables, and set them like this:
*create he “he”
*create he “his”
*create he “him”

And depending on what I’m writing, I may have some like this:
*create man “man”
*create boy “boy”
*create lad “lass”

Then, during the game I will have the gender choice:

Are you male or female?
*goto next_part
*set he “she”
*set his “her”
*set him “her”
*set man “woman”
*set boy “girl”
*set lad “lass”
*goto next_part

Then I type my story from the male perspective, changing the sentences as I go like this:

You hear the two men talking about you. “!{he}'s about ten years old, so high, brown hair on {his} head. You won’t miss the ${lad}.”

Next, I playtest from the female perspective (to help spot errors).
To really make sure you have no errors, copy your code into word and search for 'he ’
(that’s h-e-spacebar) and you can whizz through the code to see if your ‘he’ should be ${he}.

Finally, if you wish to add a varied scene that changes with the gender, you can do this:

*if he = “he”
male story
female story

I ran into a problem; When I entered

*create sex
*create he
*create boy

I got this error:
“line 30: invalid create instruction, no value specified: sex”

When you create a variable, you need to specify a value for it as well.
Try this:
*create sex “male”
*create he “he”
*create boy “boy”

These will set the default values of each variable. You can change them to female values later.

OK, I’m good to go with gender variables, but I’m having difficulties with names.

What kind of trouble are you having with names? Setting them? The input_text?

I can’t create the name variable; It says the variable is invalid. I had not problem with input_text. I’ve done some different codes for it such as:
*create name “anonymous”
*create name
*create given_name “anonymous”
*create given_name

Have you been putting it in just like that? Because you’ll get an error if you have the second *create name and *create given_name as it is. You need to put something after it. A simple “” will suffice.

Never mind. I’ve managed to get the name variable to work. I can show a demo of the game if you like, once I figure out where the dropbox is. Thank you dearly for your help. I doubt this is going to work.