(SOLVED)Weird crash with variables and tint


I tried to make a system to tween a tint since there’s currently no tween for a tint since its an effect, but I get this error when I try to run the game. The audio that plays in the background still plays as if the game is running despite the error.

This is the part in the event sheet responsible

The last line is setting the color to the literal text instead of evaluating the variables bc everything is inside quotes.

You need something like

Set tint to
ToString(r) + “;” + ToString(g) + “;” + ToString(b)

It’s definitely a bug though, it shouldn’t cause a crash.

There isn’t a tint tween but there are 2 tweens that affect color.

The basic tint isn’t an effect but if it was or you were referring to an effect, there are tweens to tween effects.

1 Like

GD has a great Tween tint function.

The normal color effects dont work since the thing im trying to recolor is a monochrome sprite.

Also, trying “ToString(TintR) + “;” + ToString(TintG) + “;” + ToString(TintB)” gives the red warning “you must enter a number” under all of the variable names. Could it be due to the fact that the variables are stored as object variables?

1 Like

Hi .yes …to me it like looks like it’s because you were referring to them as if they were global or scene variables. you need to use object.TintB…not in quotes though. +“;” etc

I can’t tell if you’re putting the variables in quotes in your post to seperate them from the rest of the text or that’s how you’re using it. Only the semicolons need to be inside quotes.

I tested it with 3 sliders and this works. I saved the slider value in variables to simplify the tint event.

This is my scene.

With the new variable system, the ToString() expressions don’t seem to be needed but I like the extra clarity.

3 Likes

I got it to work like this, thanks

1 Like