Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   onKeyDown (https://forums.graalonline.com/forums/showthread.php?t=134263988)

Mark Sir Link 07-23-2011 07:38 AM

onKeyDown
 
can the params possibly be changed to an array in which all keys currently being pressed are passed?

I.E holding c + v would pass params {67, 86}, {"c", "v"},

WhiteDragon 07-23-2011 07:44 AM

I'm not sure this makes sense. onKeyDown is an event when you hit a single key, why should it be returning any more information than the new information?

If we were working with some "currentKeys"ish variable, then yes, this would make sense, but in this case I don't think it does.

Tigairius 07-23-2011 08:07 AM

You can make your own version of this like:
PHP Code:

function GraalControl.onKeyDown(keycodekeychar) {
  if (!((@{
keycodekeychar}) in keysPressed)) {
    
keysPressed.add({keycodekeychar});
  }
  
player.chat keysPressed;
}

function 
GraalControl.onKeyUp(keycodekeychar) {
  
keysPressed.remove(@{keycodekeychar});
  
player.chat keysPressed;


As long as you would have that somewhere attached to the player on the clientside, you could access keysPressed from anywhere.

Additionally, if you just want to check if C and V are being pressed you can do:
PHP Code:

function GraalControl.onKeyDown(keycodekeychar) {
  if (
keydown2(VK_Cfalse) && keydown2(VK_Vfalse)) {
    
player.chat "I'm pressing C and V.";
  }




All times are GMT +2. The time now is 09:44 AM.

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