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.


Simple Onscreen Inventory

This code adds a simple, items only inventory that will remain onscreen until you set $ showitems = False .

init python:   
    showitems = True
   
    def display_items_overlay():
        if showitems:
            inventory_show = "Inventory: "
            for i in range(0, len(items)):
                item_name = items[i].title()
                if i > 0:
                    inventory_show += ", "
                inventory_show += item_name
            ui.frame()
            ui.text(inventory_show)
    config.overlay_functions.append(display_items_overlay)

##
$ items.append("stone") #when you want to add items
$ items.remove("stone")#when you want to remove items
$ showitems = False #when you don't want to show the inventory onscreen (cutscenes and the like)
$ showitems = True #when you want to reshow the inventory after the cutscene is over

Money/Affection

With some adaptation, we can also use this code to display the current amount of money, or display an "Affection Meter" for a romantic interest.

init python:
    showaffection= False
    affection = 0
    def display_affection():
        if showaffection:   
            ui.frame() #This is optional. It adds a frame around the text.
            ui.text("Affection: %d" %affection)
    config.overlay_functions.append(display_affection)

###

$ showaffection = False #Hides the Affection box thing
$ affection +=5 #This adds 5 affection to the current score
$ affection -=5 #Likewise, this subtracts 5 affection from the current score

An onscreen money system is virtually the same.

init python:
    showmoney= False
    money = 0
    def display_affection():
        if showmoney:   
            ui.frame() #This is optional. It adds a frame around the text.
            ui.text("$ %d" %money)
    config.overlay_functions.append(display_money)

###

$ showmoney = False #Hides the Money box thing
$ money +=5 #This adds $5 to the current score
$ money -=5 #Likewise, this subtracts $5 from the current score