Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
inkey$ Enter code
#1
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
Reply
#2
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.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#3
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.
Reply
#4
damn abreviations.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#5
ps.

while keybd$ = "": keybd$ = inkey$: loop
print keybd$, asc(keybd$)
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)