Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.