Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Help! How can I use the Function keys within my prog?

Author
Message
Sam Cruise
22
Years of Service
User Offline
Joined: 11th Oct 2002
Location:
Posted: 10th Mar 2003 19:07
Anyone know if/how I can do this - ie respond to the user pressing the keys?
cusoi
22
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 10th Mar 2003 19:11
It are the scancodes. If I remember it correct it is like this

59=f1
60=f2
61=f3
62=f4....
So you do it like this...
if scancode(59) then blablabla

But it could be 159, 160,161... But I think it was this.

Current project: Earth Chaos, a FPRTS
Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 10th Mar 2003 19:22


increment the number 59 for other F keys.

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
EddieRay
22
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 10th Mar 2003 21:07
Is there a list of scancodes somewhere in the DB help or some included file? Are the scancodes consistent across different computers with different keyboards (for the common IBM standard AT keys at least)?

Thanks,

Ed

EddieRay
22
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 10th Mar 2003 21:08
That reminds me of a question I had as well...

If is call INKEY$() and there are two or more keys (like "a" and "z" pressed at the same time, what happens? Does it return "a" on the first call and "z" on the next call, or does it just return the key that was most recently pressed until it is released?

Thanks,

Ed

Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 10th Mar 2003 22:08
That's why you should use keystate() rather than inkey$() as keystate() will return multiple key presses.

To get the scancode for any given key just temporarily put text 20,20,str$(scancode()) just before your sync, then when you press a key the scancode is displayed and you can use it as in the snippet above... ie: if keystate(13) then

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 10th Mar 2003 22:10
Oh yeah I missed a question: Scancode is the same across AT keyboards.

I wouldn't know about ATX keyboards - kinda a problem getting IBM XT's to run DB I can tell you that it varies between platforms though as I keep trying to give DB scancodes from the Amiga, grrrrrr!

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
EddieRay
22
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 10th Mar 2003 22:44
Hahaha...well I still use the real-deal IBM AT keyboards on my computers at home. Those things are rock-solid and last forever...

Okay, I'll make myself a cheat-sheet... thanks!
Thanks,

Ed

Sam Cruise
22
Years of Service
User Offline
Joined: 11th Oct 2002
Location:
Posted: 11th Mar 2003 03:14
Thanks everyone!

Glennyboy
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United Kingdom
Posted: 12th Mar 2003 12:44
A list of scancodes is available on this site:

http://hometown.aol.com/alp29b/default.htm

It's been a great help to me.

*Hold breath and hopes link works okay*
*Clicks "Post Reply"*

Login to post a reply

Server time is: 2025-05-15 23:34:18
Your offset time is: 2025-05-15 23:34:18