Help with function

Hi!

I wanted to make a function for changing a layers ambient color based on a variable symbolizing time.

For some reason this is not working and I don’t know why.

I made a function y=255sin(0.1309x) where x is a variable time and when x is 12 this function should output a value of 255 which would make the ambient light white and thereby as light as possible. Also this should make it so that the output is 0 both when the time is 0 and 24.

Help

Well, you’re wrapping it in quotes, which won’t work. It means your code is being interpreted as literal text.

You probably need to use the ToString expression (click the blue button on the right and search for Number > Text) for each function you have, not use quotes, and then join them with + “;” +

Just a guess, though.

Thank you it helped alot!!!
If anyone is wondering this is what the expression looks like when actually working

LargeNumberToString(255sinh(0.1309GlobalVariable(TimeHours)))+";"+LargeNumberToString(255sinh(0.1309GlobalVariable(TimeHours)))+";"+LargeNumberToString(255sinh(0.1309GlobalVariable(TimeHours)))

Although it is not very smooth currently ill have to fix it a bit

Thanks again :smiley:

1 Like

You might also want to make sure your function clamps the numbers between 0 and 255. Anything negative or over 255 will cause issues with any color related event.