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

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
corny
Regular
Posts: 41
Joined: Sun Sep 18, 2011 1:08 pm
Contact:

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

#1 Post 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

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

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

#2 Post 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.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

corny
Regular
Posts: 41
Joined: Sun Sep 18, 2011 1:08 pm
Contact:

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

#3 Post 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...

Flakmunky
Newbie
Posts: 6
Joined: Sun Oct 23, 2016 10:07 am
Contact:

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

#4 Post 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.

william_dickson
Newbie
Posts: 10
Joined: Tue Apr 23, 2019 1:18 am
Completed: >10 html5/canvas javascript browser games
Organization: eroticinteractivegames.com
Location: Glasgow, Scotland
Contact:

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

#5 Post 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 ...

User avatar
Andredron
Miko-Class Veteran
Posts: 718
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

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

#6 Post by Andredron »

Also interested since bublé came up.... I should check out the info on this...

User avatar
Sirifys-Al
Newbie
Posts: 4
Joined: Sat Apr 20, 2024 3:55 pm
Contact:

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

#7 Post 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!

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

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

#8 Post 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!!"

User avatar
Sirifys-Al
Newbie
Posts: 4
Joined: Sat Apr 20, 2024 3:55 pm
Contact:

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

#9 Post 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?

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

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

#10 Post 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.

User avatar
Sirifys-Al
Newbie
Posts: 4
Joined: Sat Apr 20, 2024 3:55 pm
Contact:

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

#11 Post 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...

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

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

#12 Post 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")

User avatar
Sirifys-Al
Newbie
Posts: 4
Joined: Sat Apr 20, 2024 3:55 pm
Contact:

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

#13 Post 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!

Post Reply

Who is online

Users browsing this forum: No registered users