Page 1 of 1

Name above dialogue box AND letting player choose name.

Posted: Mon Oct 21, 2013 12:57 am
by Jengo
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

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

Posted: Mon Oct 21, 2013 2:05 am
by Madii
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.

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

Posted: Mon Oct 21, 2013 2:24 am
by Jengo
That did it! Thank you, Madii! I never thought of trying brackets :P