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 / Easy Question!!!

Author
Message
RossageSausage
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Apr 2003 10:02 Edited at: 14th Apr 2003 10:04
Here an easy question for all you vets of db. I am trying to assign the "wasd" keys for my camera movement and I type the whole "if inkey$....yada yada" but when I when I execute the program I can only push one key at a time (can go forward but not turn at the same time like I can with the arrow keys). I have been at it for a good while now any help would rock!

RossageSausage



RossageSausage
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Apr 2003 10:03 Edited at: 14th Apr 2003 10:08
ps. I believe it has to do with the "=1" <---just dont know how to implement the "=1" when not using the arrow keys

example: if upkey()=1 then move camera 5.0
VS.
if inkey$()"w" then move camera 5.0

If you need a better description of the problem feel free to ask what ever you want

THANX AHEAD OF TIME!

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 14th Apr 2003 10:34
this mini program will find the scancodes which is specific to each key on your keyboard and realted to each different language.

do
cls
print scancode()
sync
loop


once u have found your scancodes for the required keys.

u can use a snippet similar to this


if scancode(yourasciinum) = 1
perform action
endif

you can expand on this also


if scancode(yourasciinum) = 1 and scancode(yourotherasciinum) = 1
perform action
endif


Sometimes tho keys will not respond like the arrow keys used in combos and this is a direct result of the way windows handles the keyboard so its out of reach to fix but combos of standard keys are fine if u use this method.

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 14th Apr 2003 10:36
if u need to add a control key or a shift key then u have to take into account both keys

each one will have its own ascii number

to use a combo in this regard u can do this


if scancode(Leftcntrlascii) = 1 or scancode(Rightcntrlascii) = 1 and scancode(yourkeyascii) = 1
perform action
endif


this will allow u to use either control key and your desired key to perform an action.

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 14th Apr 2003 10:42
i better add also

anywhere i add a word like this

Rightcntrlascii is where u replace the text with the correct number of the ascii equivalent.

RossageSausage
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Apr 2003 11:34
Thanx indi......I didnt even think to check the scancode.....lol I saw it in the tutorials but the command name sounds like it is for something totally different thx again for your time

RossageSausage

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 14th Apr 2003 11:36
cheers mate and have fun exploring new things.

RossageSausage
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Apr 2003 11:38
and also thanx for the extra info.....definately note worthy *jotting down on paper* THANX!

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 14th Apr 2003 11:48
RossageSausage
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Apr 2003 12:06 Edited at: 14th Apr 2003 12:06
hahahahahah hey indi the command is...

if keystate(scancode#)=1
move camera 5.0
endif

lol bro...whether you got it wrong or were just trying to get me to think *which is what you were hoping for right* I THANK YOU.....COMPLETELY SOLVED MY PROBLEM AND FELT SMART DOING SO!!!!

RossageSausage

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 14th Apr 2003 15:04
haha no that was a total mess up on my behalf hehe but it came out ok lol

haha woops!

Login to post a reply

Server time is: 2026-06-11 21:22:29
Your offset time is: 2026-06-11 21:22:29