Color translation

[code]import colorsys, system

colorRaw = system.tag.read("[Client]color1").value
color = colorRaw[0] / 255.0 , colorRaw[1] / 255.0 , colorRaw[2] / 255.0
new1 = colorsys.rgb_to_hls(color[0], color[1], color[2])
new2 = colorsys.hls_to_rgb(float(new1[0]) + 0.3, new1[1], new1[2])
new3 = colorsys.hls_to_rgb(float(new1[0]) + 0.6, new1[1], new1[2])
color2 = str(int(round(new2[0] * 255))) + ‘,’ + str(int(round(new2[1] * 255))) + ‘,’ + str(int(round(new2[1] * 255)))
color3 = str(int(round(new3[0] * 255))) + ‘,’ + str(int(round(new3[1] * 255))) + ‘,’ + str(int(round(new3[1] * 255)))
system.tag.write("[Client]color2", color2)
system.tag.write("[Client]color3", color3)[/code]

I’m attemping to create 3 primary colors from a xxx,xxx,xxx string input.
This works in the script playground if i use colorRaw = x,y,z
Can’t seem to figure out what I have wrong so I can’t use this in a client tag change script.

It worked in the script playground because you were creating a tuple, which is handled differently than a string. You’ll want to use split(",") on the value you get back from the client tag in order to get the same effect.

#colorRaw = system.tag.read("[Client]color1").value import colorsys, system input = newValue.value colorRaw = input.split(",") color = float(colorRaw[0]) / 255.0 , float(colorRaw[1]) / 255.0 , float(colorRaw[2]) / 255.0 new1 = colorsys.rgb_to_hls(color[0], color[1], color[2]) new2 = colorsys.hls_to_rgb(float(new1[0]) + 0.1, new1[1], new1[2]) new3 = colorsys.hls_to_rgb(float(new1[0]) + 0.2, new1[1], new1[2]) color2 = str(int(round(new2[0] * 255))) + ',' + str(int(round(new2[1] * 255))) + ',' + str(int(round(new2[1] * 255))) color3 = str(int(round(new3[0] * 255))) + ',' + str(int(round(new3[1] * 255))) + ',' + str(int(round(new3[1] * 255))) system.tag.write("[Client]color2", color2) system.tag.write("[Client]color3", color3)

Thanks. Here is the script working.
This is my code now,
And I have my color custom properties of my window bound to color2 and color3 client tags… Still doesn’t change those values

Are you getting any errors in the diagnostic console of the client? Or is it just not functioning properly?

[quote=“BigSchottkyD”]
And I have my color custom properties of my window bound to color2 and color3 client tags… Still doesn’t change those values[/quote]

I didn’t mean this…
Everything works fine… Now I have to figure out how to choose a reasonable range of colors to use this with.

Ok great, glad you got it working. I’ll shut this one down.