Name above dialogue box AND letting player choose name.

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
Jengo
Newbie
Posts: 7
Joined: Sun Aug 18, 2013 2:58 am
Contact:

Name above dialogue box AND letting player choose name.

#1 Post by Jengo » Mon Oct 21, 2013 12:57 am

I have been learning Ren'Py, and I'm trying to figure this out.
I know how to make character's names show above their dialogue box...

Code: Select all

    init:
        $ q = Character("???", show_two_window=True)
...and I know how to let the player choose their own name...

Code: Select all

 $ player_name = renpy.input("What's my name?")
    $ Player_name + player_name.strip ( )
...but when I try putting them together...
label start:

Code: Select all

$ player_name = renpy.input("What's my name?")
    $ Player_name + player_name.strip ( )
    if player_name == " ":
                $ player_name="Jeff"
    init:
        $ m = Character(player_name, show_two_window=True)
...it gives me an error, stating that "player_name is not defined." I've tried a lot of variations on what I've typed above, and can't find a way to work around it. These are two features that I'd like in my first game, so does anyone know how to work around this?
Many thanks in advance,
- Jengo

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

Re: Name above dialogue box AND letting player choose name.

#2 Post by Madii » Mon Oct 21, 2013 2:05 am

Try using this:

Code: Select all

$ m = Character("[player_name]", show_two_window=True)

$ player_name = renpy.input("What's my name?")
$ player_name = player_name.strip()
This should fix it, but if not, let me know.
"Success is an achievement, while failure is a lesson. One cannot celebrate one, without learning from the other." ~ Somebody. I'm sure of it.

Jengo
Newbie
Posts: 7
Joined: Sun Aug 18, 2013 2:58 am
Contact:

Re: Name above dialogue box AND letting player choose name.

#3 Post by Jengo » Mon Oct 21, 2013 2:24 am

That did it! Thank you, Madii! I never thought of trying brackets :P

Post Reply

Who is online

Users browsing this forum: Bing [Bot]