Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Keychar for the spacebar? (https://forums.graalonline.com/forums/showthread.php?t=134258988)

Jiroxys7 05-02-2010 03:56 AM

Keychar for the spacebar?
 
Does anyone know?
its for a jump script.
i cant use
PHP Code:

function onKeyPressed(keycharcharacter){
  if (
character == ""&&!player.swimming){
      
blahblah
  
}


-since arrow keys and such will trigger it. i reeeaally want to use the space bar since it's easy to press many of the keys on the keyboard while using your thumb to tap the spacebar. any tips?

Switch 05-02-2010 04:14 AM

PHP Code:

//#CLIENTSIDE
function onKeyPressed(codekeyscan) {
  
player.chat "CODE: " @code" ; KEY: " @key" ; SCAN: " @scan;



fowlplay4 05-02-2010 04:16 AM

Whenever I can't figure out a Keypressed I usually use the following script:

PHP Code:

//#CLIENTSIDE
function onKeyPressed(keycode,keystring,scancode)  {
  echo(
"Keycode: " keycode);
  echo(
"Keystring: " keystring);
  echo(
"Scancode: " scancode);


Then from there you can find the right keycode or scancode and form the proper if statement.

Edit: Looks like Switch already posted that.

cbk1994 05-02-2010 04:25 AM

Spacebar is 32 if I recall right.

Jiroxys7 05-02-2010 04:35 AM

Alright cool i got it working now. Thanks guys!

Admins 05-06-2010 01:20 PM

keycode==VK_SPACE

Inverness 05-06-2010 09:06 PM

Quote:

Originally Posted by Stefan (Post 1574459)
keycode==VK_SPACE

We have constants for keycodes?

cbk1994 05-06-2010 09:59 PM

Quote:

Originally Posted by Inverness (Post 1574516)
We have constants for keycodes?

News to me too.

adam 05-06-2010 10:35 PM

News to me three, seems to work with most other keys as well, i've tried a few so far.

Programmer 05-06-2010 10:43 PM

You guys didn't know? Wow. That was released ages ago. x]

DrakilorP2P 05-07-2010 12:14 AM

Quote:

Originally Posted by Programmer (Post 1574531)
You guys didn't know? Wow. That was released ages ago. x]

Released where? Why isn't it in the wiki?

Inverness 05-07-2010 01:40 AM

Quote:

Originally Posted by Programmer (Post 1574531)
You guys didn't know? Wow. That was released ages ago. x]

Quote:

Originally Posted by DrakilorP2P (Post 1574549)
Released where? Why isn't it in the wiki?

This is one of the reasons why GScript pisses me off.

It is very hard to program competently when not everything is even documented.

coreys 05-07-2010 08:10 AM

Looks like it resembles the constants in a lot of libraries with input support like SDL, so I guess it won't be too hard to figure out :o

I really don't see anywhere where it's mentioned, though.

DustyPorViva 05-07-2010 08:13 AM

What does VK stand for? Virtual Key?

adam 05-07-2010 04:29 PM

Quote:

Originally Posted by DustyPorViva (Post 1574611)
What does VK stand for? Virtual Key?

mm. that is my guess as well.


All times are GMT +2. The time now is 10:51 PM.

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