Qbasicnews.com
February 23, 2020, 07:51:17 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 2 [3] 4
  Print  
Author Topic: Need help with some stuff  (Read 9692 times)
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #30 on: February 13, 2004, 08:09:40 AM »

*looks at your post... looks at your previous post.... bangs head on desk*

yet again.... a case of not reading things... heh
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #31 on: February 13, 2004, 08:39:16 AM »

Its not your fault =P. Its kinda hidden =).
Logged
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #32 on: February 13, 2004, 08:40:58 AM »

Heh thanks. I thought you were using INP(96)
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #33 on: February 13, 2004, 08:42:34 AM »

That just goes to show how you can use the commands correctly =).
Logged
Neo
Na_th_an
*****
Posts: 2150



« Reply #34 on: February 13, 2004, 09:21:47 AM »

Quote from: "dark_prevail"
Heh thanks. I thought you were using INP(96)

INP(&H60) can only record different keypresses, not even two the same keypresses sequentially. This is because INP(&H60) doesn't clear the keyboard buffer and thus will read the same value (>128) over and over again until an other key has been pressed.

You can easily correct this flaw:
Code:
'neoKeybInkeyScan function from NeoLib v1.6
FUNCTION neoKeybInkeyScan%
   'read key from keyboard buffer
   scancode% = INP(&H60)

   'check if it's incorrect data
   IF scancode% >= 128 THEN scancode% = scancode% - 128

   'return the value
   neoKeybInkeyScan% = scancode%
END FUNCTION


Of course, you can easily merge all this into one line:
Code:
FUNCTION neoKeybInkeyScan%
   neoKeybInkeyScan% = INP(&H60) AND 127
END FUNCTION


The only thing you now need to do is record what key is connected to which number, or look it up in QB's help.

Hope it helped Wink
Logged
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #35 on: February 13, 2004, 03:53:14 PM »

Well, if your meaning that you hope it helped me, I already know how to use KBHs. Actually, I use INP(96) for all my programs, and it works fine, but Ill give your tip a shot. Is there an easy way to record two different keypresses at once? I saw a program once that used some lib for it, but is there a pureQB way?

(But one thing I dont get. You said that INP(96) doesnt work properly just by itself, but it works fine for me? Whats that about?)
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #36 on: February 13, 2004, 04:38:03 PM »

dark, he is talking about the keyboard buffer. It makes the inputs through the keyboard a bit slow i.e. it keeps echoing the same key even after you've left it.
Logged
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #37 on: February 14, 2004, 10:27:06 AM »

huh?

I dont get that problem. When I use INP(96), it records the key im pressing, but when I let go of the key, it reverts to a different number.

Code:
DO
  PRINT INP(96)
LOOP


That brings up a stream of numbers when I hit a certain key, then reverts to another number when I take my finger off the key.
Logged
Z!re
*/-\*
*****
Posts: 4599


« Reply #38 on: February 14, 2004, 02:04:03 PM »

INP(60) returns the key asci (or is it scancode?) when pressed, when released it return the asci (or scancode, have to test witch) of the last key pressed+128, and that is quite usefull.

For making a multikey presser you can do a string of n lenght that saves n number of keypresses, as soon as the value hits anything < 128 then add the chr value to the string, and remove the first one (if there already is n values stored), then you can do:
IF multikeypressed$="1aF5" THEN
and it only reacts on that combination.
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #39 on: February 15, 2004, 05:15:45 AM »

Z!re INP(60) returns a 0  :-? . Are you sure its 60?
Logged
Z!re
*/-\*
*****
Posts: 4599


« Reply #40 on: February 15, 2004, 08:49:00 AM »

Might be 96 Tongue it was a long time since i used it :oops:
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #41 on: February 15, 2004, 10:54:22 AM »

Do you have an example for the multikey handler?
Logged
Neo
Na_th_an
*****
Posts: 2150



« Reply #42 on: February 15, 2004, 10:56:38 AM »

Quote from: "TheBigBasicQ"
Z!re INP(60) returns a 0  :-? . Are you sure its 60?

&H60 Wink

EDIT : And btw, I already said that INP(&H60) returns either the key itself, or the key + 128, just look at my proggie Wink
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #43 on: February 15, 2004, 12:15:39 PM »

Doh! Z!re confused me.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #44 on: February 15, 2004, 03:36:12 PM »

Quote from: "Neo"
Quote from: "TheBigBasicQ"
Z!re INP(60) returns a 0  :-? . Are you sure its 60?

&H60 Wink

EDIT : And btw, I already said that INP(&H60) returns either the key itself, or the key + 128, just look at my proggie Wink


I explained this some time ago. Bit 7 = 0 => Key pressed. Bit 7 = 1 => Key released Smiley
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Pages: 1 2 [3] 4
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!