The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => Topic started by: Razma on January 30, 2013, 01:20:39 PM

Title: [XP] Keys, repeating keys, FRUSTRATION
Post by: Razma on January 30, 2013, 01:20:39 PM
So I'm doing a CBS that requires heavy custom key use.  8)

I want to be able to register the input of a key one time, and not register it again until released and then pushed again. As of now, I have to use the wait command, but that just generates lag, and doesn't stop the repeating.

If you want a specific example, here it is:

I use the key A to bring up the menu,
I use the key A to select a command: Move,
then I use the key A to choose a destination.

As of right now, the button will bring up the menu and immediately jump to the first command on the list, because it repeats. Using wait x amount of frames only creates lag and doesn't prevent the repeat.  :mad:

Believe me, I did a search for this, and did not find what I was looking for...with some exception. Do I need to go out and get a custom keys script? Or is there a simpler way I'm not catching? I've experimented a little, but it just hasn't clicked yet.

This is essential to improving gameplay experience, if you help me, I will appreciate it very much, and you'll end up in the credits in my game  :blizj: (for whatever that's worth haha.)

Thanks. :D
Title: Re: Keys, repeating keys, FRUSTRATION
Post by: D&P3 on January 30, 2013, 01:25:35 PM
A screenshot of your code/event would help.

Code: [Select]
Input.trigger?(:A) # Only registers once
Title: Re: Keys, repeating keys, FRUSTRATION
Post by: Razma on January 30, 2013, 01:29:00 PM
Ok, but it's gonna be ugly...Its a tactical battle system. I can give a more primitive example that would equal essentially the same thing. BRB

In an ideal world, pic1 would not flicker when a is held. But rather, I would have to release and then push again to change anything.

This is an oversimplification, but a sufficient example.

Btw, can I really copy and paste that code.? Will it work?

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi1118.photobucket.com%2Falbums%2Fk609%2Fgdane1989%2Fkeysfrustration_zpsfa34dad3.png&hash=25e25ea9c4af935d6f5a511b429f4e1676abe818)
Title: Re: Keys, repeating keys, FRUSTRATION
Post by: Razma on January 30, 2013, 01:48:49 PM
So I pasted that code in the event, and the only thing that happened was that a did not seem to register at all :p
Title: Re: Keys, repeating keys, FRUSTRATION
Post by: LoganF on January 30, 2013, 02:07:41 PM
You'll have to use:

Code: [Select]
Input.trigger?(Input::A)

with RMXP.

Put it as a script entry in a conditional branch. So instead of having 'Conditional Branch: Key A Pushed' it will say 'Conditional Branch: Script: Input.trigger?(Input::A)'

I tried this with a parallel processed event that showed a picture for 60 frames then erased it only if the 'A' key was pressed (which is 'Z' or 'Shift' by default). The picture only showed for that ~1 second then disappeared once no matter how long I held the A key for.
Title: Re: Keys, repeating keys, FRUSTRATION
Post by: Razma on January 30, 2013, 02:17:54 PM
Thanks Logan! You are always so damn helpful. It did the same exact thing for me just now! (I guess you did know the answer after all, haha.)

Thankyou also D&P3, I just realized I did not specify that I was using RMXP, I appreciate your help as well.