PDA

View Full Version : compare vertexcolor


stegge
11-16-2007, 03:57 PM
hi there!
i have a simple qustion. i want to compare the wirecolor of 2 objects. if it is the same, than it should change. i have an idea for the script, my only problem is the comarison.

for the change of an object from black to white i tried:

if $.wirecolor = color 0 0 0 then $.wirecolor = color 255 255 255

i get an error message. it seems like i can only use bool-variables for the if-sentence.

after that, i tried to make an array of the wirecolor and compare the 3 color-values after and after:

array = #($.wirecolor)

when i compare this array with another array, i get the same (bool) error-message. and in this array, there are not only numbers; the string:color is included

i think this is an easy operation. where is my fault?

greez
stegge

Bobo
11-16-2007, 04:07 PM
if $.wirecolor = color 0 0 0 then $.wirecolor = color 255 255 255

should be

if $.wirecolor == color 0 0 0 then $.wirecolor = color 255 255 255

because the isEqual boolean operation is denoted by ==, while = is assignment.
What you told MAXScript was

if (color 0 0 0) then $.wirecolor = color 255 255 255

because after the assignment, the value in $.wirecolor IS the color 0 0 0, but an IF cannot use a color, only a BOOL value - True or False.

Also note that for the main colors like Black, White, Red, Yellow etc., there are pre-defined global variables you can use:

if $.wirecolor == black do $.wirecolor = white

stegge
11-17-2007, 01:57 PM
This was exactly my problem. Some things are easier than they seem! Thank you for your quick answer!

CGTalk Moderation
11-17-2007, 01:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.