Input Trigger Delay

Status
Not open for further replies.

Kazuki

Veteran
Veteran
Joined
May 22, 2013
Messages
109
Reaction score
7
First Language
English
Primarily Uses
I was wondering if anyone could help me make my custom menu pop up instantly after pressing the X key. I have to press the key several times to get the menu sometimes and other times it pops up right away. I will attach my event page that calls the custom menu.

Input Trigger Delay 1.PNG
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Input.trigger? checks for a key being pressed down, not being held down. You'd be looking for Input.repeat?


Why do you have Change Menu Access: Disable in a parallel process event? That could be influencing it as well.
 

Dalamar

Veteran
Veteran
Joined
Apr 29, 2013
Messages
370
Reaction score
61
First Language
English
Primarily Uses
RMMV
Couldn't this be handled by the conditional branch button is being pressed default?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Actually, I thought that's what the OP WAS using.


You just need to add a Wait in there (when the condition is true) so it's not checking on every frame.
 

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
Actually, I thought that's what the OP WAS using.
Why? I thought you saw the "Input.trigger?" call since you said:

Input.trigger? checks for a key being pressed down, not being held down. You'd be looking for Input.repeat?
The problem is not because of a missing wait command or eventing error, it is a bug from the RTP scripts. (That's why I linked to the fix)

You just need to add a Wait in there (when the condition is true) so it's not checking on every frame.
No. Using a Wait command wouldn't fix the problem the OP is having because the event itself is not being processed every frame, as it should.

Here's the fix and explanation of the problem.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I did see Input.trigger? - I still thought it was just the "Button X is being pressed" in the Conditional Branch. It didn't click that it was a script command. What I SHOULD have said is to use the "Button X is being pressed" condition, not Input.repeat?, which I believe does the same thing.


The event IS being processed, but because the button is not being HIT every frame (as opposed to hit once and held down), the condition is not evaluating to true on every frame. There's only a single frame when it will actually detect it. Hence the need to press several times.
 

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
The event IS being processed, but because the button is not being HIT every frame (as opposed to hit once and held down), the condition is not evaluating to true on every frame. There's only a single frame when it will actually detect it. Hence the need to press several times.
No. Parallel Process events are not processed every frame due to a bug in RPG Maker VX Ace's default scripts.

Here's some of the topic where the problem is explained and a solution is provided:

How to corroborate the problem?

 

The easier way is to make a Parallel Process event report the game's frame count. To do that, simply create a Parallel Process event and add a Call Script command on it with the following:

Code:
p Graphics.frame_count
What causes the bug?

 

Event "update" method setups the interpreter only if it is not "running":

 

Code:
 def update   super   check_event_trigger_auto   return unless @interpreter   @interpreter.setup(@list, @event.id) unless @interpreter.running?   @interpreter.update end
 

"running?" is defined as the following in Game_Interpreter:

 

Code:
 def running?   @fiber != nil end
 

and the "run" method for the interpreter is the following:

 

Code:
 def run   wait_for_message   while @list[@index] do     execute_command     @index += 1   end   Fiber.yield   @fiber = nil end
 

The problem is that the control is passed back to the caller before the "@fiber = nil" line is executed, so by the time of the next Event update cycle, the Interpreter is still "running" and won't setup again, making it skip one update cycle because when the Fiber gains back control, it will execute the pending "@fiber = nil" line, and the condition for the Interpreter update won't be met:

 

Code:
 def update   @fiber.resume if @fiber end
How to fix the problem?
 

The solution is simple:

 

Code:
# Parallel Process Events Execution Bug Fix.# Version 1.0.0# 09/02/15 - DD/MM/YY# www.rpgmakersource.com# forums.rpgmakersource.comclass Game_Interpreter  # Overwrites default method with the fixed version.  def run    wait_for_message    while @list[@index] do      execute_command      @index += 1    end    @fiber = nil    Fiber.yield  endend
Pasting the above code right below the default scripts, or anywhere below Game_Interpreter and above any custom script, will fix the problem.
 

Kazuki

Veteran
Veteran
Joined
May 22, 2013
Messages
109
Reaction score
7
First Language
English
Primarily Uses
No. Parallel Process events are not processed every frame due to a bug in RPG Maker VX Ace's default scripts.

Here's some of the topic where the problem is explained and a solution is provided:

How to corroborate the problem?

 

The easier way is to make a Parallel Process event report the game's frame count. To do that, simply create a Parallel Process event and add a Call Script command on it with the following:

p Graphics.frame_count
What causes the bug?
 

Event "update" method setups the interpreter only if it is not "running":

 

Code:
 def update   super   check_event_trigger_auto   return unless @interpreter   @interpreter.setup(@list, @event.id) unless @interpreter.running?   @interpreter.update end
 

"running?" is defined as the following in Game_Interpreter:

 

Code:
 def running?   @fiber != nil end
 

and the "run" method for the interpreter is the following:

 

Code:
 def run   wait_for_message   while @list[@index] do     execute_command     @index += 1   end   Fiber.yield   @fiber = nil end
 

The problem is that the control is passed back to the caller before the "@fiber = nil" line is executed, so by the time of the next Event update cycle, the Interpreter is still "running" and won't setup again, making it skip one update cycle because when the Fiber gains back control, it will execute the pending "@fiber = nil" line, and the condition for the Interpreter update won't be met:

 

Code:
 def update   @fiber.resume if @fiber end
How to fix the problem?
 

The solution is simple:

 

Code:
# Parallel Process Events Execution Bug Fix.# Version 1.0.0# 09/02/15 - DD/MM/YY# www.rpgmakersource.com# forums.rpgmakersource.comclass Game_Interpreter  # Overwrites default method with the fixed version.  def run    wait_for_message    while @list[@index] do      execute_command      @index += 1    end    @fiber = nil    Fiber.yield  endend
Pasting the above code right below the default scripts, or anywhere below Game_Interpreter and above any custom script, will fix the problem.
Thanks you code snippet worked like a charm thanks a lot. I will close this topic now.
 

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
Thanks you code snippet worked like a charm thanks a lot. I will close this topic now.
Great! You're welcome :3 (You might want to post in the topic I linked so it comes up again and more people see it, since it seems it is an unkown/ignored problem.)
 

Sharm

Pixel Tile Artist
Veteran
Joined
Nov 15, 2012
Messages
12,760
Reaction score
10,884
First Language
English
Primarily Uses
N/A
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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,848
Messages
1,016,974
Members
137,562
Latest member
visploo100
Top