Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   KeysRealeased (https://forums.graalonline.com/forums/showthread.php?t=134267454)

greggiles 11-25-2012 03:23 PM

KeysRealeased
 
There is a function keyPressed(), but is there some sort of functinon of keyRealeased() ?

Or what is the closest function I can use?

Sorry, I know it seems like a dumb question. I'm just trying to learn.

Crow 11-25-2012 05:33 PM

There's no global event for when keys are being released. However, all GUI controls (including GraalControl) have an onKeyDown and an onKeyUp event, to be used like this:
PHP Code:

function GraalControl.onKeyDown(keycode,keystring,scancode) {
  
// stuff
}

function 
GraalControl.onKeyUp(keycode,keystring,scancode) {
  
// stuff



greggiles 11-25-2012 05:41 PM

Quote:

There's no global event for when keys are being released. However, all GUI controls (including GraalControl) have an onKeyDown and an onKeyUp event, to be used like this:
Can you further explain the keycode, keystring, and scancode? perhaps an example?

Crow 11-25-2012 06:13 PM

Just give this a shot:
PHP Code:

//#CLIENTSIDE
function GraalControl.onKeyDown(keycodekeystringscancode) { 
  
player.chat keycode SPC keystring SPC scancode


Then hit a couple keys. You should be using keycode for compatibility reasons if possible, since that's what seems to be uniform across the different platforms.

cbk1994 11-26-2012 01:32 AM

Quote:

Originally Posted by Crow (Post 1708163)
You should be using keycode for compatibility reasons if possible, since that's what seems to be uniform across the different platforms.

Also note that if you're trying to replicate one of the default actions (movement, firing weapons, etc.) you should use keydown(num) so that it will work even if a player changes the default action keys.

greggiles 11-26-2012 02:40 PM

UGH

I am having a lot of trouble here. I am trying to make a double dash sorta thing. So when you double tap keydown(3) or (1) it goes into a different event. (Where I would set a different Ani and the player.x value would be higher.)


All times are GMT +2. The time now is 12:18 AM.

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