The key state should return True if the key identified by the specified scan code is currently held down. It will continue to return True until that key is released. It will check the state of ANY key, including Ctrl, Shift, etc.
NOTE: It can also detect many keys held down at the same time.
NOTE: Some keys may produce more than one key state.
Note the related bug #113 (Scancode is returning the wrong scan codes.), so this will also adversely affect the results until that is fixed.
Here's an example:
Do
For SC=0 To 127
If Key State(SC)=True Then Print SC
Next SC
Loop
Some sample results should be:
ESC, HELP
should return: 69, 95
LEFT SHIFT, RIGHT SHIFT
should return 96, 97
RETURN, KEYPAD RETURN
should return 69, 67
Left Windows (Left Amiga)
should return 102
F1 F2 F3 F4 F5 F6 F7 F8 F9 F10
should return 80 81 82 83 84 85 86 87 88 89 (some PCs will take control of these)
1 2 3 4 5 6 7 8 9 0 - = (top row of keys [partial])
should return 1 2 3 4 5 6 7 8 9 10 11 12.
q w e r t y u i o p [ ] (next row of keys [partial])
should return 16 17 18 19 20 21 22 23 24 25 26 27
a s d f g h j k l ; - (third row [partial])
should return 32 33 34 35 36 37 38 39 40 41
Note: Changed affected version from 0.9.4 to 0.9.5, since it's still broken.