this seems to always work
the delays are to show that even if other parts of the program are taking a long time, one keydown/keyup will always be caught each loop.
the delays are to show that even if other parts of the program are taking a long time, one keydown/keyup will always be caught each loop.
Dim hit(256),olddown(256),down(256),up(256) Print "begin" Repeat updatekeys() Delay 300 If hit(57) Then Print "hit" If up(57) Then Print "let go" If KeyHit(1) Then End Delay 300 Forever Function updatekeys() Local i For i=1 To 256 hit(i)=KeyHit(i)>0 down(i)=KeyDown(i) If hit(i) And olddown(i) Then up(i)=1 Else If hit(i) Then olddown(i)=1 up(i)=(olddown(i)=1 And down(i)=0) If up(i) Then olddown(i)=0 EndIf Next End Function