Thread: Key down
View Single Post
  #1  
Old 03-23-2009, 06:05 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
Key down

keydown2 stops working after a period of use, and you have to quit Graal and restart it. keydown is limited to a few keys.

This is a simple script that replicates keydown2, without the glitches.

PHP Code:
/*
    Replicates keydown2 without the glitches
*/
//#CLIENTSIDE
function onKeyPressed(codekey) {
  
this.keyPressed.(@ code) = true;
  
this.trigger("keyDown"codekey);
}
function 
GraalControl.onKeyUp(codekey) {
  
this.keyPressed.(@ code) = false;
  
this.trigger("keyUp"codekey);
}
function 
isCodeDown(keycode) {
  return 
this.keyPressed.(@ keycode);
}
function 
isKeyDown(letter) {
  return 
this.keyPressed.(@ getkeycode(letter));

I recommend putting it in a class, but you can also put the functions directly into the weapon.
__________________
Reply With Quote