Author Topic: Color Events - onColorChange and setSameColor  (Read 2468 times)

Allows you to keep the color of two bricks in sync. Perfect for use with Slayer's capture points!

Input Events:
onColorChange - Called whenever the brick's color changes.

Output Events:
setSameColor - Intended to be used with named bricks, this changes the target brick to the same color as the brick that called it.

Example:
Code: [Select]
onColorChange -> Named Brick [flag] -> setSameColor
Download Event_BrickColor


setSameColor - Intended to be used with named bricks, this changes the target brick to the same color as the brick that called it.
I thought there was no good way to get the brick that triggered the input event from any target but Self? Both setPlayerTransform and VCE tried to do this, and for the most part it worked, but when multiple events are going off at once, it can screw up and change the input event brick.
I can't download to see how you've done it atm.

Right after I finished making a server that built around this :P

I thought there was no good way to get the brick that triggered the input event from any target but Self? Both setPlayerTransform and VCE tried to do this, and for the most part it worked, but when multiple events are going off at once, it can screw up and change the input event brick.
I can't download to see how you've done it atm.
onColorChange sets a $lastInputBrickColor variable.
setSameColor sets all the bricks with that name to $lastInputBrickColor.

onColorChange sets a $lastInputBrickColor variable.
setSameColor sets all the bricks with that name to $lastInputBrickColor.

Just to clarify though, the variable is set in SimObject::processInputEvent, so it will work with any input event.

Just to clarify though, the variable is set in SimObject::processInputEvent, so it will work with any input event.
I believe that is the same method VCE used, and it doesn't always work. I think theres a schedule between the input being called and the output being called, so if another brick gets any input called, then it will change the target.