PDA

View Full Version : keyname()


projectigi
09-25-2006, 11:52 PM
echo("keycode of a: " @ getkeycode("a"));
echo("keyname of a: " @ keyname(getkeycode("a")));


this says

keycode of a: 65
keyname of a:

shouldn it be

keycode of a: 65
keyname of a: a

?(clientside) =(

Yen
09-25-2006, 11:54 PM
I think there was some problem with keyname in the past.. It's only clientside, maybe?

Try #k(int)

projectigi
09-26-2006, 12:22 AM
ehr
that (clientside) at the end should express that im trying it clientside o.o
and i dont really use gs1 =/ it doesnt fit well with gs1

any other idea?

Yen
09-26-2006, 12:31 AM
It's a hack. I'm pretty sure I had to use #k() instead of keyname() for something.

projectigi
09-26-2006, 11:37 AM
echo("keycode of a: " @ getkeycode("a"));
echo("keyname of a: " @ #k(65));


same result:
keycode of a: 65
keyname of a:

ApothiX
09-26-2006, 05:21 PM
It's #K for the keyname, not #k.

projectigi
09-27-2006, 12:07 AM
ah that works, thanks
now why didnt keyname() work? Oo

Admins
09-28-2006, 08:08 PM
a Keycode cannot be directly converted to character. I guess what you were trying to was conversion to and from ascii:

number = getascii("a") or getascii('a')
character = char(asciicode)

Often the key code is the same as ascii though (for a-z).
Also note that getascii() was bugged on serverside until a few days ago, I am not sure if the new npcserver has been uploaded to all machines yet.
keyname(0..10) is for knowing the name of the default game keys and works on clientside only.