This peace of code can be useful for finding when key press is pressent and it can easy be connected with the keystate which produces it.I`m not sure what is maximum scancode value so i just leave the array 255 positions long.
Very usefull for writing to avoid thissssssssssssssssssssssssssssss,
or just to be sure that something called with keystate command will
run once until next key press and not 1000 times instead.
sync on:sync rate 60
dim key_pressed(255) as boolean
do
cls
text 0,0,"keystate("+str$(scancode())+") "+"key_pressed : "+str$(key_pressed(scancode()))
if scancode() <> 0 then key_pressed(scancode()) = 1
if scancode() = 0 then key_pressed(scancode()) = 0
sync
loop
Where there is a will, there is a way.
I often edit my posts, that`s who i am
