How can I make my character talk, inside a screen?

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
starlingmaximilian
Newbie
Posts: 15
Joined: Mon Oct 14, 2019 4:07 pm
Contact:

How can I make my character talk, inside a screen?

#1 Post by starlingmaximilian » Fri Apr 03, 2020 10:34 am

Hi, I would like my character to say something when you click on a imagebutton.

Right now I'm trying to use: action Show("say(" " , "Whatever")") but this isnt working.
As you can see, I'm trying to call the default say screen that already comes with renpy. The code is as follows.

Code: Select all


screen grabscreen():
            frame:
                xalign 0.6 yalign 0.8
                vbox:
                    textbutton "Keep it":
                        action SetVariable("open", True) , Hide("keys") , Show("dish") , Hide("grabscreen") , Show("say(" ","Now I'll be able to open the door")")
                    textbutton "leave it alone":
                        action Hide("key") , Show("dish") , Hide("grabscreen")

Right now I'm not using the who parameter in the say screen because it's also giving me an error, the the most important thing for me would be to be able to use the say screen.

User avatar
RicharDann
Veteran
Posts: 255
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: How can I make my character talk, inside a screen?

#2 Post by RicharDann » Fri Apr 03, 2020 11:36 am

To use Show(), you need to pass the screen name as a string, then an optional transition argument, and then arguments or keyword for that screen separately. See here.

Code: Select all

Show("say", who=" ", what="Now I'll be able to open the door")
The most important words a man can say are, “I will do better”.
The most important step is always the next one.

starlingmaximilian
Newbie
Posts: 15
Joined: Mon Oct 14, 2019 4:07 pm
Contact:

Re: How can I make my character talk, inside a screen?

#3 Post by starlingmaximilian » Fri Apr 03, 2020 3:22 pm

Thank you so much!

I still have a proble though, the style of the text doesn't match the style of the game.
Instead, it looks plain text, without any kind of formating.

Image

Even more, if I try to use a character to speak, it gets even worse.

Image

Also, for some reason, the dialogue window doesn't go away when I click (like it always does).
Does this have a solution?

User avatar
Alex
Lemma-Class Veteran
Posts: 2572
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: How can I make my character talk, inside a screen?

#4 Post by Alex » Fri Apr 03, 2020 3:38 pm

starlingmaximilian wrote:
Fri Apr 03, 2020 3:22 pm
...Does this have a solution?
Yes - not use it like this.

Try to make a label and call it from your screen.

Code: Select all

screen test_999_scr():
    vbox:
        align(0.1,0.1)
        textbutton "Eileen" action Call("my_label", char=e, txt="Hello!", from_current=True)
        textbutton "Lucy" action Call("my_label", char=l, txt="Hi!", from_current=True)
        null
        textbutton "Close" action [Return(), Hide("test_999_scr")]

label my_label(char, txt):
    char "[txt]"
    return

label start:
    
    "..."
    show screen test_999_scr
    $ ui.interact()
    "?!"
https://www.renpy.org/doc/html/screen_actions.html#Call
https://www.renpy.org/doc/html/statemen ... renpy.call
https://www.renpy.org/doc/html/screen_p ... i.interact

starlingmaximilian
Newbie
Posts: 15
Joined: Mon Oct 14, 2019 4:07 pm
Contact:

Re: How can I make my character talk, inside a screen?

#5 Post by starlingmaximilian » Sun Apr 05, 2020 2:20 pm

Thank you, so much!! It's perfect now.
I'm reading the docs you provided, specially the "ui.interact" one because that is completely new to me, not something that you usually see in renpy tutorials... By the way, It wasn't necccesary to use in order to make the character speak! I just created the label as you told me (with parameters "char, txt")

I don't understand what "from_current=True" does... rading the documentation it says that when True, it runs again the same statement, but I really don't understand how it's being used here, would you mind to please explain?

Thanks again, I was so upset for not being able to do this that I had dreams with it, I'm not kidding you.

User avatar
Alex
Lemma-Class Veteran
Posts: 2572
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: How can I make my character talk, inside a screen?

#6 Post by Alex » Sun Apr 05, 2020 2:59 pm

Code: Select all

$ ui.interact()
Well, you need it to make game waits for something returning from the screen, otherwise the game can be advanced through by clicking. And in this case setting 'modal' property of the screen doesn't work right, 'cause you want to show some character's speaking and player should be able to click through it.

And since we 'call' a label with character talking, 'from_current' property makes the game return to the same line where 'call' was made (in this sample the line with '$ ui.interact()') and not to the next line.

Post Reply

Who is online

Users browsing this forum: chesarty, Google [Bot]