I am finshing up a game for school and I cannot find the inkey$ code for the Enter button. I checked the QBasic help file and everything but I still can't find it. Please help me
Code:
DO
press$=INKEY$
IF press$=CHR$(13) THEN EXIT DO
LOOP
END
Exits program when user presses [ENTER].
So, CHR$(13) is enter key code.
There is a list of CHR$ codes under "ascii character codes" in the help section. Enter is listed as "cr" which, of course, stands for carriage return.
Code:
WHILE INKEY$ <> CHR$(13): WEND
You could also add:
Code:
WHILE INKEY$ <> CHR$(13) OR CHR$(27): WEND
27 is escape. You could add all sorts of character codes into there.
ps.
while keybd$ = "": keybd$ = inkey$: loop
print keybd$, asc(keybd$)