Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   function onKeyPressed(???,???) (https://forums.graalonline.com/forums/showthread.php?t=74270)

ff7chocoboknight 05-29-2007 05:43 PM

function onKeyPressed(???,???)
 
I'm having trouble understanding the function onKeyPressed. Can I see some examples?

Chompy 05-29-2007 05:47 PM

PHP Code:

function onKeyPressed(keycodekeychar)
{
  switch(
keychar) {
    case 
"a":
      
// pressed a
    
break;
    case 
"b":
      
// pressed b
    
break;
  }



ff7chocoboknight 05-29-2007 05:50 PM

What about keycode?

xAndrewx 05-29-2007 06:27 PM

HTML Code:

function onKeyPressed(letterCode, letterChar)
{
  player.chat = format(_("%s (the letter): %s (the code)"), temp.letterChar, temp.letterCode);
}


ff7chocoboknight 05-29-2007 06:48 PM

Quote:

Originally Posted by xAndrewx (Post 1312993)
HTML Code:

function onKeyPressed(letterCode, letterChar)
{
  player.chat = format(_("%s (the letter): %s (the code)"), temp.letterChar, temp.letterCode);
}


Thanks! <3

Rapidwolve 05-29-2007 09:33 PM

onKeyPressed(code, key, scancode)

ff7chocoboknight 05-29-2007 09:40 PM

I got it all figured out. Thanks, everyone.

Deadly_Killer 05-29-2007 09:43 PM

Andrew: in format, why do you use _?

And: I prefer keycode

xAndrewx 05-29-2007 09:46 PM

Makes me look smart
HTML Code:

player.chat = format(_("hi %s!"), player.account);
player.chat = format("hi %s!", player.account);
player.chat = "hi" SPC player.account @ "!";


xXziroXx 05-29-2007 09:47 PM

I do this since it makes me look smart:

PHP Code:

player.chat "" @ ( "Hello sir!" ) @ ""

[/sarcasm]

xAndrewx 05-29-2007 09:48 PM

rofl
I laughed when I saw that, I thought what a ****ing retard xD

ff7chocoboknight 05-29-2007 09:48 PM

Quote:

Originally Posted by xAndrewx (Post 1313056)
Makes me look smart

rofl

Admins 05-29-2007 10:30 PM

The _() is used for translations. All text on Kingdoms, most on Zone and some on Era already use that (although Zone and Era currently have no translation files on the server)

xAndrewx 05-29-2007 10:39 PM

Oh, thank me for the ones on Era!!
::high five::

I was fired for no reason though, so like Smu can go to hell.


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

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