View Single Post
  #8  
Old 02-11-2002, 02:33 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
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.
__________________
Reply With Quote