This page is out of date

You've reached a page on the Ren'Py wiki. Due to massive spam, the wiki hasn't been updated in over 5 years, and much of the information here is very out of date. We've kept it because some of it is of historic interest, but all the information relevant to modern versions of Ren'Py has been moved elsewhere.

Some places to look are:

Please do not create new links to this page.


Letting Players choose their own name

Even though the character the player will be is already fixed, it can be a nice touch to let the player choose the name for themselves. You can allow the other characters in the game to refer to the player by the chosen name if you like, and this can make a game feel very intimate.

label start:
    
    "I've been thinking about changing my 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.

    $ player_name = renpy.input("What is your name, Magical Boy?")

    $ player_name = player_name.strip()
# The .strip() instruction removes any extra spaces the player 
# may have typed by accident.

#  If the player can't be bothered to choose a name, then we
#  choose a suitable one for them:
    if player_name == "":
        $ player_name="Shuji"

# And get a nostalgic sigh from Seasons of Sakura fans!
    
# Now the other characters in the game can greet the player.
  
    e "Pleased to meet you, %(player_name)s!"

Notice the two equals signs in the line

    if player_name == "":

This is not a misprint. In Ren'Py, one equals sign means change this to that. Two equals signs mean test to see if this is the same as that.

In a real game it would probably be a good idea to choose a label that's easier to type than player_name, since you may be typing it a lot!