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 01-09-2002, 01:12 PM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
While Command doesn't seem to be working correctly

I did some testing, and found it isn't working...I am going to use the old graal version to see if it works with that....but this is for Stefan, just in case there is a problem
__________________
This account is no longer is use.
Reply With Quote
  #2  
Old 01-09-2002, 06:04 PM
Kumada Kumada is offline
Ded
Kumada's Avatar
Join Date: Nov 2001
Location: Usa
Posts: 1,088
Kumada is on a distinguished road
Re: While Command doesn't seem to be working correctly

Quote:
Originally posted by BlKnight
I did some testing, and found it isn't working...I am going to use the old graal version to see if it works with that....but this is for Stefan, just in case there is a problem
What did you use it with..
__________________
Aim: Mmm Kumada

Reply With Quote
  #3  
Old 01-09-2002, 06:38 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
If your code is something like:
NPC Code:
while (this.var+this.i==2) {
this.var=3;
}

It'll only perform once, even if this.var+this.i becomes 2 again. The solution is quite simply putting it in a timeout loop.
__________________

Reply With Quote
  #4  
Old 01-10-2002, 06:37 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
full script?
Reply With Quote
  #5  
Old 01-10-2002, 06:48 AM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
Quote:
Originally posted by Stefan
full script?

Can't show =( Has some math in it that I don't want to reveal, its for my map and mini map.

See the thing is, when I was doing it with
if(weaponfired&&keydown(6)) {
if (this.on=0) {
this.on=1;
}else{
if (this.on=1) {
this.on=2;
}else{
this.on=0;
}
}

The while for
while (this.on=>1) {
myscript;
}

Worked fine...but when I switched it (since I needed to detect a key combination with another NPC) to detect a variable which indicates whether it was fired or not, it stopped working. It has never done this in the old graal EXE.
__________________
This account is no longer is use.
Reply With Quote
  #6  
Old 01-10-2002, 06:52 AM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
Quote:
Originally posted by grim_squeaker_x
If your code is something like:
NPC Code:
while (this.var+this.i==2) {
this.var=3;
}

It'll only perform once, even if this.var+this.i becomes 2 again. The solution is quite simply putting it in a timeout loop.

If that was true then my this.on while loop shouldn't be working..

btw...I do believe == is in boolean, which in other words would only work for 0 or 1, 0 meaning false, 1 meaning true. So it would just be plain = to work that way .

Oh and I don't want it in a timeout loop, I already have some things preventing that from working well, and it will cause some lag. A timeout is unneeded for this...though, if the while is in fact flawed, it may be the only solution...
__________________
This account is no longer is use.
Reply With Quote
  #7  
Old 01-10-2002, 07:08 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
erm grim squeaker isnt there a diff between == and = ? i thought == was for comparison ... or something i dunno
neways.. its working fine in my galaxy code .. and i havent had ne problems newhere else
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #8  
Old 01-10-2002, 07:18 AM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
Quote:
Originally posted by LiquidIce00
erm grim squeaker isnt there a diff between == and = ? i thought == was for comparison ... or something i dunno
neways.. its working fine in my galaxy code .. and i havent had ne problems newhere else
Well in C++ I remember == being for boolean and = being for..umm...just an integer...(forgot the name). So I figured the same for this...as for while working in your script yeah...hmm something weird is going on. I think its a bug with while and variables other then this.
__________________
This account is no longer is use.
Reply With Quote
  #9  
Old 01-10-2002, 08:17 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
== is for like checking somehting....ex: if (this.1==5){it checks if the thing equals that number...= just automatically sets the code to that number...im not good at explaining...so if part of it is wrong...dont get mad..!!
__________________
Reply With Quote
  #10  
Old 01-10-2002, 08:18 AM
Faheria_LAT3 Faheria_LAT3 is offline
The **** hit the fan...
Faheria_LAT3's Avatar
Join Date: Jul 2001
Posts: 5,266
Faheria_LAT3 is on a distinguished road
Soul Blade, PM Stefan the script if you don't want others to see it.
__________________
AIM:Shadrock17

Idiot of the millennium: Gonmon
Reply With Quote
  #11  
Old 01-10-2002, 08:57 AM
Faheria_GP2 Faheria_GP2 is offline
Banned
Faheria_GP2's Avatar
Join Date: Oct 2001
Posts: 1,177
Faheria_GP2 is on a distinguished road
GScript is not c++, in c++, using == and = are two different things, in graal, they are exactly the same thing

for example

if (j=4) {
iam***(6);
}

in c++ would always run, because the "=" sets j to 4 and returns true, but

if (j==4) {
iam***(6);
}

would only run if j is 4, because it checks for equality and returns true if it is equal, and false if not.

but in graal

if (j=4) and if (j==4) are the exact same thing.

also in graal, you cannot do things like

if (j++<3), because you can't do setting in the "if" block
Reply With Quote
  #12  
Old 01-10-2002, 10:17 AM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
Quote:
Originally posted by Faheria_GP2
GScript is not c++, in c++, using == and = are two different things, in graal, they are exactly the same thing

for example

if (j=4) {
iam***(6);
}

in c++ would always run, because the "=" sets j to 4 and returns true, but

if (j==4) {
iam***(6);
}

would only run if j is 4, because it checks for equality and returns true if it is equal, and false if not.

but in graal

if (j=4) and if (j==4) are the exact same thing.

also in graal, you cannot do things like

if (j++<3), because you can't do setting in the "if" block
Guess you haven't had much experiance with it Play with it some time, they are very much so different...
__________________
This account is no longer is use.
Reply With Quote
  #13  
Old 01-10-2002, 08:19 PM
Poogle Poogle is offline
Registered User
Poogle's Avatar
Join Date: Jun 2001
Posts: 2,471
Poogle is on a distinguished road
Re: While Command doesn't seem to be working correctly

Quote:
Originally posted by BlKnight
I did some testing, and found it isn't working...I am going to use the old graal version to see if it works with that....but this is for Stefan, just in case there is a problem
also else { doesnt work
Reply With Quote
  #14  
Old 01-10-2002, 09:19 PM
BlKnight BlKnight is offline
Not in Use
Join Date: Mar 2001
Location: N/A
Posts: 1,527
BlKnight is on a distinguished road
Re: Re: While Command doesn't seem to be working correctly

Quote:
Originally posted by Poogle
also else { doesnt work

Its not supposed to genius. Not with whiles at least.
__________________
This account is no longer is use.
Reply With Quote
  #15  
Old 01-10-2002, 09:41 PM
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
For checking stuff, just always use ==... and for setting stuff, just use =...

For that not-so-much working while-loop, it should be in an event...
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 04:34 AM.


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