...is being held down.
kb$ = INKEY$
IF kb$ = CHR$(32) THEN PRINT "-----------------" ELSE PRINT kb$; "..."
Run it and you will see even though the key is held down, INKEY$ will register null for a few loops.
To get it to act with the space bar held or released would take an INP(96) routine or something like the following. Note that the delays will fail at midnight for a brief second, but the proper midnight delay could be used to prevent that. Also, I'm not 100% sure it is timed for all systems; it just works flawlessly as coded on my XP.
z1 = TIMER
kb$ = INKEY$
IF kb$ = CHR$(27) THEN SYSTEM
IF kb$ = CHR$(32) THEN
z1 = TIMER: DO: IF ABS(z1 - TIMER) > .2 THEN EXIT DO
IF ABS(z1 - TIMER) > .1 OR kb$ = CHR$(32) THEN EXIT DO
DEF SEG = 0: POKE 1052, PEEK(1050): DEF SEG
IF kb$ = CHR$(32) THEN PRINT "Space Bar is being held down" ELSE PRINT kb$; "..."
Return to Index
|Response Title||Author and Date|
|Re: That won't work, because INKEY$ does not returning CHR$(32) even though the space bar...||Anonymous on Mar 6|
|" "||Lisztfr on Mar 6|
|Ok||Lisztfr on Mar 6|
|Using INKEY$ and CVI||MarineDon on Mar 6|
|* Pete and I never indent.||Sally Ninny on Mar 6|
|Why not?||Ben on Mar 6|
|It is faster to code without indenting and lucky for me, I don't get confused.||Pete on Mar 6|