Page 1 of 1

Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sun Aug 20, 2017 12:35 pm
by corny
Pretty much what it says as the title, is this something you can do? As far as I can tell it isn't, and I've messed around with it a lot, but I figured I'd ask before throwing in the towel.

And in case it isn't entirely clear what I mean, I mean having a character's name on here instead of the empty narrator, like they're asking you to enter text
Image

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sun Aug 20, 2017 12:42 pm
by PyTom
You can easily fake it.

You can go into screens.rpy to add a character's name as part of the input screen. (You can copy the namebox stuff over from the say screen.)

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sun Aug 20, 2017 2:52 pm
by corny
Could you show me how that code should look? I'm using the legacy GUI so I'm not sure if what I'm using is the same as what you're using, and I don't have a full comprehension of how the say screen code works enough to confidently know what needs to be copy pasted or where it needs to go...

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sun Dec 16, 2018 9:06 am
by Flakmunky
Hi,

I'm trying to do the same...

I want one of my characters to ask 'What is your name?' but I'm not sure how to do this.

E.g.
This:

Jenna
What is your name?
[Player types here]

Rather than:

What is your name?
[Player types here]


Thanks in advance.

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sun May 16, 2021 8:08 am
by william_dickson
Bump. 5 years later, this is what google brings me to, and it isn't answered. I'd like a character with name and left side image (all of which sorted, and I know how to to the standard input too) to ask for the input instead of the narrator. No solution? I'll google some more ...

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Fri Apr 19, 2024 7:39 am
by Andredron
Also interested since bublé came up.... I should check out the info on this...

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sat Apr 20, 2024 4:01 pm
by Sirifys-Al
Andredron wrote: Fri Apr 19, 2024 7:39 am Also interested since bublé came up.... I should check out the info on this...
Have you found a solution yet? I would really like to know!

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sat Apr 20, 2024 6:25 pm
by m_from_space
Sirifys-Al wrote: Sat Apr 20, 2024 4:01 pm
Andredron wrote: Fri Apr 19, 2024 7:39 am Also interested since bublé came up.... I should check out the info on this...
Have you found a solution yet? I would really like to know!
Normally, the "input" screen is doing the work here. You can find it inside <screens.rpy>. So depending on what you want, you either change that screen, making sure it has a namebox that shows the name of a specific character, or you create your own screen and tell that when using renpy.input()...

I advice you to make your own custom screen, so to not alter the original input screen, whenever you need it. Here is what you can do:

Code: Select all

screen myinput(prompt):
    style_prefix "input"
    window:
        if prompt[0]:
            window:
                style "namebox"
                text prompt[0]
        vbox:
            xanchor gui.dialogue_text_xalign
            xpos gui.dialogue_xpos
            xsize gui.dialogue_width
            ypos gui.dialogue_ypos

            text prompt[1] style "input_prompt"

            # this field with this specific id is necessary for the custom input screen
            input id "input"

label start:
    "So Eileen finally took a chance..."
    # Whenever you use renpy.input for the custom screen, don't just use a prompt string,
    # but a list that contains a name and then the prompt
    $ mc_name = renpy.input(["Eileen", "What is your name?"], screen="myinput")
    e "[mc_name]!??? That's so cute!!"

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sat Apr 20, 2024 6:26 pm
by Sirifys-Al
m_from_space wrote: Sat Apr 20, 2024 6:25 pm
Normally, the "input" screen is doing the work here. You can find it inside <screens.rpy>. So depending on what you want, you either change that screen, making sure it has a namebox that shows the name of a specific character, or you create your own screen and tell that when using renpy.input()...

I advice you to make your own custom screen, so to not alter the original input screen, whenever you need it. Here is what you can do:

Code: Select all

screen myinput(prompt):
    style_prefix "input"
    window:
        if prompt[0]:
            window:
                style "namebox"
                text prompt[0]
        vbox:
            xanchor gui.dialogue_text_xalign
            xpos gui.dialogue_xpos
            xsize gui.dialogue_width
            ypos gui.dialogue_ypos

            text prompt[1] style "input_prompt"

            # this field with this specific id is necessary for the custom input screen
            input id "input"

label start:
    "So Eileen finally took a chance..."
    # Whenever you use renpy.input for the custom screen, don't just use a prompt string,
    # but a list that contains a name and then the prompt
    $ mc_name = renpy.input(["Eileen", "What is your name?"], screen="myinput")
    e "[mc_name]!??? That's so cute!!"
Thank you very much! Somehow I haven't thought that I can just chande the screen...

Edited: oh, one more question: with this code, will I be able to set things like input length, allowed characters and so on?

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sat Apr 20, 2024 6:41 pm
by m_from_space
Sirifys-Al wrote: Sat Apr 20, 2024 6:26 pm Edited: oh, one more question: with this code, will I be able to set things like input length, allowed characters and so on?
Yes, Renpy handles all of this as part of the renpy.input() function, so you can just pass the usual keyword arguments like "length", "exclude", "mask"... at least I hope it won't raise some exception because the prompt is not just a string anymore. But even then you could change the input screen using a string prompt, which we then just split up into a list or something, extracting the name of the speaking person.

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sat Apr 20, 2024 6:43 pm
by Sirifys-Al
m_from_space wrote: Sat Apr 20, 2024 6:41 pm
Sirifys-Al wrote: Sat Apr 20, 2024 6:26 pm Edited: oh, one more question: with this code, will I be able to set things like input length, allowed characters and so on?
Yes, Renpy handles all of this as part of the renpy.input() function, so you can just pass the usual keyword arguments like "length", "exclude", "mask"... at least I hope it won't raise some exception because the prompt is not just a string anymore.
Yeah, me too...

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sat Apr 20, 2024 6:48 pm
by m_from_space
Sirifys-Al wrote: Sat Apr 20, 2024 6:43 pm
m_from_space wrote: Sat Apr 20, 2024 6:41 pm
Sirifys-Al wrote: Sat Apr 20, 2024 6:26 pm Edited: oh, one more question: with this code, will I be able to set things like input length, allowed characters and so on?
Yes, Renpy handles all of this as part of the renpy.input() function, so you can just pass the usual keyword arguments like "length", "exclude", "mask"... at least I hope it won't raise some exception because the prompt is not just a string anymore.
Yeah, me too...
I mean it works on my end, but I didn't test any edge cases. But here is how you would do it not using a list, but a string:

Code: Select all

screen myinput(prompt):
    default prompt_list = prompt.split("|")
    ...
    
label start:
    $ name = renpy.input("Eileen|What is your name?", screen="myinput")

Re: Is it possible for the renpy.input dialogue to be said by a character and not the narrator?

Posted: Sun Apr 21, 2024 5:36 am
by Sirifys-Al
m_from_space wrote: Sat Apr 20, 2024 6:48 pm
Sirifys-Al wrote: Sat Apr 20, 2024 6:43 pm
m_from_space wrote: Sat Apr 20, 2024 6:41 pm

Yes, Renpy handles all of this as part of the renpy.input() function, so you can just pass the usual keyword arguments like "length", "exclude", "mask"... at least I hope it won't raise some exception because the prompt is not just a string anymore.
Yeah, me too...
I mean it works on my end, but I didn't test any edge cases. But here is how you would do it not using a list, but a string:

Code: Select all

screen myinput(prompt):
    default prompt_list = prompt.split("|")
    ...
    
label start:
    $ name = renpy.input("Eileen|What is your name?", screen="myinput")
Thanks!