Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-23-2011, 07:38 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
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"},
Reply With Quote
  #2  
Old 07-23-2011, 07:44 AM
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
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.
Reply With Quote
  #3  
Old 07-23-2011, 08:07 AM
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
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.";
  }

__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
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 07:08 PM.


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