Thread: keydown!!
View Single Post
  #13  
Old 08-08-2002, 12:30 PM
RavenTelvecho RavenTelvecho is offline
Registered User
RavenTelvecho's Avatar
Join Date: Apr 2002
Location: Toronto, Ontario, Canada
Posts: 0
RavenTelvecho is on a distinguished road
Send a message via ICQ to RavenTelvecho Send a message via AIM to RavenTelvecho Send a message via Yahoo to RavenTelvecho
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;
}
__________________

^tuff newbie ;x
RavenTelvecho
!Booj
we are 'brothers'
Reply With Quote