How to ckeck for a sequence of key presses ?

Blitz3D Forums/Blitz3D Programming/How to ckeck for a sequence of key presses ?

heres some code
; 'Combo' example
Graphics 800, 600, 32, 1

; Keys (ASCII CODES)
Const ML = 31 ; move left
Const MR = 30 ; move right
Const JU = 28 ; jump
Const DU = 29 ; duck
Const K = 97 ; kick
Const P = 115 ; punch
Const D = 100 ; block
Const Q = 113 ; high kick
Const W = 119 ; high punch
Const E = 101 ; high block
Const Z = 122 ; low kick
Const X = 120 ; low punch
Const C = 99 ; low block

; PUT ALL YOU MOVES HERE
Dim move$(3) ; A list for all the moves
; '>' Right '<' Left ':' Up '?' Down 'P' Punch 'K' Kick
move(0)=">>PPKK<<"
move(1)=">:?<P"
move(2)=">:PK"
move(3)=">Q>K>Z"

; FONTS
Global bigfont =LoadFont("Arial", 64, 1)
Global smallfont =LoadFont("Arial", 12, 1)

; BACKGROUND IMAGE
Global bk=CreateImage(32,32)
SetBuffer(ImageBuffer(bk))
	Color 0,55,0
	Rect 0,0,32,32
	Color 0,0,55
	Oval 0,0,32,32
SetBuffer BackBuffer()

While Not KeyHit(1)
	
	TileImage bk,MilliSecs()*100,MilliSecs()*10
	
	; Processing
	If ctimer# > 0 Then 
		ctimer# = ctimer# - 1
	Else
		cstring$ = ""
	EndIf
	
	keycode=GetKey()
	If keycode > 0 Then
		ctimer# = 20
		; get the right key for the string
		Select(keycode)
			Case ML: ; left
				cstring$ = cstring$ + "<"
				
			Case MR: ; Right
				cstring$ = cstring$ + ">"
				
			Case JU: ; Up
				cstring$ = cstring$ + ":"
				
			Case DU: ; Down
				cstring$ = cstring$ + "?"
				
			Case K:
				cstring$ = cstring$ + "K"
				
			Case P:
				cstring$ = cstring$ + "P"
				
			Case D:
				cstring$ = cstring$ + "D"
				
			Case Q:
				cstring$ = cstring$ + "Q"
				
			Case W:
				cstring$ = cstring$ + "W"
				
			Case E:
				cstring$ = cstring$ + "E"
				
			Case Z:
				cstring$ = cstring$ + "Z"
				
			Case X:
				cstring$ = cstring$ + "X"
				
			Case C:
				cstring$ = cstring$ + "C"
				
		End Select
		
		; check if a combo has been done
		For i = 0 To 3
			If cstring$ = move(i) Then
				movedone$ = i
				ctimer# = 0
			EndIf
		Next
	EndIf
	
	; Rendering
	Color 255, 255, 255
	SetFont smallfont
	Text 400, 20, "Combo demo - Test", 1, 1
	
	Color 255, 55, 55
	Text 10, 500-22, "Combo timer"
	Rect 10, 500, ctimer#*40, 32
	
	Color 255, 255, 255
	SetFont bigfont
	Text 400, 300, cstring$, 1, 1
	Text 400, 300+64, movedone$, 1, 1
	
	Flip: Cls
Wend: End