I would think that the best way to handle this would be to use the GETKEY() function along with a variable to hold the number of times a key has been pressed along with some sort of timer. Here's a quickie
ref_count = 0
timer = 0
terminate = 0
While Not terminate
Cls
If GetKey() <> 0
If timer > 0 Then ref_count = ref_count + 1
If timer < 1
timer = 200
ref_count = ref_count + 1
EndIf
EndIf
If timer > 0 Then timer = timer - 1
If timer = 0 Then ref_count = 0
If ref_count > 2 Then terminate = True
Text 0,0,"timer " + timer
Text 0,20,"ref counter " + ref_count
Flip
Wend You could possibly use the MilliSecs() function to do the timer. Edit: You don't have to use a timer if your not bothered about having to hit the keys in quick succession. You could just do this
terminate = 0
ref_count = 0
While Not terminate
If GetKey() <> 0 Then ref_count = ref_count + 1
If ref_count > 2 Then terminate = True
Wend
|