pythonrenpy

How to use function in Show() in Renpy?


How can I display my dictionary on another screen?

define python:
    heroes = { Someone : 1, Someone: 2}

screen showBio(id, dict):
    frame:
        xsize 300
        ysize 300
        vbox:
            text "[dict[id]]"

screen characters():
    tag menu
    use game_menu(_("Heroes"), scroll="viewport"):
        for i in heroes:
            textbutton "[i]" action Show("showBio([i], [heroes])")

Solution

  • define python:
        heroes = {"Someone": 1, "Someone2": 2}
        
    screen showBio(id, hero_dict):
        frame:
            xsize 300
            ysize 300
            vbox:
                text str(hero_dict[id])
        
    screen characters():
        tag menu
        use game_menu(_("Heroes"), scroll="viewport"):
            for i in heroes:
                textbutton i action Show("showBio", i, hero_dict=heroes)