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.


Information Screen

This is a screen that can be used to display information ranging from stats to affection points to clues to whatever you like, really. For this example, we will show affection points of two love interests.

In the Init Section

You need to define your variables here.

init:
    $ bob_points = 0 # this is a variable for bob's affection points throughout your game
    $ larry_points = 0 # this is a variable for larry's affection points throughout your game 
    $ bob_max = 10 # this variable should be set to bob's maximum affection points
    $ larry_max = 10 # this variable should be set to larry's maximum affection points
    $ variable = False # when false, the affection screen button doesn't appear on the screen

In Screens.rpy

You can actually define this screen anywhere, but it might be easiest to group it with your other screens.

screen button:
    vbox xalign 0.1 yalign 0.1:
        textbutton "Show affection points" action ui.callsinnewcontext("aff_screen_label")
        # you can also use an image button:
        imagebutton:
            idle "button_idle.png"
            hover "button_hover.png"
            action ui.callsinnewcontext("aff_screen_label")

The above code is for a button that will open up the stats/affection points screen when clicked. Remember to change the image filenames and xalign/yalign coordinates for your own code. If you don't want the button to show up all the time, you can do something like this:

screen button: 
    if variable:    
        vbox xalign 0.1 yalign 0.1:
            textbutton "Show affection points" action ui.callsinnewcontext("aff_screen_label")
            # you can also use an image button:
            imagebutton:
                idle "button_idle.png"
                hover "button_hover.png"
                action ui.callsinnewcontext("aff_screen_label")

This makes it so that the button only shows up if "variable" is set to True. As for the actual content of the stats/affection points screen:

screen aff_screen:
    frame:
        has vbox
        text "Bob: [bob_points] points"
        text "Larry: [larry_points] points"
        textbutton "Return" action Return()

label aff_screen_label:
    call screen aff_screen
    return

This would show up as "Bob: ### points" and "Larry: ### points", with ### being whatever number the variables are set to at that point in time. If you'd like to use bars instead of text (useful for stats/affection points), you can use bars like so:

screen aff_screen:
    frame:
        has vbox
        hbox:
            label "Bob: " xminimum 100
            bar range bob_max value bob_points xmaximum 400
        hbox:
            label "Larry: " xminimum 100
            bar range larry_max value larry_points xmaximum 400
        textbutton "Return" action Return()

label aff_screen_label:
    call screen aff_screen
    return

In the game script

label start:
    show screen button # this will make the button show up on your screen

If you're making it so that the button doesn't always show up:

label start:
    show screen button
    # though we said to show it, the button won't show up until the variable is set to True
    "Blah blah blah!"
    $ variable = True
    # and now the button appears!
    "Blah blah blah~"
    $ variable = False
    # and the button disappears again...