Have "renpy.input" display as though character dialogue?

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
Offworlder
Regular
Posts: 114
Joined: Mon Aug 20, 2018 6:33 pm
Contact:

Have "renpy.input" display as though character dialogue?

#1 Post by Offworlder »

Is there a way to have text used for an input screen display like standard dialogue (with a character name, and the letters typing themselves out instead of appearing all at once)?

I want it to be like the character is asking a question, and the player should type in their answer. It's a bit jarring for the text not to display the same as every other line of dialogue, and not have the character's name attached to it.

I hope that makes sense. x_x

Here's the code I currently have:

Code: Select all

label firstspell:
	$ res = renpy.input("\"Just...let me know if you find anything, okay?\"")
	if res == "":
		jump firstspell
	elif res != "123":
		jump wrongspell1

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Have "renpy.input" display as though character dialogue?

#2 Post by Remix »

Guesswork...

renpy.input( Text( _('"Just...let me know if you find anything, okay?"'), slow_cps=5.0) ).strip()
Frameworks & Scriptlets:

User avatar
Offworlder
Regular
Posts: 114
Joined: Mon Aug 20, 2018 6:33 pm
Contact:

Re: Have "renpy.input" display as though character dialogue?

#3 Post by Offworlder »

Remix wrote: Mon Jan 07, 2019 10:16 am Guesswork...

renpy.input( Text( _('"Just...let me know if you find anything, okay?"'), slow_cps=5.0) ).strip()
That actually works perfectly! Thanks a ton for your quick response. ^^
The only other thing I'd like to figure out is how to add the character's name to the input dialogue.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Have "renpy.input" display as though character dialogue?

#4 Post by Imperf3kt »

I actually use such a feature as a lock for deleting all game data (for development purposes)
https://i.imgur.com/ZFwFdqW.png

I don't remember if I was able to show the character name or not, being an unwanted feature for my particular use, but I do remember that I do it a bit differently than shown by Remix.

After work I'll test to see if it allows it.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Offworlder
Regular
Posts: 114
Joined: Mon Aug 20, 2018 6:33 pm
Contact:

Re: Have "renpy.input" display as though character dialogue?

#5 Post by Offworlder »

Imperf3kt wrote: Mon Jan 07, 2019 4:55 pm
If you have any suggestions, I would definitely appreciate it!
This is the last thing I need to figure out for my current game.

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

Re: Have "renpy.input" display as though character dialogue?

#6 Post by Alex »

Offworlder wrote: Mon Jan 07, 2019 8:50 am Is there a way to have text used for an input screen display like standard dialogue (with a character name, and the letters typing themselves out instead of appearing all at once)?
Does your character have a side image or just a name? If the last, then you can add this name at the beginning of prompt message (use text tags to change it's color and all).
Otherwise you can modify a choice screen a bit - like add some global variable check and show some extra text and image before input itself to simulate the speaking character.

User avatar
Offworlder
Regular
Posts: 114
Joined: Mon Aug 20, 2018 6:33 pm
Contact:

Re: Have "renpy.input" display as though character dialogue?

#7 Post by Offworlder »

Alex wrote: Tue Jan 08, 2019 5:04 pm Does your character have a side image or just a name? If the last, then you can add this name at the beginning of prompt message (use text tags to change it's color and all).
No side image! Hopefully that means this will have a simpler resolution. >_o

I could just add their name to the beginning of the prompt, but I was hoping to have it positioned in the same place as usual. Which is just the default position for a speaking character, by the way.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Have "renpy.input" display as though character dialogue?

#8 Post by Imperf3kt »

Offworlder wrote: Tue Jan 08, 2019 4:11 pm
Imperf3kt wrote: Mon Jan 07, 2019 4:55 pm
If you have any suggestions, I would definitely appreciate it!
This is the last thing I need to figure out for my current game.
I completely forgot yesterday after being stuck at work an additional three hours :<

Anyway, I fiddled with what I used and it can't take a name as far as I know.

Code: Select all

label delach:
    $ clearachieve = renpy.input('Input Password', length=9) or None
    if clearachieve == 'imperf3kt':
        $ achievement.clear_all()
        e "All your achievement are belong to me!"
    else:
        e "Access denied!"
But then I tried the code provided by Remix, and just tried this, not really sure what to expect:

Code: Select all

    e "Testing"
    $renpy.input( e( _('"Just...let me know if you find anything, okay?"'), slow_cps=5.0) ).strip()
    return
    
And it worked, a name was shown with the input field, though it was slowly revealed like the rest of the text. remove the , slow_cps=5.0 to fix that.

However, after that the game crashed, stating it can't display None as text, so I'm missing something.


For reference, "e" is defined as a Character

Code: Select all

define e = Character("Eileen")
Image
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Offworlder
Regular
Posts: 114
Joined: Mon Aug 20, 2018 6:33 pm
Contact:

Re: Have "renpy.input" display as though character dialogue?

#9 Post by Offworlder »

Imperf3kt wrote: Wed Jan 09, 2019 8:22 am However, after that the game crashed, stating it can't display None as text, so I'm missing something.
Just to be thorough, I tried out your code. It initially worked as with your attempt, but caused an error as soon as I clicked. I tried putting the name tag in every other position I could think of as well, but only received various different errors.

I don't suppose you were able ultimately able to figure out a solution?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot]