Troubles with choosing gender code

I am working on my very first story and I’ve run into what I think are very basic problems with creating gender options. The choices work, but some text shows up when it shouldn’t, and some text is not showing up when it should. Here are some little issues I would like help with:

1: The “now do tell us what your first name shall be…” is in italics, but I can’t figure out why it would be? I would like it to be regular font.
2: When selecting to be a female, the text “You are a female” does not appear
3: When choosing to be a female, the text “[i]You have been awarded +2% Strength for being a male.[i]” still appears
4: When choosing to be no gender, the text “[i]You have been awarded +2% Strength for being a male.[i]” still appears.

Here is an example of my code:

What is your gender?
*label gender_choice
*choice
#Male
*set gender “male”
*set Strength +2
*goto gender_chosen
#Female
*set gender “female”
*set Charisma +2
*goto gender_chosen
*hide_reuse #I don’t consider myself either
*set gender “neutral”
*set non_binary_gender true
*goto gender_chosen
*label gender_chosen
Wonderful!
*line_break
*if gender = “male”
You are a male. You flex your pecks to the chorus of “Oohs” and “Aahs” that only play inside your own head.
*line_break
[i]You have been awarded +2% Strength for being a male.[i]
*line_break
*line_break
You may check all your personal stats by clicking on the “Show Stats” button.
*line_break
Now, do tell us what your first name shall be…
*line_break
*goto choose_name
*if gender = “female”
Wonderful!
*line_break
You are a female.
*line_break
+2% Charisma for choosing to be a female.
[i]You may check all your personal stats by clicking on the “Show Stats” button.[i]
*if (gender = “neutral”)
Look at you, you sexy (but sexless) person!
*line_break
*goto choose_name

  1. You are not properly closing the italics tag. [i] to open and [/i] to close it.

2, 3, 4 I cannot answer properly because your code is not formatted properly on this forum. You need to place your code between three ``` to preserve indentation.

Like this

2 Likes

Hopefully this is what you mean by preserving indentation?

What is your gender?
*label gender_choice
*choice
#Male
*set gender “male”
*set Strength +2
*goto gender_chosen
#Female
*set gender “female”
*set Charisma +2
*goto gender_chosen
*hide_reuse #I don’t consider myself either
*set gender “neutral”
*set non_binary_gender true
*goto gender_chosen
*label gender_chosen
Wonderful!
*line_break
*if gender = “male”
‘’‘You are a male. You flex your pecks to the chorus of “Oohs” and “Aahs” that only play inside your own head.
*line_break
You have been awarded +2% Strength for being a male.
*line_break
*line_break
You may check all your personal stats by clicking on the “Show Stats” button.
*line_break
Now, do tell us what your first name shall be…
*line_break
*goto choose_name
*if gender = “female”
Wonderful!
*line_break
You are a female.
*line_break
+2% Charisma for choosing to be a female.
[i]You may check all your personal stats by clicking on the “Show Stats” button.[i]
*if (gender = “neutral”)
Look at you, you sexy (but sexless) person!
*line_break
*goto choose_name’’’

…nope lol

Can you be more specific on how I preserve indentation?

No that is messed up and I can’t read the indentation to know when things happen, its something like this.

*stat_chart
  opposed_pair Rebel
    Dreamer

*choice
  #Relationships
    *goto_scene statsre


And then, on the scene stastre:
*stat_chart
  percent joshvar Joshua Falkland
 *choice
    #Stats
      *goto_scene choicescript_stats

Like I said previously you insert the code between the three ```.

‘’’
What is your gender?
*label gender_choice
*choice
#Male
*set gender “male”
*set Strength +2
*goto gender_chosen
#Female
*set gender “female”
*set Charisma +2
*goto gender_chosen
*hide_reuse #I don’t consider myself either
*set gender “neutral”
*set non_binary_gender true
*goto gender_chosen
*label gender_chosen
Wonderful!
*line_break
*if gender = “male”
‘’‘You are a male. You flex your pecks to the chorus of “Oohs” and “Aahs” that only play inside your own head.
*line_break
You have been awarded +2% Strength for being a male.
*line_break
*line_break
You may check all your personal stats by clicking on the “Show Stats” button.
*line_break
Now, do tell us what your first name shall be…
*line_break
*goto choose_name
*if gender = “female”
Wonderful!
*line_break
You are a female.
*line_break
+2% Charisma for choosing to be a female.
[i]You may check all your personal stats by clicking on the “Show Stats” button.[i]
*if (gender = “neutral”)
Look at you, you sexy (but sexless) person!
*line_break
*goto choose_name
‘’’

uhhh…lol sorry newb here

Its not between quotes, its between ```. Just copy them from my post and paste and then place the code between it.

1 Like
What is your gender?
*label gender_choice
*choice
  #Male
    *set gender "male"
    *set Strength +2
    *goto gender_chosen
  #Female
    *set gender "female"
    *set Charisma +2
    *goto gender_chosen
  *hide_reuse #I don't consider myself either
    *set gender "neutral"
    *set non_binary_gender true
    *goto gender_chosen
*label gender_chosen
Wonderful!
*line_break
*if gender = "male"
  '''You are a male. You flex your pecks to the chorus of "Oohs" and "Aahs" that only play inside your own head.
*line_break
[i]You have been awarded +2% Strength for being a male.[/i]
*line_break
*line_break
[i]You may check all your personal stats by clicking on the "Show Stats" button.[/i]
*line_break
Now, do tell us what your first name shall be…
*line_break
*goto choose_name
*if gender = "female"
  Wonderful!
*line_break
  You are a female. 
*line_break
  [i]+2% Charisma for choosing to be a female.[/i]
[i]You may check all your personal stats by clicking on the "Show Stats" button.[i]
*if (gender = "neutral")
  Look at you, you sexy (but sexless) person!
*line_break
*goto choose_name
```.

thanks, finally lol

Ok, you don’t need *line_break, by leaving a blank line CS will create a paragraph for you.

2 = You have a *goto choose_name before the female and neutral gender check. This will cause it to never reach the code below.

3 and 4 = Those messages are outside of the scope of the *if command so they will always display (for them to be inside of the *if command scope they need to be inside its indentation level.

Even then, you don’t have to check each gender individually after the other, have your *if block encompass all the 3 options and then display different messages based on each condition. This also means you don’t have to repeat the “Show stats” message all the time since you can simply add it after the *if checks are complete.

*label gender_choice

What is your gender?

*fake_choice
  #Male
    *set gender "male"
    *set Strength +2
  #Female
    *set gender "female"
    *set Charisma +2
  #I don't consider myself either
    *set gender "neutral"
    *set non_binary_gender true

Wonderful!

*if (gender = "male")
  You are a male. You flex your pecks to the chorus of "Oohs" and "Aahs" that only play inside your own head.

  [i]You have been awarded +2% Strength for being a male.[/i]
  *goto after_choose_gender
*elseif (gender = "female")
  You are a female.

  [i]+2% Charisma for choosing to be a female.[/i]
  *goto after_choose_gender
*else
  Look at you, you sexy (but sexless) person!
  *goto after_choose_gender
*label after_choose_gender

[i]You may check all your personal stats by clicking on the "Show Stats" button.[/i]

Now, do tell us what your first name shall be…

*goto choose_name
2 Likes

Thank you, I appreciate your clear answers! Can you explain to me what fake_choice is about? I don’t understand why it should be used.

The only difference is that with the *fake_choice every option you pick will simply continue the code downwards (not requiring a *goto and *label like the one you called gender_chosen). Its useful when all options will simply continue down the same path.

With *fake_choice you wont get an error for not having a *goto at the end of the options. This requirement still happens for *elseif and *else usage unless you use implicit_control_flow (I dont think youre using it so I added the redundant after_choose_gender label for that).

You can find more info about these commands on the wiki as well:

1 Like

ok thanks

Hey! I’m glad you got an answer to your question. Please mark the comment that solved your problem with the Solution checkmark (found by clicking the ellipsis on the post in question) so that others who have a similar problem can find that solution easily. :slight_smile:

What happen to the n00b coding thread for all the basic coding problems and questions?