Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inkey$ working too slow, Why?
#1
Hello everyone!

I would like to know why when when I assing a letter on the keyboard to do simple function calls I have to type the letter two times. Here is the sample code:

Code:
cls:screen 13
n$ = inkey$
select case (n$)
case "a"
print "You press the a button."
end select
end
To know nothing, it is to know everything." - Julio A. Cruz
Reply
#2
this works better:
Code:
cls:screen 13
do:press$ = Inkey$:loop until press$ <> ""
select case (press$)
case "a"
print "You press the a button."
end select
end
quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Reply
#3
Or...

Code:
cls:screen 13
SLEEP press$ = Inkey$
select case (press$)
case "a"
print "You press the a button."
end select
end

But I take he wants the code to loop until a key is pressed...

In anywhich case, INKEY$ is slow.. Other than that, you have INP(96) with returns the scancode of a pressed key:

Code:
DO
LOCATE 1, 1: PRINT INP(96); "   "
LOOP UNTIL INKEY$ = CHR$(27)

/\ Run that.... That's faster as you will see... ^_^
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#4
Thanks a lot for your help!
To know nothing, it is to know everything." - Julio A. Cruz
Reply
#5
inp(97)?
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#6
(yawn) I think they got it covered up there :wink:
There's this doctor, and this boy. They both go fishing. The Boy is the Doctor's son, however the doctor is not his father. Who is the Doctor?"
Reply
#7
Quote:inp(97)?

&H60 to be exact, 96. Standard keyboard port.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)