Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   ARG GS2 doesnt like me (https://forums.graalonline.com/forums/showthread.php?t=66356)

Omini 05-31-2006 08:17 AM

ARG GS2 doesnt like me
 
Why the heck wont function onKeyPressed() { } work for me?

NPC Code:
function onKeyPressed(character)
{
if (character == "a") {
if (playerx in |this.x-2,this.x+3|&&playery in |this.y-4,this.y+3|) {
if (this.open==0) {
play("nextpage.wav");
this.open=1;
this.setx=0;
}
}
}
}



NPC Code:
function onKeypressed(character)
{
if (character == "z") {
setani("sit","");
}
if (character == "x") {
setani("grab","");
}
}



(2 Different NPCs)

Neither of them work. What the heck am I doing wrong?

napo_p2p 05-31-2006 08:47 AM

I think the first parameter is the keycode, and the second is the key.

Try this:
NPC Code:
function onKeyPressed(keycode, key) {
player.chat = temp.keycode SPC temp.key;
}


Omini 05-31-2006 08:49 AM

Ah Twusk told me how to solve it, so I changed it to

NPC Code:
function onKeyPressed(code, character)
{
if (character == "z") {
setani("sit","");
etc etc



and it works fine.


All times are GMT +2. The time now is 03:02 PM.

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