ID:159511
 
I've am curious and I have seen this done how would you go about tracking the characters that user has inputed from thier keyboard? For example if you wanted to create a combo system in your game and you had A,S,D mapped as Punch,Kick,Block how would track so that if the user did A,A,S it would be recognized quick enough to know that it was a combo set? Any Ideas I am not even sure where to start on this one.


Thanks For Any Help!
Every time a character is pressed, add it to a list. Check the most recent button-presses to see if they are the appropriate sequence. If you make it an associative list, associating the characters with timestamps, you can also see how much time elapsed between the first button-press of the sequence and the last. If you use timestamps, get them from world.time instead of realtime, as world.time is accurate to the tick, where realtime is not.
In response to Loduwijk
Let me show my newbdome by not completely understanding list I really "SUCK" with list I know people hate this question but you could you possibly provide me with an example of what you are talking about.. Thanks for not blamming me!
In response to Smokymcpot
mob/var/tmp/list/Combo = list()
mob/var/tmp/Index = 1
mob/verb
One()
Combo += Index
Combo[Index] = "once"
src<<"One"
Index++
Two()
Combo += Index
Combo[Index] = "two"
src<<"Two"
Index++
Three()
Combo += Index
Combo[Index] = "three"
src<<"Three"
Index++
Finish()
if(!Combo.len) return
else if(Combo.len)
if(Combo[1] == "two" && Combo[2] == "three") src<<"Yay!"
else src<<"Boo!"
Combo = list()
Index = 1


Probably not the best way to do it, but it gets the job done. I hope that's what you were talking about.