Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 03-23-2009, 11:47 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by cbk1994 View Post
keydown2 stops working after a period of use, and you have to quit Graal and restart it.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 03-23-2009, 05:10 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by xXziroXx View Post
apparently it's true
Reply With Quote
  #4  
Old 03-23-2009, 06:10 PM
fragman85 fragman85 is offline
Banned
Join Date: Mar 2009
Location: Switzerland
Posts: 261
fragman85 is on a distinguished road
o_O
Reply With Quote
  #5  
Old 03-23-2009, 06:12 PM
The_Blue_Cracka The_Blue_Cracka is offline
Blonk
The_Blue_Cracka's Avatar
Join Date: Nov 2004
Location: Pennsylvania
Posts: 147
The_Blue_Cracka is on a distinguished road
Send a message via AIM to The_Blue_Cracka
It is true, and in some cases it completely doesn't work for some people.

Example: My electro cap on Era.
__________________
2 kewl 4 an sigantrur!1
Reply With Quote
  #6  
Old 03-23-2009, 07:10 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
I have honestly not encountered this a single time, or even heard of it, during all my years on Graal. Do note that the "keycode" differs on some keyboards and computers, so you should always use "keychar" whenever you can.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #7  
Old 03-23-2009, 07:19 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by xXziroXx View Post
I have honestly not encountered this a single time, or even heard of it, during all my years on Graal.
Me either.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #8  
Old 03-23-2009, 09:42 PM
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
Quote:
Originally Posted by xXziroXx View Post
I have honestly not encountered this a single time, or even heard of it, during all my years on Graal. Do note that the "keycode" differs on some keyboards and computers, so you should always use "keychar" whenever you can.
I have, many, many times, on a variety of servers.
__________________
Reply With Quote
  #9  
Old 03-23-2009, 10:48 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Tigairius View Post
Me either.
Same.
Reply With Quote
  #10  
Old 03-23-2009, 10:57 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
I haven't heard of it either.. nor noticed any of it.
__________________
Reply With Quote
  #11  
Old 03-24-2009, 04:08 AM
The_Blue_Cracka The_Blue_Cracka is offline
Blonk
The_Blue_Cracka's Avatar
Join Date: Nov 2004
Location: Pennsylvania
Posts: 147
The_Blue_Cracka is on a distinguished road
Send a message via AIM to The_Blue_Cracka
Chris, we don't need these chumps.
__________________
2 kewl 4 an sigantrur!1
Reply With Quote
  #12  
Old 03-24-2009, 04:14 AM
Cloven Cloven is offline
Delteria
Cloven's Avatar
Join Date: Dec 2006
Location: Florida, United States
Posts: 542
Cloven has a spectacular aura about
Send a message via AIM to Cloven
I can't say I've noticed a problem before, though I can't think of too many instances where I use keydown2 anymore either. *shrugs*
Reply With Quote
  #13  
Old 03-24-2009, 10:26 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by cbk1994 View Post
I have, many, many times, on a variety of servers.
Quote:
Originally Posted by The_Blue_Cracka View Post
Chris, we don't need these chumps.
This might sound like I'm calling you bad scripters, which is not my intention, but please post some examples of scripts where keydown2 has stopped working after a period of time. It really can't be anything but scripting errors...
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #14  
Old 03-24-2009, 01:23 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by xXziroXx View Post
This might sound like I'm calling you bad scripters, which is not my intention, but please post some examples of scripts where keydown2 has stopped working after a period of time. It really can't be anything but scripting errors...
Well, it might be OS related, but I somehow highly doubt that..
Reply With Quote
  #15  
Old 03-24-2009, 01:55 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Crow View Post
Well, it might be OS related, but I somehow highly doubt that..
I haven't encountered it in Windows nor Linux, so if anything, it's Mac.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
Reply


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 09:49 AM.


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