View Single Post
  #8  
Old 02-26-2011, 07:36 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
PHP Code:
function GraalControl.onKeyDown(codekeyscan) {
  
// if you care about matching default controls, use if (keydown) here
  
if (key == "a" && ! this.keyA) {
    
player.chat "tap!";
    
this.keyA true;
  }
}

function 
GraalControl.onKeyUp(codekeyscan) {
  if (
key == "a") {
    
this.keyA false;
  }

It's certainly possible to do via timeout, as Dusty instructed, but there's no reason to do so when it can be done using events.
__________________
Reply With Quote