Toribash
Original Post
KeyCodes
I din't know there to get the keycode table, so I had to make my own one.
I wrote the simple script
local function keydown(key)
	echo(key)
end
add_hook("key_down", "keypressdown", keydown)
So here are the results of it's work, maybe someone else need it too
BACKSPACE  8
TAB        9
ENTER      13
PAUSE      19
ESC        27
SPACE      32
'          39
,          44
-          45
.          46
/          47
0..9       48..57
;          59
=          61
[          91
\          92
]          93
~          96
a..z       97..122
DELETE     127
NUM(0..9)  256
NUM(.)     266
NUM(/)     267
NUM(*)     268
NUM(-)     268
NUM(+)     270
NUM(ENTER) 271
INSERT     277
HOME       278
END        279
PGUP       280
PGDOWN     281
F1..F12    282..293
NUMLOCK    300
SCRLOCK    302
R_SHIFT    303
L_SHIFT    304
R_CTRL     305
L_CTRL     306
R_ALT      307
L_ALT      308
L_WINKEY   311
R_WINKEY   312
PRTSCR     316
you can always use "string.byte(a)" or "a:byte" to change to bytes (keycodes in bytes) and "string.char(a)" or "a:char" to change from byte to char ("a", "b", "c" etc).
example:
keys = {goKey = string.byte("a"), backKey = string.byte("s")}
function keyDown(key)
  if(key == keys.goKey) then
     echo("moo")
  end
  if(key == keys.backKey) then
     echo("baah")
  end
end
add_hook("key_down","example",keyDown)
Last edited by Blam; Jan 13, 2009 at 04:39 PM.
:D
-severely ninja snipped-
Last edited by suomynona; Jan 21, 2009 at 02:02 AM.
Squad Squad Squad lead?
The standardization of Toribash Squad roles may have gone too far!
Originally Posted by suomynona View Post
function keyDown(key)
  echo(key)
end
add_hook("key_down","example",keyDown)
Simplistic.

Just PLEASE remove that from your scripts before you release them.

Lol, same as my script in first post, exept of local.
Read posts first, dude)