[SOLVED]Help with User Choices regarding character's gender

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
VirusChris
Newbie
Posts: 18
Joined: Thu Jan 23, 2014 5:14 am
Contact:

[SOLVED]Help with User Choices regarding character's gender

#1 Post by VirusChris »

Hey there, I'm new to these forums as I'm trying my hand at using Ren'py and making my own Visual Novel! So please excuse me if I don't seem to grasp the coding just right, right away, as I'm still learning about this program... however it looks amazing to make a Visual Novel with!

Anyway about my question, you see in my Visual Novel the player can romance certain characters or have a "bromance/sisteromance (have no idea for the female equivalent" routes depending the the character's gender but I can't seem to get it with the menu choice.

I looked at the "Remembering User Choices" guide, but I got an error when setting it up and it was this:
File "game/script.rpy", line 25: Line is followed by a block, despite not being a menu choice. Did you forget a colon at the end of the line?
"I'm a boy"<-
This is the error message when I boot up the game and this is my code lines:

Code: Select all

 e "First off, can you tell me are you a boy or a girl?"
    
menu:
    "I'm a boy"
        $ gender = "male"
    "I'm a girl"
        $ gender = "female"
    
    e "So your a, %(gender)s?"
I seemed to be missing something and I like to correct this as soon as possible as I'm testing the controls with Ren'py before I start working on adding images, sound/music, and all the other things as well.

I want to give the player choice their gender in my game, I got the two-name input down already so the player can have both a first and last name and the default name is "Yu Hero" if they leave both blank, as characters will say something different to you depending on your gender and certain characters become available for romance who are the opposite sex and the same sex yields a very close "best friend" or "sibling-like" relationship.

So characters will either say:
"Yeah, that's him over there! He's my awesome bro!" if the player is male.
"Yeah, that's her over there! Isn't she the prettiest?" if the player is female.

Can you guys help me out? ^_^
Please and thank you!


PS: I'm hoping I'm not asking for too much, but is it possible to have the characters have a "Name Box" over the "Text Box" instead of having the character who is speaking in the same box as dialogue? Just curious that's all as I want the character name box to be on the top left corner of the Text Box slightly overlapping the Text Box like some RPG games do. If not that's OK, I can deal with it.

And I was curious on this part, not planning on doing it, but can you give the Name/Text Box as style like instead of the black box have the box be a scroll or parchment design instead? Been wondering about that? That is all.
Last edited by VirusChris on Thu Jan 23, 2014 7:50 pm, edited 1 time in total.

Madii
Newbie
Posts: 12
Joined: Fri Aug 16, 2013 1:46 am
Location: Indiana, USA
Contact:

Re: Help with User Choices regarding character's gender

#2 Post by Madii »

Try this:

Code: Select all

 e "First off, can you tell me are you a boy or a girl?"
    
menu:
    "I'm a boy":
        $ gender = "male"
    "I'm a girl":
        $ gender = "female"
    
    e "So your a, %(gender)s?"
You just forgot the colon (:) that follows each option. It's not that noob-ish of a mistake. It happens a lot when you're not careful.
VirusChris wrote: PS: I'm hoping I'm not asking for too much, but is it possible to have the characters have a "Name Box" over the "Text Box" instead of having the character who is speaking in the same box as dialogue? Just curious that's all as I want the character name box to be on the top left corner of the Text Box slightly overlapping the Text Box like some RPG games do. If not that's OK, I can deal with it.
This one is pretty easy. Just find the script file entitled "screens" (if you don't have a recent version of Renpy installed you're probably not going to be able to do it like this) find the Say screen (which for me is the first screen listed) and change the default two-window to True.

If you just want one character to have the two-window thing (or can't find the say screen), write "show_two_window=True" when you define your characters:

Code: Select all

    $ etwo = Character(_('Eileen'),
                       color="#c8ffc8",
                       show_two_window=True)
or I'm sure there are plenty of other ways that I don't know about/haven't learned yet so try looking around the website (or Renpy.org) or play the tutorial.
And I was curious on this part, not planning on doing it, but can you give the Name/Text Box as style like instead of the black box have the box be a scroll or parchment design instead? Been wondering about that? That is all.
Yeah, you can do that too. If you have a recent version of Renpy, you can just open the "screen" script file, find the Say screen again, and replace the original style with the one you want by doing some stuff that I don't fully understand so I may not be the person you should ask. :wink:
"bromance/sisteromance (have no idea for the female equivalent"
I use "friendsbians" sometimes, if that helps. :)

If you have any more questions or something's not working right or whatever, I'll be happy to help. :wink:
"Success is an achievement, while failure is a lesson. One cannot celebrate one, without learning from the other." ~ Somebody. I'm sure of it.

User avatar
rakada
Regular
Posts: 71
Joined: Tue Jan 07, 2014 11:00 pm
Contact:

Re: Help with User Choices regarding character's gender

#3 Post by rakada »

Last edited by rakada on Thu Jan 23, 2014 6:17 am, edited 1 time in total.

User avatar
rakada
Regular
Posts: 71
Joined: Tue Jan 07, 2014 11:00 pm
Contact:

Re: Help with User Choices regarding character's gender

#4 Post by rakada »

You can make a custom GUI for the name box then add it to show your custom made GUI name box when ever it show up

User avatar
VirusChris
Newbie
Posts: 18
Joined: Thu Jan 23, 2014 5:14 am
Contact:

Re: Help with User Choices regarding character's gender

#5 Post by VirusChris »

@Madii
I added in the (:) colons to the end of each option, but I got this error instead:
Parsing the script failed
File "game/script.rpy", line 32: Only one menuitem may exist per menu.
e "Can you tell me your first name?"
Any ideas how to fix this?


Also I'm using version 6.13 of Ren'py and I just downloaded the new 6.16 version so I'll take a look at that later, but for now I will to practice a bit and I will definitely use the newest version to do my name box thing.

Right now I need to get this character gender problem fixed first and then use the same method to select the character's race, my Visual Novel has three different race options to choose from after selecting Gender and Character Name.

And even a Theme Color too for the player, add a bit more variety and customize to the player's character.

User avatar
akemicchi
Veteran
Posts: 465
Joined: Mon Dec 31, 2007 11:22 pm
Projects: Magicians of Delphine, Panaderia: Ensaimada, SweetTooth!, XOXO Droplets
Deviantart: littlebabyshoes
Contact:

Re: Help with User Choices regarding character's gender

#6 Post by akemicchi »

Can we see the script, particularly the menu? It looks like you have another line there that isn't a menu item.

Code: Select all

menu:
    "Only one of these is allowed in older versions of Ren'Py."
    "Menu option":
        "Stuff."
    "Another menu option":
        "Stuff."
"Next text should be here. Notice the indentation."

User avatar
VirusChris
Newbie
Posts: 18
Joined: Thu Jan 23, 2014 5:14 am
Contact:

Re: Help with User Choices regarding character's gender

#7 Post by VirusChris »

Here it is, I'm just testing the water with Ren'py so I'm bound to miss a thing or two at first:

Code: Select all

# You can place the script of your game in this file.

# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"

# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")
init:
    $ mcn1 = " "
    $ mcn2 = " "
    $ mcnf = " "
    $ mc = DynamicCharacter("mcnf", color=(192, 64, 64, 255))


# The game starts here.
label start:

    e "You've created a new Ren'Py game."

    e "Once you add a story, pictures, and music, you can release it to the world!"
    
    e "First off, can you tell me are you a boy or a girl?"
    
menu:
    "I'm a boy":
        $ gender = "male"
    "I'm a girl":
        $ gender = "female"
    
    e "So your a, %(gender)s?"
    
    e "Can you tell me your first name?"
    
    # The phrase in the brackets is the text that the game will display to prompt 
    # the player to enter the name they've chosen.
    
    $ mcn1 = renpy.input("What is your first name?")
    
    # If the player can't be bothered to choose a name, then we
    # choose a suitable one for them:
    
    if mcn1 == "":
        $ mcn1 = "Yu"
    
    e "Can you tell me your last name?"
    
    # If the player can't be bothered to choose a name, then we
    # choose a suitable one for them:
    
    $ mcn2 = renpy.input("What is your last name?")
    if mcn2 == "":
        $ mcn2 = "Hero"
        
    $ mcnf = mcn1+" "+mcn2
    
    # Now the other characters in the game can greet the player.
    
    mc "My name is %(mcn2)s. %(mcn1)s %(mcn2)s and I'm a %(gender)s."
    
    e "Congratz! You put in your character's name, good job! Now continue to develop your game."

    return
Here's the script.


Also...
rakada wrote:http://lemmasoft.renai.us/forums/viewto ... =8&t=16173

Or http://m.youtube.com/index?&desktop_uri=%2F

Should help with the name box thing you were asking about.
The link doesn't bring me to a YouTube video, just list of videos on desktop. I don't see any videos related to what I'm looking for.

Crazy Li
Regular
Posts: 113
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: Help with User Choices regarding character's gender

#8 Post by Crazy Li »

Code: Select all

e "So your a, %(gender)s?"
should probably be aligned with "menu:" or else the game will think it's another menu choice. Make sure everything else after that point has an indentation taken away too so it's all aligned correctly. You basically have everything indented in one too many.

User avatar
VirusChris
Newbie
Posts: 18
Joined: Thu Jan 23, 2014 5:14 am
Contact:

Re: Help with User Choices regarding character's gender

#9 Post by VirusChris »

I'm sorry I'm not entirely sure what you mean?

This is what I have for that code:

Code: Select all

menu:
    "I'm a boy":
        $ gender = "boy"
        
    "I'm a girl":
        $ gender = "girl"
        
    e "So your a %(gender)s? Nice to know!"
        
    e "Can you tell me your first name?"
I still haven't fixed this problem, I have no idea what's wrong and where do I go to fix it. Can someone please help me?

User avatar
Googaboga
Eileen-Class Veteran
Posts: 1395
Joined: Wed Dec 12, 2012 1:37 pm
Completed: https://gbpatch.itch.io/
Projects: Floret Bond, XOXO Blood Droplets, Our Life
Organization: GB Patch Games
Tumblr: gb-patch
itch: gbpatch
Contact:

Re: Help with User Choices regarding character's gender

#10 Post by Googaboga »

What I believe Crazy Li is saying is that instead of this:

Code: Select all

menu:
    "I'm a boy":
        $ gender = "boy"
       
    "I'm a girl":
        $ gender = "girl"
       
    e "So your a %(gender)s? Nice to know!"
       
    e "Can you tell me your first name?"
It should be more like this:

Code: Select all

menu:
    "I'm a boy":
        $ gender = "boy"
       
    "I'm a girl":
        $ gender = "girl"
       
e "So your a %(gender)s? Nice to know!"
       
e "Can you tell me your first name?"
I moved the dialog since they weren't part of the menu choices. It is just regular dialog so it shouldn't be on the same indentation level as those choices. Every other piece of dialog with the wrong indentation should be moved back as well.
In-Progress:
Floret Bond, XOXO Blood Droplets, Our Life
Released:
A Foretold Affair, My Magical Divorce Bureau, XOXO Droplets, Lake of Voices

Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: Help with User Choices regarding character's gender

#11 Post by Anima »

It has to be like this:

Code: Select all

menu:
    "I'm a boy":
        $ gender = "boy"
        
    "I'm a girl":
        $ gender = "girl"
        
e "So your a %(gender)s? Nice to know!"
        
e "Can you tell me your first name?"
You can learn more about indention and logic flow here
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

Crazy Li
Regular
Posts: 113
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: Help with User Choices regarding character's gender

#12 Post by Crazy Li »

Your indentation is wrong. Go look at akemicchi's post and then how you did it. Yours is too far in following the menu options. Hilight everything below "$ gender = girl", hold shift and hit tab. With any luck, that quickly fixes your indentation, but really you need to learn how to indent properly so you can make sure all your code starts where it"s supposed to.

User avatar
VirusChris
Newbie
Posts: 18
Joined: Thu Jan 23, 2014 5:14 am
Contact:

Re: Help with User Choices regarding character's gender

#13 Post by VirusChris »

How, that was kinda confusing. I'm used to Java and C+ as I did those in High School and I was wondering if there was a closing "code" to end the indentation to make it easier.

And thanks for the tip on the "Hold Shift + Press Tab" makes it easier to fix these problems. I got the choice down now, so thank you guys! ^_^

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]