NPC Code:
if (keypressed && strequals(#p(1),k)) {
say2 OMG U PRESS K KEY.
}
That's the lazy way, and there are many better ways of putting it together, but I forget them right now.
(Some people are obsess with the keycode function, I just say screw it))