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-08-2002, 10:32 PM
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
Unhappy Condensed Endless Loop...

NPC Code:

if (timeout){
if (i=17){
if (this.key5=true){
this.key5=false;
i=16;
timeout=1;
}
else{
this.key5=false;
i=16;
timeout=1;
}
}
}



Yes, I have tried changing i=17 to i==17 but it didn't work .
__________________
Reply With Quote
  #2  
Old 12-09-2002, 12:16 AM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
yes, well keep the i==17 in because thats the correct format. At least thats one problem solved. Also, you have:

if (this.key5=true) it should be if (this.key5==true)

like Falcor said, = is an assignment, == means equal to

eg
this.var = 5; // Makes this.var equal to 5

Also, heres an example of a very simple timeout loop that is stopped:

NPC Code:

//#CLIENTSIDE
if (playerenters){
this.time = 100;
this.on = 1;
timeout = .05;
}

if (timeout && this.on == 1){
this.time --;
if (this.time<=0){
this.on = 0;
}
timeout = .05;
}



I suggest using :

if (timeout && i == 17) { //thingys; }

-Ning
Reply With Quote
  #3  
Old 12-09-2002, 01:11 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
last time i checked graal checks = and == in if/while/for statements as being equals, i always use == but i think = works as well, even though it is technically incorrect
Reply With Quote
  #4  
Old 12-09-2002, 01:48 AM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
kool :P
__________________
Former Global Scripting Team Member


Reply With Quote
  #5  
Old 12-09-2002, 02:11 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
NPC Code:

if (timeout&&i==17){
if (this.key5==true){
this.key5=false;
timeout=1;
i=16;
}
else{
this.key5=false;
timeout=1;
i=16;
}
}



, that's the script now. It still doesn't work though...
__________________
Reply With Quote
  #6  
Old 12-09-2002, 02:39 AM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
In the timeout loop, you set i to 16. SO the timeout loop could never start...I may be reading it wrong, but at a glance thats how it looks

w00t im a member now (not junior) <3
__________________
Former Global Scripting Team Member


Reply With Quote
  #7  
Old 12-09-2002, 03:01 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
it says &&i==17, meaning it has to be 17 in the first place, so you have to set that somewhere
(dunno if thats what ningnong meant or not, sorry if it was :X)
__________________

Reply With Quote
  #8  
Old 12-09-2002, 03:10 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 CheeToS2
it says &&i==17, meaning it has to be 17 in the first place, so you have to set that somewhere
(dunno if thats what ningnong meant or not, sorry if it was :X)
Starting the loop isn't the problem. Since that isn't the whole script, the problem is that the loop won't end.
__________________
Reply With Quote
  #9  
Old 12-09-2002, 03:25 AM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
hmm, why do you have

if (this.key5 == true) this.key5 = false ?

since the script is confusing, maybe you should explain in english what your trying to do, then I could whip you up an alternate script :P
__________________
Former Global Scripting Team Member


Reply With Quote
  #10  
Old 12-09-2002, 04:12 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
Okay, at the time that this part of the script is executed...

this.key5 could be true or false.
i=17
__________________
Reply With Quote
  #11  
Old 12-09-2002, 04:34 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
the timeout stops for me. *shrugs*
__________________

subliminal message: 1+1=3
Reply With Quote
  #12  
Old 12-09-2002, 05:35 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
Falados, I'll send you the whole script whenever you get on AIM.
__________________
Reply With Quote
  #13  
Old 12-09-2002, 06:39 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
If you need a variable to be stored longer than the current "frame", you should use this. variables, because other scripts might use the variable as well and therefore mess up your script.
Reply With Quote
  #14  
Old 12-09-2002, 07:49 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 Loriel
If you need a variable to be stored longer than the current "frame", you should use this. variables, because other scripts might use the variable as well and therefore mess up your script.
I tried that before using i.
__________________
Reply With Quote
  #15  
Old 12-09-2002, 10:40 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally posted by Python523
last time i checked graal checks = and == in if/while/for statements as being equals, i always use == but i think = works as well, even though it is technically incorrect
I always use '==',works better for me.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
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 09:06 AM.


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