Main Menu
  • Welcome to The RPG Maker Resource Kit.

[XP] Keys, repeating keys, FRUSTRATION

Started by Razma, January 30, 2013, 01:20:39 PM

0 Members and 1 Guest are viewing this topic.

Razma

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

D&P3

A screenshot of your code/event would help.

Input.trigger?(:A) # Only registers once
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

Razma

#2
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?


Razma

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

LoganF

You'll have to use:


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.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

Razma

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.