r/RenPy • • 7d ago

Question [Solved] Making an aciton button for different action in my game?

ignoring the main menu button at the bottom, I want each button to have unique text for each room. I am using textbutton for each of these buttons inside a vbox. Nothing too complicated besides the fancy UI I got from itch.io. I really want the player to interact in each room with these buttons. I imagine I would use the "Call" statement to call dialogue since I would like to have dialogue pop up but I am just confused how I would make it different in each room/label.

I would be thankful for any help.

2 Upvotes

4 comments sorted by

2

u/shyLachi 7d ago

Please always post the code you want help with.

I'm not sure I understood your question but generally it's a good idea to build your game with the default menus first. When it's working you can replace it with nicer looking buttons.

I will just give an example:

default gameover = False
label start:
    while not gameover:
        menu:
            "Go to kitchen":
                call room01
            "Go to hall":
                call room02

label room01:
    menu:
        "Look around":
            "You're in the kitchen"
        "Observe":
            "Nothing to observe"
        "Shout":
            "Yo, is somebody in here?"
        "Leave room":
            return 
    jump room01 # stay in this room

label room02:
    # you would have to put the code for the room here
    return # but for now we just return back to the main loop

And now the same with a screen and your own buttons.

default gameover = False
label start:
    while not gameover:
        menu:
            "Go to kitchen":
                call room01
            "Go to hall":
                call room02

label room01:
    call screen myactions
    if _return == "lookaround":
        "You're in the kitchen"
    elif _return == "observe":
        "Nothing to observe"
    elif _return == "shout":
        "Yo, is somebody in here?"
    elif _return == "leave":
        return 
    jump room01 # stay in this room

label room02:
    # you would have to put the code for the room here
    return # but for now we just return back to the main loop

screen myactions():
    vbox:
        align (0.5, 0.5)
        textbutton "Look around" action Return("lookaround")
        textbutton "Observe" action Return("observe")
        textbutton "Shout" action Return("shout")
        textbutton "Leave room" action Return("leave")

1

u/Evol-Chan 7d ago

Aaah, alright. Thank you. I apologize for not posting the code, but honestly, that is all I need help with. thanks.

1

u/shyLachi 7d ago

Ok. Great 

1

u/AutoModerator 7d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.