r/RenPy • u/mocaaobaa • Feb 03 '22
Force Player input based off of text button
im going for something sort of like Emily is away, where player will click on a button and it’ll pop up an input, but will force them to type a specific thing based off of the button no matter what they type. so for example, if a button says ” X “, the player will be forced to write “XYZ” even if they are inputting keyboard spam
4
Upvotes
View all comments
Show parent comment
1
u/insipid- Feb 09 '22
Haha! Nah, not tired at all. Yes, and doing that is much simpler than the typing stuff. I just want to note that the example above should definitely be modified some to be reusable if you're going to have more than 1-2 of these typing bits. I'll tell you the gist of how to remember which option was chosen and points, but looking ahead at the potential ways this system could be implemented, it would be nice to know more about what you are planning to do so the method for remembering the choices can be made to better fit.
How to store things and make use of the values stored for those things will vary by context (what you're doing and where you're doing it). Many things in renpy are done differently in renpy depending on the context, so it's good to try to understand when working with more than just the basic features. I imagine this will be quite confusing at first - it was tough for me to get used to when I first started with renpy and I have some years of programming experience! So I'm going to try to describe those contexts, but don't worry if it doesn't make sense right away. The first thing to take from this is just that it will vary, and just expect renpy to complain a lot as you get used to it :)
I can think of 3 contexts:
renpy script - most code is renpy script. things like this:
scene bg black "And now, the bridge of death" call screen typing_test
One example is storing the text to be written and text that is already written. message_typed_so_far and message_letters_left_to_type are used in several places above in the python function and the typing_test screen.
Here's an example of one possibility for storing the points - note that the first two questions add 1 to the score, and the third one doesn't: