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 / Keyboard letters.

Author
Message
Bloder
19
Years of Service
User Offline
Joined: 24th Feb 2007
Location: Cyberspace
Posted: 3rd Oct 2008 22:00
In DarkBASIC the spacebar = spacekey, right?
So does anybody have a link to a site that has the DarkBASIC words for standard letters like H and D?

If I were you, I'd make a game...
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 3rd Oct 2008 22:51 Edited at: 5th Oct 2008 20:04
You can use Keystate(Number) = 1, or Scancode() = Number for the keys.
Irojo
18
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 3rd Oct 2008 23:11 Edited at: 3rd Oct 2008 23:12
if inkey$()="a" then do something
if inkey$()="b" then do something
etc.

[edit]

I think I am mistaken as to your question...


I download memory.
Turoid
22
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 3rd Oct 2008 23:25 Edited at: 3rd Oct 2008 23:28
Keystate would do the trick

Simple example:



I am awesome and always right.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 4th Oct 2008 09:34
scancode is better, it will work for all keys and return the value of the key pressed. Inkey$ doesn't work with keys like f1 and f2. Keystate requires specific numbers in the call, meaning many checks must be done for multiple keys.

With scancode, you use it once with a select statement and you can do it.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 4th Oct 2008 09:39
Yeah thinking bout that it does make alot of sense, good point.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 4th Oct 2008 19:07
True, I hadn't thought of that.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Oct 2008 13:06 Edited at: 5th Oct 2008 13:11
@Ashingda 27
The scancode map you displayed doesn't match the scancodes of my keyboard. For example, my function keys range from 59 to 70.

Quote: "So does anybody have a link to a site that has the DarkBASIC words for standard letters like H and D?"


There are only certain keys that actually have DBC commands specifically for them like Spacekey() or Righkey(). These are all included in the documentation under Input Command Set. They are:



As for the rest of the keyboard, you can find them like the others have been saying, by using SCANCODE() to return the code value of a particular key. Once you know the numeric value of a key, you use KEYSTATE() with that value to determine if the key is pressed or not.

If you have QBasic on your machine (go to command prompt and type qbasic) you can get a list of the keyboard scancodes from the survival guide.

Enjoy your day.
Ashingda 27
18
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 5th Oct 2008 20:04
That's good, I'll take mines down as not to confuse onlookers.

Login to post a reply

Server time is: 2026-07-05 01:46:51
Your offset time is: 2026-07-05 01:46:51