[Closed] compare wirecolor
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
[size=2]i get an error message. it seems like i can only use bool-variables for the if-sentence.[/size]
[size=2][/size]
[size=2]after that, i tried to make an array of the wirecolor and compare the 3 color-values after and after:[/size]
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
[size=2][/size]
[size=2]
[/size]
I ma sure that someone will answer this in a litte more depth, but the issue here is that
“=” is used to assign a value, if you want to compare a value then you have to use “==”
Infact your standard comparisons are:
“==” – equal to
“!=” – not equal to
“>” – great than
“<” – less than
“>=” – greater or equal to
“<=” – less than or equal to
so try :
if $.wirecolor == color 0 0 0 then
(
$.wirecolor = color 255 255 255
)
for the arrays, (I know it is probably just an example) but try and name things clearly, and not assign values to key words like “array”.
I think the Whole of the array would have to be identical to get a true return
if arr1 == arr2 then
(
--Do something here
)
Hope this helps Just post again if you need any help
Good luck,
Rich
This was exactly my problem. Some things are easier than they seem! Thank you for your quick answer!