Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Scripting language bug (https://forums.graalonline.com/forums/showthread.php?t=23502)

Kaimetsu 02-10-2002 07:42 PM

Scripting language bug
 
NPC Code:

if(playerenters){
showcharacter;
if(1==1) message I work;
else message GScript is bugged;
}



It seems that anything before a == is always assumed to be a variable or a function. Hand it a plain number and it just throws up false.

But heck, if a new scripting engine is on the way then it hopefully won't matter.

Slaktmaster 02-10-2002 09:23 PM

Holy moly. :p

Bhala 02-10-2002 11:07 PM

Yea i noticed that last night too.... it made it a lot harder to make my script

Kaimetsu 02-10-2002 11:09 PM

[Squeaky!]
In the meanwhile you could just use if (true), just as long and it does exactly the same.
Who knows maybe even if (1) works.
[/Squeaky!]

Kaimetsu 02-11-2002 12:30 AM

Quote:

Originally posted by Kaimetsu
[Squeaky!]
In the meanwhile you could just use if (true), just as long and it does exactly the same.
Who knows maybe even if (1) works.
[/Squeaky!]

It's because I was using a defNPC. So I'd go:

NPC Code:

//#EDIT mode 1
//#CLIENTSIDE
blahblah;
if(mode==1){
whatever;
}



So then it'd get changed into "if(1==1){" by the editor, y'see?

Admins 02-11-2002 01:44 AM

Arg optimization error, when comparing two
const values then it tries to merge, but two code
lines need to be exchanged. Fixed in next
version (the parsing engine doesn't do the optimizing
task so it was good to mention it :-) )

Kaimetsu 02-11-2002 03:02 AM

Quote:

Originally posted by Kaimetsu


It's because I was using a defNPC. So I'd go:

NPC Code:

//#EDIT mode 1
//#CLIENTSIDE
blahblah;
if(mode==1){
whatever;
}



So then it'd get changed into "if(1==1){" by the editor, y'see?

[Squeaky!]
Ok, that explains a lot. Though I fail to see it's actual use.
[/Squeaky!]

Kaimetsu 02-11-2002 02:33 PM

Quote:

Originally posted by Kaimetsu
[Squeaky!]
Ok, that explains a lot. Though I fail to see it's actual use.
[/Squeaky!]

I had a magic fountain NPC that sprayed up light-effect particles, and it could originally be either Red, Green, Blue or a mixture of all. To define which colour it should be, the user entered a value into a "Colour" slot in the defNPC. Then when it came to assigning colours to the particles, it did something like this:

NPC Code:

for(i=0;i!=3;i++){
if(Colour==i||Colour==-1) particlecolour[i]=random(0,1);
}



Because -1 was the value used to represent 'use all colours'. So when the editor went through and replaced the slot variable things with numbers, it made it into:

NPC Code:

for(i=0;i!=3;i++){
if(-1==i||-1==-1) particlecolour[i]=random(0,1);
}



Which meant that the if condition always returned false.


All times are GMT +2. The time now is 08:18 AM.

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