Hold key to move picture? (Opening eyes mechanic)

Greetings.

For a project I'm currently working on, there are several moments where the protagonist sleeps. Here is a rundown on what occurs:
1. There is an RNG through a common event and essentially, he can open his eyes through the holding of a key (the a key).
2. From holding the key, two black pictures (the eyelids) move to open, revealing another picture (the RNG can determine if it is something pleasant or...not).
3. If the key is released, the "eyelids" close again.
4. The player has 5 seconds to react, though it would take 3 seconds to fully open the eyelids.
5a. If player fully opens eyes, they see the next picture.
5b. If player doesn't fully open eyes, the eyelids just close and moves on to the next event.

My question is on how one would go about this.

So far, this is what I have thanks to another forum I saw.
1684334704395.png

1684334726356.png
Your comments and your commands do not fit together at several places, like the comment claiming to increase +1 to holdtime when the command is to reset hold to zero on pressed A

That makes it difficult to even understand what your logic is supposed to do
Your comments and your commands do not fit together at several places, like the comment claiming to increase +1 to holdtime when the command is to reset hold to zero on pressed A

That makes it difficult to even understand what your logic is supposed to do

Sorry about that, those two were supposed to be switched around, so it's really this:
1684338385160.png


I was also following this post on this forum to try and get a starting idea on what to do with this sort of situation.
Is this maybe an Error? I noticed that
in your Picture he is subtracting (-1). 2 times minus equals plus.
at the moment it is:
var9 time limit -= (-1)
is that producing the correct result? Because it is adding 1 and not substracting 1.
And since the Var is going up instead of down, your conditional branch to break the loop will never be fulfilled.
Just a blind Guess.
Is this maybe an Error? I noticed that
in your Picture he is subtracting (-1). 2 times minus equals plus.
at the moment it is:
var9 time limit -= (-1)
is that producing the correct result? Because it is adding 1 and not substracting 1.
And since the Var is going up instead of down, your conditional branch to break the loop will never be fulfilled.
Just a blind Guess.
Ack, an oversight! It is indeed not supposed to be -1 but regular positive 1.

That being said, I'm still not getting the results I wish for. I may try and use Yanfly's Button Common Events to help and assign the A key to that common event but then I'm not so sure what to do from there. I'm still only on Step 1 where the RNG is made, but haven't had much success in the eyelids moving with the A key.
That being said, I'm still not getting the results I wish for.
I do not know if this will help you, but I found that in some cases it is better to split timer and key-checks into diferent events using parallel processes.

This does NOT work in every case, and it requires a much more complex structure with switches to pass information between the different parallel processes, which is why I usually don't suggest this method of handling things (and especially since I don't have the time to write a tutorial for it).

But if all else fails you might consider trying that.
Basically one parallel for checking the key and turning switches based on pressed for x frames, and one event handling the timer checking if the switch is on from the other event or if the timer run out, stopping everything in the latter case.
and you'll need one event with your normal way of triggering where you configure and start the two parallels.
I do not know if this will help you, but I found that in some cases it is better to split timer and key-checks into diferent events using parallel processes.

This does NOT work in every case, and it requires a much more complex structure with switches to pass information between the different parallel processes, which is why I usually don't suggest this method of handling things (and especially since I don't have the time to write a tutorial for it).

But if all else fails you might consider trying that.
Basically one parallel for checking the key and turning switches based on pressed for x frames, and one event handling the timer checking if the switch is on from the other event or if the timer run out, stopping everything in the latter case.
and you'll need one event with your normal way of triggering where you configure and start the two parallels.

Well...if it works, it works. I'm definitely going to give it a crack and will speak up if I run into any more problems or if I've run into success. Thanks for the response. 👍

Original thread: https://forums.rpgmakerweb.com/threads/hold-key-to-move-picture-opening-eyes-mechanic.157592/