Quote:
Originally posted by adam
keydown2...
it's all in the newfeatures text file.
|
or if ur lazy this should help
NPC Code:
if (keypressed) {
this.on=1-this.on;
if (this.on==1&&strequals(#p(1),o)) {message on;}
else { message off};
}
Quote:
- functions:
keycode(character) - gets the key code for the character
(identical to the windows virtual key code)
keydown2(keycode,ignorecase) - checks if a key has been pressed,
ignorecase must be true if you want to turn off the check
for shift/alt/control key, so keydown2(keycode(A),true) will be
true whenever you press A or Shift+A or Alt+A
- a script to display 'on' when pressing '1' and displaying
'off' when pressing '2':
if (keypressed) {
code = strtofloat(#p(0));
if (code==keycode(1,false)) message on;
else if (code==keycode(2,false)) message off;
}
The same without converting it to the key code:
if (keypressed) {
if (strequals(#p(1),1)) message on;
else if (strequals(#p(1),2)) message off;
}
|