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.
What I'm trying to do might be a bit complicated. Basically, I want to simulate an account creation. On one screen, players will input their chosen username and password. Later, they can log into a simulated website using said username/password.
To accomplish this, there are a few specific things I'd like to include for as realistic of an experience as possible.
1. The username and password input will be on the same screen. I haven't come across any way to have multiple available inputs at once.
2. I want players to be able to click the username or password box to switch which input is active. Once clicked, the box image would change to indicate that it's active. Perhaps with a sound effect as well?
3. There needs to be text of a certain length in each box before players can proceed. Otherwise, an error would appear. 4. Lastly, and perhaps most importantly, I'm looking for a way to ensure that if players enter the specific string of text they inputed for their username/password, it will enable them to "log in".
Does anyone have any idea at all how I would go about doing any of this? I'm honestly a bit lost. x_x
All help is tremendously appreciated!
Side Note: I imagine this sounds like it could potentially be an irritating feature for players. I will say that it serves a purpose in the overall narrative, but it won't be something that needs to be done repeatedly.
Last edited by Offworlder on Sun Jul 21, 2019 5:08 am, edited 1 time in total.
Offworlder wrote: ↑Sat Jul 20, 2019 8:50 pm
What I'm trying to do might be a bit complicated. Basically, I want to simulate an account creation. On one screen, players will input their chosen username and password. Later, they can log into a simulated website using said username/password.
To accomplish this, there are a few specific things I'd like to include for as realistic of an experience as possible.
1. The username and password input will be on the same screen. I haven't come across any way to have multiple available inputs at once.
2. I want players to be able to click the username or password box to switch which input is active. Once clicked, the box image would change to indicate that it's active. Perhaps with a sound effect as well?
3. There needs to be text of a certain length in each box before players can proceed. Otherwise, an error would appear.
4. Lastly, and perhaps most importantly, I'm looking for a way to ensure that if players enter the specific string of text they inputed for their username/password, it will enable them to "log in".
Does anyone have any idea at all how I would go about doing any of this? I'm honestly a bit lost. x_x
All help is tremendously appreciated!
Side Note: I imagine this sounds like it could potentially be an irritating feature for players. I will say that it serves a purpose in the overall narrative, but it won't be something that needs to be done repeatedly.
This is not what you are asking for, but it will do the job.
Maybe there is something in this you will find useful.
Per K Grok wrote: ↑Sun Jul 21, 2019 1:43 am
This is not what you are asking for, but it will do the job.
Maybe there is something in this you will find useful.
I know you gave a disclaimer right at the beginning, so I certainly won't complain too much!
Part of your code actually does one major thing I was trying to figure out. Specifically, the ability to parse information from two different input boxes when determining whether the player receives an error or can proceed forward. On the flip side, I noticed you have a defined username/password right from the beginning. For story-reasons, it's very important for the player to create their own username/password (perhaps with a similar code as the one that allows a nameable protagonist?). Then, at a later point, they must enter the created username/password into a different input box in order to proceed. Perhaps this would also be similar to the "nameable protagonist" code? I've honestly been having trouble getting it to work, so that might be part of the problem. x_x
The other major thing is having both input boxes on the same screen, where yours are actually on separate screens.
Either way, though, I appreciate your assistance! I think I can work with at least the one part of your code. : )
Offworlder wrote: ↑Sun Jul 21, 2019 2:59 am
On the flip side, I noticed you have a defined username/password right from the beginning. For story-reasons, it's very important for the player to create their own username/password (perhaps with a similar code as the one that allows a nameable protagonist?). Then, at a later point, they must enter the created username/password into a different input box in order to proceed. Perhaps this would also be similar to the "nameable protagonist" code?
This will add user chosen username and password.
I don't at this time see a way to avoid using a two screen solution. It is easy to show two inputs at the same time but I have found no way to shift focus between them.
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 47, in script
show screen login1
File "renpy/common/000statements.rpy", line 510, in execute_show_screen
renpy.show_screen(name, *args, **kwargs)
Exception: Screen login1 is not known.
If I use the second code in conjunction with the code from your first post (specifically the portion before the start label), it tells me the username and password are incorrect instead of allowing me to define my own.
Offworlder wrote: ↑Sun Jul 21, 2019 4:35 am
Unfortunately, this most recent example isn't quite working. If I use just the code from your second post, it gives me this error:
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 47, in script
show screen login1
File "renpy/common/000statements.rpy", line 510, in execute_show_screen
renpy.show_screen(name, *args, **kwargs)
Exception: Screen login1 is not known.
If I use the second code in conjunction with the code from your first post (specifically the portion before the start label), it tells me the username and password are incorrect instead of allowing me to define my own.
It is the original code with an addition an a small change. In my second post I only showed the part with the addition and the change.
This is the full code.
Per K Grok wrote: ↑Sun Jul 21, 2019 4:56 am
It is the original code with an addition an a small change. In my second post I only showed the part with the addition and the change.
This is the full code.
I works fine for me.
Oh! I'm not sure what I did wrong the first time, but that definitely works. It'll take some finagling to get it set up the specific way I have in mind, but that's two conundrums solved. Thank you so much!
Even if it's not super straightforward, I'm positive there must be a way to have two selectable input boxes on the same screen.
Offworlder wrote: ↑Sun Jul 21, 2019 5:07 am
Even if it's not super straightforward, I'm positive there must be a way to have two selectable input boxes on the same screen.
I got an idea.
What if you have two inputs on a screen, but only show them one at a time and replace the one not showing with a string? I would expect the one showed to have focus.
You could use mouseareas to switch between which input would be shown.
So I tested the idea and it worked. It's a bit of a roundabout way of doing it, but ....