Wait for key input script?

Mako

Veteran
Veteran
Joined
Mar 13, 2012
Messages
276
Reaction score
48
First Language
English
Primarily Uses
So I was on a roll in my game until I hit a roadblock. Due to the way I'm displaying images (making text fade like the intro to Final Fantasy 1) I'm unable to "event" this with any luck...

What should have been simple has stumped me all week. I would like to request a script that pauses the event and waits for key input to continue. Such as:

Displays image

[Waits for input]

Displays another image

If there is a way to event this I'm all ears, but I think a script would be simpler for the developer (going to have a bunch of these events) and the developer wouldn't have to guess the users reading speed with timing. 
 

Hollow

(◡‿◡✿)
Veteran
Joined
Jul 14, 2012
Messages
519
Reaction score
439
First Language
English
Primarily Uses
RMMV
You could just display the image and then immediately afterwards call up a blank, transparent text box. Once the player closes the text box, then you can erase the first image and show the next.
 

Evgenij

Veteran
Veteran
Joined
Aug 28, 2013
Messages
349
Reaction score
100
First Language
German
Primarily Uses
N/A
try to make a loop with an conditional inside which checks for input and if there was break out of the loop
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
There is a script written by Tsukihime which can do exactly this.


It operates with a script call which checks if any key was pressed or not.


You can find it easily here, just search for Tsukihime's topics.


Or if you want a specific key trigger, you don't need a script for that one.


Make your event, show the picture, than make a loop command.


Inside the loop command, make a conditional branch with a script call.


The script call looks like this:

Input.trigger?:)C)This specific script call returns true if the player presses the confirm button, else it returns false.
So, in the 'true' part, you need to make a 'break loop' command.


In the 'else' part, you add a simple 'wait' command with 1 frame.


Any command(s) below the loop command will execute only if the player presses the confirm button.


You can change ':C' to any valid button input symbol if you want a different button trigger, of course.


And these should be the basics of eventing a "waiting for button press" thing.


Basically, it is just a loop command and a conditional check.


This looks the same with Tsukihime's script, except you use the new script call which is provided with that script. That would make it so the event continues with any button press, not only with a specific one.
 

Mako

Veteran
Veteran
Joined
Mar 13, 2012
Messages
276
Reaction score
48
First Language
English
Primarily Uses
try to make a loop with an conditional inside which checks for input and if there was break out of the loop
Problem with that is the fade affect repeats until I press sumthin'...

You could just display the image and then immediately afterwards call up a blank, transparent text box. Once the player closes the text box, then you can erase the first image and show the next.
That is the next alternative (will probably use this if I can't find a script) problem with that is it leave the window skin system icon, also waits for any key to be pressed, I'm looking for a specific key, or just one key. But like I said, I'll prolly end up using this hackish method. 

EDIT: Interesting Sixth, I'll try that. :D
 
Last edited by a moderator:

Evgenij

Veteran
Veteran
Joined
Aug 28, 2013
Messages
349
Reaction score
100
First Language
German
Primarily Uses
N/A
Which fade effect?

I ment exactly the same as Sixth and there is no need to use Input.trigger?:)C) in the conditional.

There is an option for button press just above the script command in the conditional window.
 

Mako

Veteran
Veteran
Joined
Mar 13, 2012
Messages
276
Reaction score
48
First Language
English
Primarily Uses
It's an effect that loads the text through images that gives the effect of "fading". Example below.



I read the loop and event tutorials (nice read) but that only loops the fading effect like above, I'm more looking for the even to wait or pause until a button or trigger is pressed. That or I'm just not good enough at eventing. Hmmm
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
That default button press checker is faulty, sometimes registers, sometimes not and sometimes it registers twice of more times. I never use that.


And with that one, you can't make custom input trigger checkers, only the default inputs are included.


Another reason why I don't use that, but I guess it depends if someone uses a custom input script or not.


And yeah, the event will simply wait until the button is pressed.


Nothing executes before that.
 
Last edited by a moderator:

Mako

Veteran
Veteran
Joined
Mar 13, 2012
Messages
276
Reaction score
48
First Language
English
Primarily Uses
Perhaps you could spend a few moments of your valuable time Sixth to show me in the event window? I simply can't figure it out, I'd greatly appreciate it. loop inside of a loop with conditional branching still sounds cumbersome heh but I'll take whatever I can get.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Sorry, went to code a bit. :D


Actually it is easier than you would think. :p


Having a looping image sequence running in the meantime complicates it a bit, but it is still manageable without scripts.


But I have no idea if this is a good solution, because I don't know how many times and with how many different image sequences would you do this.


Anyway, here is how I did quite a few quick-time events in my project:


First, you need a common event with a parallel process. Parallel process events are looping by default, so we don't need a loop command there.


Here is a simple animation with pictures made with a parallel common event:


loopend2.PNG


When you made your common event, you can use it in actual events like this:


loopend1.PNG


Here is what this event will do:


1. Just a text showing that our event started.


2. Turns ON the switch needed for the above made common event.


3. Enters the loop section after this.


4. Waits for the player to press the confirm button.


5. While the event waits for the button press, the pictures would still play on the screen effectively making an animation.


6. When the player press the confirm button, it turns OFF the switch needed for our parallel common event which stops the common event and exits the loop.


7. Erases the last (and only) picture on the screen.


8. A text message appears after to inform us that the event continues to execute the commands below the loop immediately after the player pressed the confirm button.


This works like a charm.


If you are planning to make a whole message system with looping pictures, I can't recommend this method, because it would either take hell of a lot common events (1 for each message), or an extremely long common event, possibly even more of them, because I suppose there is a limit of lines for every common or regular event. You can reduce the common events needed with conditional check in the common events for each message, but that would still take a lot of common event.


But if you are showing these messages only a few times (well, let's say not more than 100 different image sequence), than I would go with this method.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
The "proper" way to wait for input is to make a script call like this

Fiber.yield until Input.trigger?:)C)Or something like that. The reason why using a show text command works is because it will simply yield until you press B or C buttons.
You can't rely on a conditional branch because it doesn't wait for you.
 
Last edited by a moderator:

Mako

Veteran
Veteran
Joined
Mar 13, 2012
Messages
276
Reaction score
48
First Language
English
Primarily Uses
Thanks for the reply, its cool take your time can't complain when your trying to help. That just loops the same animation, making it consistently fade in and out, I want to only fade out when a button is pressed (or switch to another image)

Here maybe this can better illustrate what I'm trying to do...

 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
You can't rely on a conditional branch because it doesn't wait for you.
It does wait if you put a wait command in the 'else' part in the loop.
But that script call should also do the trick, yeah.


So, you want to show an image sequence, stop in the middle (or somewhere), wait for the player, than do another image sequence, rinse and repeat multiple times if needed?


You don't even need a common event for that. :D


I thought you wanted to loop the images too.


So, just make your fade in image sequence and after that enter the loop with the conditional check in the event command list.


After the loop, make your fade out animation.


If you want to start another fade in effect, put it after the fade out effect, than the looping conditional check again, and the fade out effect, rinse repeat.


Basically, you just need to put the looping conditional check between the fade in and fade out effects where your transparent text messages are now).


Or you can simply put the script call Tsukihime wrote instead of the looping conditional check method between them, both will do the same.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top