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.
I'm trying to code a screen where the player chooses a first name and a last name for the main character, but I'm not especially familiar with coding custom screens, and I've run into a slight issue. I'm basing my code on what's in this thread, but I want to add a second input for the last name. So my slightly modified version of that code looks like this:
I like the way that screen looks, and it seems to mostly be working, but I'm currently unable to actually change the default last name - the screen seems to only let me change the first one, and I can't click over to the other input box for the last one. Is there something specific I need to change that will allow for multiple inputs on one screen? Thanks!
Be aware that in order to type on the input, you need to have your cursor placed within the `input`'s `button`, since the `input`s are encapsulated inside them.
hell_oh_world wrote: ↑Sat Feb 27, 2021 2:02 pm
Be aware that in order to type on the input, you need to have your cursor placed within the `input`'s `button`, since the `input`s are encapsulated inside them.
Thanks for your help! This is mostly working now, but it seems to me like needing to keep the cursor right on the button will also be an issue. Is there a way to change that so that the player can move their mouse away from it and still type stuff in? I imagine most people probably won't naturally keep their cursor right on top of what they're typing.
For that, you need to have the input outside the button. The problem with that is you have to position the button that will activate that specific input and the input separately. You will also need to manually set the size of the button so that it's the same as the size of the input, so it will look like a normal input field.
Kia wrote: ↑Fri Mar 12, 2021 1:56 pm
I remember doing something like this by toggling inputs and buttons . . .
I finally got back to working on this, and I wanted to let you and anyone else who might come across this thread with a similar issue know that this comment was exactly what I needed to figure it out! My code ended up looking like this:
Wow! This looks great! I've been thinking of how to do this for a while. Definitely going to do something similar to this in a project of mine! Can't wait to try it out.