Recognizing a keypress

I’m very new to AppleScript. How would I execute a script looking for user input in the form of a keypress (e.g. a return key hit, tab hit, function key, etc)? For OS 9 and OS X.

Thanks.

“keys pressed”, from Jon’s Commands. http://www.seanet.com/~jonpugh/