Thread: keydown()
View Single Post
  #11  
Old 11-22-2002, 06:18 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
.05 may have it repeat at times, but then again when you do a GUI or something, .1 may be not sensitive enough, people often just tap and release. I'd say set a variable.
NPC Code:

if (created)
{ this.tap=0; timeout=.05;}
if (timeout)
{ if (keydown(0) && this.tap==0)
{ action(); this.tap=1;}
if (!keydown(0) && this.tap==1)
{ this.tap=0;}
timeout=.05;
}


That may be the best way.
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote