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.


Defining Characters

Characters in Ren'Py are very powerful objects, but in common practice they're very easy. (If you want to get into the really powerful stuff, check out the Defining Characters chapter of the reference manual.) (Please note through all of these examples that characters must be defined inside of an init block.)

The simplest way to define a character is:

init:
    $ jane = Character("Jane")

In practice, this is a little too simple. You should choose a color for the character's name. You do this by a standard red-green-blue hex triplet: #rrggbb. To make Jane's name appear in medium green:

init:
    $ jane = Character("Jane", color="#009900")

A useful color chart may be found here.

Still common, but less so, is to use an image in place of the name. To do this, instead of giving jane a name, you give the filename of an image (placed in the game directory of our Ren'Py project), and tell Ren'Py that the name is really an image:

init:
    $ jane = Character("jane_label.png", image=True)

The other common thing that you might want to do with characters is to make the text that they say appear in a different color. This makes both the label and the text for whatever Jane says appear in medium green:

init:
    $ jane = Character("Jane", color="#009900", what_color="#009900")

When defining characters with more than a few lines, it's a good idea to make the Ren'Py name of the character as short as possible. So rather than:

init:
    $ jane = Character("Jane")

it's better to write:

init:
    $ j = Character("Jane")

It will save you a lot of typing in the long run, and is usually just as readable when you're editing your story.

When definining more than one character, don't forget that they only have to be in an init block, you don't need an init block for each one:

init:
    $ j = Character("Jane")
    $ a = Character("Adam")
    $ s = Character("Sara")

Category: Ren'Py Web Tutorial