Showing text after clicking on a textbutton?

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
User avatar
marew603
Newbie
Posts: 8
Joined: Tue May 26, 2020 3:40 pm
Projects: A Dream That is Not My Reality
Organization: Skyrocket Studios
IRC Nick: Yuuki
Discord: marew603#0348
Contact:

Showing text after clicking on a textbutton?

#1 Post by marew603 »

Is there any way I can have the main character say something after clicking on a textbutton? I have a phone icon on top of the screen that pulls up a screen and you can decide what to do, like view stats and contacts, etc. I have two versions of the screen. phone() and phonereview(). You can call friends when it's time to study and hang out with them but while the main story is progressing you cannot. I want to make it so when you try to call up a friend when the main story is occurring the character says something like. "I can't call them right now, let's wait until we get home."

heres the code for both screens, the error screen is just a message saying the mechanic isn't functional yet:

screen phone():
modal True
add "phoneguiv1" xalign 0.5 yalign 0.5
vbox yalign 0.32 xalign 0.4 spacing 70:
textbutton "{color=#000}Messages{/color}" action Show ("error")
textbutton "{color=#000}Camera{/color}" action Show("error")
textbutton "{color=#000}Bonds{/color}" action Show ("bonds"), Hide ("phone")
vbox yalign 0.32 xalign 0.5 spacing 70:
textbutton "{color=#000}Contacts{/color}" action Show ("error") # show text here?
textbutton "{color=#000}Schedule{/color}" action Show ("error")
textbutton "{color=#000}Stats{/color}" action Show ("error")
vbox yalign 0.32 xalign 0.6 spacing 70:
textbutton "{color=#000}Birds{/color}" action Show ("error")
textbutton "{color=#000}R.P.{/color}" action Show ("rp"), Hide ("phone")
textbutton "{color=#000}go back{/color}" action Hide ("phone")

screen phonereview():
modal True
add "phoneguiv1" xalign 0.5 yalign 0.5
vbox yalign 0.32 xalign 0.4 spacing 70:
textbutton "{color=#000}Messages{/color}" action Show ("error")
textbutton "{color=#000}Camera{/color}" action Show("error")
textbutton "{color=#000}Bonds{/color}" action Show ("bonds"), Hide ("phone")
vbox yalign 0.32 xalign 0.5 spacing 70:
textbutton "{color=#000}Contacts{/color}" action Show ("contacts"), Hide ("phone")
textbutton "{color=#000}Schedule{/color}" action Show ("error")
textbutton "{color=#000}Stats{/color}" action Show ("error")
vbox yalign 0.32 xalign 0.6 spacing 70:
textbutton "{color=#000}Birds{/color}" action Show ("error")
textbutton "{color=#000}R.P.{/color}" action Show ("rp"), Hide ("phone")
textbutton "{color=#000}go back{/color}" action Hide ("phone")

If it's not possible to say something after clicking on a textbutton then is there a way to do something similar? I just picked up renpy not too long ago so I'm still learning and I'd love some tips and tricks.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Showing text after clicking on a textbutton?

#2 Post by namastaii »

you can call a label (create a short label with a return that has the dialogue you want) with the textbutton
https://www.renpy.org/doc/html/label.ht ... -statement

Code: Select all

action Call("your_label_name_here")

Post Reply

Who is online

Users browsing this forum: No registered users