Thread: Keydown?
View Single Post
  #4  
Old 07-30-2004, 08:15 AM
Silver Knight Silver Knight is offline
The Ice Cream Social
Silver Knight's Avatar
Join Date: Jun 2001
Location: SoCal
Posts: 541
Silver Knight is on a distinguished road
Send a message via AIM to Silver Knight
Yes, you'll want to use keypressed.
From commands.rtf:
keydown(key) "the specified key is pressed (0..10: up,left,down,right,S,A,D,M,tab,Q,P)"
So, yes, Q would be 9.

If you want to use other letters not specified in the above info, you would use keydown2.
The syntax for keydown2 is similar, keydown2(keycode,ignorecase);
So, with that, and using the keycode() thing, you can do things like:
NPC Code:

if (keypressed) {
if (keydown2(keycode(x),true)) {
triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,Stuff,;
}
}



In that code, it would check to see if a key was pressed (keypressed), then would check in the x button was pressed (keydown2(keycode(x),true)) and would ignore the case, so X would work as well.
If all that was true, it would do the triggeraction.
__________________
Reply With Quote