PDA

View Full Version : Keydown...


Thak2
03-14-2001, 10:35 PM
A Keydown command for most every key on the keyboard would be useful... I dont know how hard itd be to do though.

galen
03-15-2001, 01:13 AM
using the key's ASCII number will do it

032 = space
010/013 = carage return (LF/CR)
008 = BkSp
0;51 = F1
0;233 =
etc...

Thak2
03-15-2001, 06:17 AM
Thank you very much Galen!

ReBBisH
03-15-2001, 06:21 AM
El Very Useful *downloads* Why the code though?


http://www.hyperspacehq.com/rebsig.gif

Thak2
03-15-2001, 10:21 AM
What is the ASCII number used with? I have tried keydown and #K, but I dont know why they aren't working... can you jst do a quick little example of the command to recognize it? thanks.

freddyfox
03-15-2001, 10:23 AM
if(keydown(032)){
ooga booga;
}

grim_squeaker_x
03-15-2001, 07:06 PM
Originally posted by freddyfox

if (created||timeout) {
if(keydown(032)){
ooga booga;
}
timeout = 0.05;
}


Blah, just fixed up Vermain's script for him.

Thak2
03-15-2001, 10:53 PM
I have tried those, they do not work, I have tried the following ways:

if (playerenters || timeout) {
timeout = 0.05;
}
if (timeout && keydown(032)){
setplayerprop #c,test;
timeout = 0.05;
}
if (timeout && strequals(#K,032)){
setplayerprop #c,test;
timeout = 0.05;
}


Do these work for other people? I have tried other ASCII numbers for other keys, but for some reason it doesnt work at all...
I think somehow I have to use #K(key) with the brackets since message #K(050); works fine and siplays the number 2.

grim_squeaker_x
03-15-2001, 10:57 PM
Originally posted by Thak2

Do these work for other people? I have tried other ASCII numbers for other keys, but for some reason it doesnt work at all...
I think somehow I have to use #K(key) with the brackets since message #K(050); works fine and siplays the number 2.

Blah, try using this code:
if (created||timeout) {
if (keydown(#K(050))) {
message test!;
}
timeout = 0.05;
}

Thak2
03-15-2001, 11:02 PM
No, that doesnt work, I have tried numerous ways, the either end up with errors, or dont work at all.

grim_squeaker_x
03-15-2001, 11:04 PM
I'll try some things myself now until I find one which works.

grim_squeaker_x
03-15-2001, 11:08 PM
it probably doesn't work because it takes away the 0 in the actual script in the level itself (I checked that with the debugger), I'll try finidng a way around it. Hmm nope that can't be it either... Graal sees 050 and 50 as the same... Blah, I can't think of anything, except that you could use it to make a password hard to read like:

if (strequals(#c,#K(050)#K(132)) etc.