If/else problem: he,she, him, her, honorifics not working

Hi,
I’m working on my first submission to Hosted and I can’t figure out the personal pronouns and honorifics.
The player can choose whether to be male or female, and other characters will refer to the PC as either ‘Sir’ or ‘Ma’am’ and sometimes ‘Mr.’ or ‘Ms.’
I made this string of code for that purpose:

*create PC_Sir ""
*create PC_Mister ""
*create PC_his ""
*create PC_him ""
*create PC_he ""
*if (Gender="Female")
  *set PC_Sir "ma'am"
  *set PC_Mister "Ms."
  *set PC_his "her"
  *set PC_he "she"
  *finish
*else
  *set PC_sir "sir"
  *set PC_Mister "Mr."
  *set PC_his "her"
  *set PC_he "she"

It works fine if the PC happens to be male, but when the PC is female the other characters call her ‘Mr.’ Does anyone know how to fix this? :slight_smile:

Values are case sensitive. “female” does not equal “Female”. That’s probably the first thing to check.

Okay I checked. The caps are all the same.

Can you past the whole code then? Because currently there’s no way the PC can be female with the above code.

The entire code is pretty long. Can I just post the parts that have to do with this?
This is the part of the code where the gender variable is created:
*create Name “”
*create Surname “”
*create Gender “”
*create Location “”

This is where the player chooses their gender:
*label gender_pick
*choice
#Mr
*set Gender “Male”
*goto namingM

#Miss
*set Gender “Female”
*goto namingF

#Mrs
*set Gender “Female”
*goto namingF

And this is the part where I first use PC_Mister and noticed it wasn’t working for female:
*label conspiracy
“Tell me, !{PC_Mister} !{Surname}, have you heard the tales about the seas you’re sailing?”

That’s all I’ve used Gender for so far. Is this enough information?

You probably forgot to add
*set Mister "Ms."
Under
*goto namingF

Also we need you to post the code which means the part under
*label namingF

1 Like

Okay, here’s label namingF

*label namingF
Your first name?
*choice
  #Rose
    *set name "Rose"
    *goto surnaming

  #Margaret
    *set Name "Margaret"
    *goto surnaming

  #Anna
    *set name "Anna"
    *goto surnaming

  #Beatrice
    *set name "Beatrice"
    *goto surnaming

  #I'd like to pick my own name...
    Of course. What is your name?
    *input_text Name
    Is that ${Name}?
    *choice
      #Yes
        *set Name "${Name}"
        *goto surnaming

      #No, that's wrong.
        Let's try again.
        *goto namingF

I tried adding
*set PC_Mister "Ms." where you said, but it still says Mr. for female PC.

*label gender_pick
*choice
  #Mr...
    *set Gender "Male"
    *goto namingM
    *set PC_Mister "Mr."
     
  #Miss...
    *set Gender "Female"
    *goto namingF
    *set PC_Mister "Ms."

  #Mrs...
    *set Gender "Female"
    *goto namingF
    *set PC_Mister "Ms."
1 Like
  1. Use consistent capitalization (preferably all lower case with regard to variable names). This usually doesn’t cause errors, but consistency across the board helps.

  2. Remember that lines are run one at a time so this:

    *goto namingF
    *set PC_Mister "Ms."```
Will mean the third line is never run. It gets to the second, than just moves to the next label. The third line needs to be above the second.
1 Like

Okay, I think I understand. I changed the line it was on and the game is running as it should. :ok_hand:
Thank you very much for the help!!

1 Like

Make sure to add in all the other stats too. Take this

And put it right after

*set Mister “Ms.”

2 Likes

This has nothing to do with the actual problem, but why not have PC_mister be Mrs, if the character chooses to be Mrs.

3 Likes