Changing Color with a Sub-menu

Hey guys, first of all thanks for reading. I’m having trouble adding a function to my module and I am hoping that others will be able to help me find a solution. In the module each player can change their pieces to a different color. Right now this is done through a list of layers and scrolling through each layer until you find the color layer you want. I would like to change this, if possible, to choosing the color through a sub menu. I think that this can be done using the existing color layers and the “levels follow expression value”. When the color Red is selected in the sub menu, the “layer expression value” would change and the Red layer (layer 2) would be selected. If this can be done, how would the expression be written? Is there a module that uses this functionality that I can examine? I ask because I’m not sure I completely understand how the “layer follows expression value” functionality works. (Maybe I don’t understand how the sub-menu functionality works?) Either way, I’m having trouble making it work. In the end I would like each player to be able to select all of their pieces, use the sub menu to select the color, and then have all the pieces change at the same time without having to scroll through each color layer. Each piece follows the same color progression. Any ideas?

Thanks again for your time

Make a list of colors and assign a number to each in a text file for reference

Place a Dynamic Property trait above the layer trait on the piece

Name = PieceColor
Value = 1
Check “is numeric”
Click the “New” button for key commands. Include:
Menu Command = Blue (or whatever color you want)
Key command = SetToBlue (or SetTo[place color here]
Type = Set value directly
New Value = 1 (or whatever number you’ve assigned to the color your setting up)

Click the “New” button again and assign keys for each color giving each a numeric value.

On your layer trait, check “Levels follow expressions value?” with Follow Expression = PieceColor
Make sure the layer number matches the color you want for that number.

Now, when a player right-clicks the piece, they will get a list of colors to choose from.

If you’d like to place all the color selections is a Sub-menu, add the Sub-menu trait. Place it above the Dynamic Property trait on the piece:

Menu Name - Choose Color
Use the Add button to add a list of all the colors, each as a separate entry.

Now the player can right-click the piece, select the “Choose Color” option on the menu and they’ll get a list of colors to choose from.

Wow… Thank you so very much. That is incredibly simpler than the method I had rigged up. It works perfectly!