Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-07-2002, 11:03 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
keypressed :(

NPC Code:

if (created) {
i = random(0,1);
}
if (i<=1) {
showimg 0,@@c@G H W E X,screenwidth/2,screenheight/1-10;
changeimgvis 0,4;
timeout=2.05;
this.key1=false;
if (keypressed){
if (keydown2(keycode(g),true)){
this.key1=true;
}
}
if (keypressed){
if (keydown2(keycode(h),true)){
if (this.key1=true){
this.key2=true;
}
}
}
if (keypressed){
if (keydown2(keycode(w),true)){
if (this.key1=true&&this.key2=true){
this.key3=true;
}
}
}
if (keypressed){
if (keydown2(keycode(e),true)){
if (this.key1=true&&this.key2=true&&this.key3=true){
this.key4=true;
}
}
}
if (keypressed){
if (keydown2(keycode(x),true)){
if (this.key1=true&&this.key2=true&&this.key3=true&&t his.key4=true){
this.key5=true;
}
}
}
}



The problem is that keypressed isn't "working", also, I know that it's keypressed that isn't working, and not keycode thanks to the debugger . So, either something is wrong with keypressed (Heh, yeah right) or I made a mistake (<----That is the correct reason). So, could someone tell me what my mistake was?

Oh, and yes, I am aware of my uneccessarily large if statements, and that this script is actually pointless.
__________________
Reply With Quote
  #2  
Old 12-07-2002, 11:40 AM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
Do you ever read the rules? DONT POST FULL SCRIPTS!
--try this format
NPC Code:
if (keypressed){
if (keydown2(keycode(R),true){//stuff here;}
if (keydown2(keycode(e),true){//stuff here;}
if (keydown2(keycode(a),true){//stuff here;}
if (keydown2(keycode(d),true){//stuff here;}
//--
if (keydown2(keycode(T),true){//stuff here;}
if (keydown2(keycode(h),true){//stuff here;}
if (keydown2(keycode(e),true){//stuff here;}
//--
if (keydown2(keycode(R),true){//stuff here;}
if (keydown2(keycode(u),true){//stuff here;}
if (keydown2(keycode(l),true){//stuff here;}
if (keydown2(keycode(e),true){//stuff here;}
if (keydown2(keycode(s),true){//stuff here;}
}

__________________
Reply With Quote
  #3  
Old 12-07-2002, 11:58 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by Goboom
Do you ever read the rules? DONT POST FULL SCRIPTS!
That's far from being the full script. That's a small part of a script I'm making, which is why it was so useless.
__________________
Reply With Quote
  #4  
Old 12-08-2002, 05:53 AM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
My experience is that keypressed is not working when you are pressing one of the default keys (Those you can set in the options).
But I doubt you gave the key "x" a default meaning, so I guess the problem is more due to the fact that the script looks very weird. Yes, keypressed should be treated like an event, while i<=1 is not an event.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
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 03:16 AM.


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