Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: logging a series of key presses  (Read 1551 times)

0 Members and 1 Guest are viewing this topic.


  • Jr. Member
  • **
  • Posts: 56
    • View Profile
logging a series of key presses
« on: January 25, 2012, 05:37:39 pm »
Hay, I'm wondering what peoples thoughts are solving my problem.
 I want to develop a system that records a series of button presses.
These act like a "combo" on many platform games.
Say i press the keys L,O,P very quickly, that would preform a certain action.
 These 'combos' are going to be stored in an array like int[LKEYCODE, OKEYCODE, PKEYCODE].
However I want to these to only match if the time between each key press is < 0.5 seconds.

How would one go about creating something like this?


  • Newbie
  • *
  • Posts: 23
    • View Profile
logging a series of key presses
« Reply #1 on: January 25, 2012, 06:54:05 pm »
Sounds like you could just create a clock with the array, and reset the clock each time a keystroke is added to the array. If the clock is greater than 0.5s when the stroke is added, you flush the array before you add the keystroke.

If you know the length of all combos will be a certain length, you can use that to check to see whether a combo is being formed, or whether you just have junk values.