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 / Newb keyboard input question.

Author
Message
someone 299
17
Years of Service
User Offline
Joined: 3rd Jun 2008
Location:
Posted: 3rd Jun 2008 19:46
Hello all, I need some help.

I wanted to change the camera control keys from the arrowkeys(built into DB) to keys "W" "A" "S" "D".

The first problem I saw is that DB lacks a direct input value for these keys unlike the arrow keys which have UPKEY, DOWNKEY, etc.

So... I figured, okay I'll just make a variable for each key, put it in a loop, and use the variable name as the camera control keys. Make sense?

The problem is that none of the input commands are working for me and this is a lot harder than regular BASIC. So how do I assign a variable with 1 if the "W" key is pressed for example? If I can just figure out how to put a 1 in said variable I can figure the rest out, thanks!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 3rd Jun 2008 20:18
someone 299
17
Years of Service
User Offline
Joined: 3rd Jun 2008
Location:
Posted: 3rd Jun 2008 20:23
I have and I'm not really happy with the below half-assed explanation

SCANCODE()
This command will get the scancode of the key currently being pressed.

SYNTAX:
Return Value=SCANCODE()

That makes NO sense to me. There isnt even an example.

To me this means that scancode will present a valve or (keypressed)=scancode???

Could someone here bring it down to mentally challenged level please? Thanks!
someone 299
17
Years of Service
User Offline
Joined: 3rd Jun 2008
Location:
Posted: 3rd Jun 2008 20:30
I GOT IT!!! WoOt!!!

The manual did NOTHING for me! and the syntax in the manual should read more like:

IF SCANCODE()=17 THEN print "hello" <---as an example

WOOT!! SWEET!!!

Login to post a reply

Server time is: 2025-06-05 21:22:55
Your offset time is: 2025-06-05 21:22:55