Ren'Py How to make a character menu?

Sep 17, 2018
15
189
Hello, hoping someone can point me in the right direction.

I am wanting to create a character menu like the one in Superpowered.
When you click on a character a menu pops up on the right-hand side, in that menu there are a few tabs such as 'chat'. From chat you can select something to chat about and that option becomes closed.

Could anyone tell me how I would go about that,

I tried to open the game itself to check the code but I cant access the scripts or anything. Can anyone help?
 

Lucky Guerrilla

Newbie
Game Developer
Jan 26, 2021
98
648
It'll just screens and labels. Possibly even a variable that stores the last label called so you return to the game as normal.



Will help you with that last one. I searched ages to find it because I was certain Renpy kept a record of it!
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,963
16,203
It'll just screens and labels.
Labels are totally useless for what he want.

Something like this is enough :
Code:
default currentMenu = "talk"

screen mainMenu():

    if currentMenu == "talk":
        use talkMenu()
    elif currentMenu == "interact":
        use interactMenu()

    textbutton "cancel":
        xalign 0.5
        yalign 0.9
        action Return( "cancel" )


screen talkMenu():

    hbox:
        text "talk"
        textbutton "interact" action SetVariable( "currentMenu", "interact" )

    vbox:
        textbutton "philosophy" action Return( "philo" )
        textbutton "sport" action Return( "sport" )


screen interactMenu():

    hbox:
        textbutton "talk" action SetVariable( "currentMenu", "talk" )
        text "interact"

    vbox:
        textbutton "Grope" action Return( "grope" )
        textbutton "kiss" action Return( "kiss" )

label interaction:
    call screen mainMenu
    if _return == "philo":
        "You talked about philosophy for hours."
    elif _return == "sport":
        "You talked about sport."
    elif _return == "grope":
        "You groped her."
    [...]

Will help you with that last one. I searched ages to find it because I was certain Renpy kept a record of it!
It don't, and label_callback have some limitations. It will not tell you in what label you are, but what was the last label that was jumped to or called.

If you've something like :
Code:
label whatever:
    "line 1"
    call calledLabel
    "line 3"
    call secondLabel from whatever_1
    "line 5"

label implit:
     "line 6"
     "DONE"
     return

label calledLabel:
    "line 2"
    return

label secondLabel:
    "line 4"
    return
a basic function using label_callback will give you the following labels:
  • Line 1 / whatever
  • line 2 / calledLabel
  • line 3 / calledLabel
  • line 4 / secondLabel
  • line 5 / whatever_1
  • line 6 / whatever_1

It's possible to have "line 3" look like being in the "whatever" label, if your callback function take count of the calling stack depth, but line 5 and line 6 will always be seen as bogus.
The callback function also have to take care of Ren'py's core, since part of it also rely on labels.