How to make menu choices as a text button?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
DewyNebula
Newbie
Posts: 11
Joined: Sun Apr 21, 2024 10:57 am
Contact:

How to make menu choices as a text button?

#1 Post by DewyNebula »

I saw this viewtopic.php?f=51&t=18047&start=15#p395926 post about making a simple combat minigame. I wanted to make the combat options text buttons instead, though. I cannot for the life of me figure out how to do that with this line of code. Any help would be appreciated!

Code: Select all

menu:
            "Atack!":
                $ wolf_hp -= 2
                r "K-y-aaa!!!11 (damage dealt - 2hp)"
                
            "Eat cookie (got [cookies_left] cookies left)" if cookies_left > 0:
                $ red_hood_hp = min(red_hood_hp+5, red_hood_max_hp)
                $ cookies_left -= 1
                r "Mmm, tasty... (restore 5hp)"

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1004
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: How to make menu choices as a text button?

#2 Post by m_from_space »

DewyNebula wrote: Mon Apr 29, 2024 2:33 pm I saw this viewtopic.php?f=51&t=18047&start=15#p395926 post about making a simple combat minigame. I wanted to make the combat options text buttons instead, though. I cannot for the life of me figure out how to do that with this line of code. Any help would be appreciated!

Code: Select all

menu:
            "Atack!":
                $ wolf_hp -= 2
                r "K-y-aaa!!!11 (damage dealt - 2hp)"
                
            "Eat cookie (got [cookies_left] cookies left)" if cookies_left > 0:
                $ red_hood_hp = min(red_hood_hp+5, red_hood_max_hp)
                $ cookies_left -= 1
                r "Mmm, tasty... (restore 5hp)"
Menu choices in Renpy are by default made via textbuttons. So what exactly is it that you need help with? The code you provided looks okay to me, it will show combat options as textbuttons. o.O What am I missing? xD

DewyNebula
Newbie
Posts: 11
Joined: Sun Apr 21, 2024 10:57 am
Contact:

Re: How to make menu choices as a text button?

#3 Post by DewyNebula »

m_from_space wrote: Mon Apr 29, 2024 2:56 pm
DewyNebula wrote: Mon Apr 29, 2024 2:33 pm I saw this viewtopic.php?f=51&t=18047&start=15#p395926 post about making a simple combat minigame. I wanted to make the combat options text buttons instead, though. I cannot for the life of me figure out how to do that with this line of code. Any help would be appreciated!

Code: Select all

menu:
            "Atack!":
                $ wolf_hp -= 2
                r "K-y-aaa!!!11 (damage dealt - 2hp)"
                
            "Eat cookie (got [cookies_left] cookies left)" if cookies_left > 0:
                $ red_hood_hp = min(red_hood_hp+5, red_hood_max_hp)
                $ cookies_left -= 1
                r "Mmm, tasty... (restore 5hp)"
Menu choices in Renpy are by default made via textbuttons. So what exactly is it that you need help with? The code you provided looks okay to me, it will show combat options as textbuttons. o.O What am I missing? xD
Oh, sorry, let me rephrase. I wanted to create an Hbox with the attack to move around more easily. It would look like this.

Code: Select all

label battle:
    screen battle_1_loop():       
        hbox:
            yalign 0.9
            xalign 0.95
            textbutton "attack":

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]