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 / I know this is a dumb question but Google couldn't answer it.

Author
Message
Jjsaro
9
Years of Service
User Offline
Joined: 21st May 2014
Location:
Posted: 21st May 2014 02:21
My teacher is basically just throwing us in this new curriculum that explains the logic of programming well but offers basically no examples of commands or how they are used. We are expected to make a small mod for a pre-existing db game. Anyways, how do I check for when the player is pushing certain keys. I need it to always be checking and it has to be able to change their variable from 0 to 1 depending on if there pushing it.
Danza
9
Years of Service
User Offline
Joined: 20th May 2014
Location:
Posted: 21st May 2014 23:00


number is the number of the key, just google Dark Basic Scancodes and there is a lovely post on the forums about it.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 8th Aug 2014 03:17 Edited at: 8th Aug 2014 03:18
Do you have the help files? Look at the input section.

For almost any practical use you would not use scancode(), because it only returns the value of one key being pressed, so if more than one key is pressed they wont both be counted. Keystate() works for each key independently.

There are also some stock commands for regularly used keys:

rightkey()
leftkey()
upkey()
downkey()
controlkey()
shiftkey()
returnkey()
spacekey()
escapekey()

I've attached an image mapping the scancodes of each key on a keyboard. (May be slightly different to your keyboard.)



Formerly OBese87.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-19 23:30:00
Your offset time is: 2024-04-19 23:30:00