Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-31-2006, 08:17 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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?
__________________



Reply With Quote
  #2  
Old 05-31-2006, 08:47 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
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;
}

__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 05-31-2006, 08:49 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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.
__________________



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:52 PM.


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