I have added a GetKey() function to the ScriptBasic SDL extension module. The GetKey function returns both keydown (+) and keyup (-) events. The capslock and numlock keys act as toggles. (+ = On, - = Off) Here is a list of the returned key names beyond the single character keys you would expect.
left alt
left ctrl
left shift
left super
tab
escape
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
f12
up
down
left
right
insert
delete
end
page down
page up
home
scroll lock
pause
right ctrl
right alt
right shift
return
backspace
space
numlock
[/]
[*]
[-]
[7]
[8]
[9]
[4]
[5]
[6]
[1]
[2]
[3]
[0]
[.]
[+]
enter
Example
DECLARE SUB Window ALIAS "SB_Window" LIB "sdl"
DECLARE SUB GetKey ALIAS "SB_GetKey" LIB "sdl"
Window 100,75
NextKey:
k = GetKey()
PRINT k,"\n"
GOTO NextKey
jrs@laptop:~/sb/sb22/sdl$ scriba getkey.sb
+a
-a
+left shift
+a
-a
-left shift
jrs@laptop:~/sb/sb22/sdl$
In the above example the a key is pressed and released. The next time the left shift key is pressed and held down while the a key is pressed. The a key is then release as is the left shift key.