Calculated Propert as a Global Property

Hi,
I’d like to use a calculated property (using some ifs statements and heavy formulas) being defined globally. Is it possible?
I’d need to call this property from any piece/card on any map/board without always having to redefine its value as an extra trait.

To be explicit: <span style=“color:$PlayerSide$”;> works fine in my report now, thanks to Cattlesquat, being compatible with Black, Red, Blue, Green … and Yellow. But Yellow is quite difficult to see on a white background!
So I either work with a calculated property on each piece with the formula to change Yellow color, or to add background-color just for it, or I find a way to replace $PlayerSide$ by some other formula derived from players color …

Thanks for your ideas

Wait, you’re saying you don’t want a side named #ffcc20 in your game? :smiley:

There’s no way to make a Global calculated property. You could put the calculated property in a Global Prototype, and add a Prototype trait specifying it in the different places that need to have access to it – that would at least save you having to type the formula in every time.

I don’t think Vassal supports double layers of $, does it? E.g. $$PlayerSide$$ which would then e.g. look for the contents of a second property equal to the player side (effectively $Yellow$) which would produce an RGB code?

Ha :smiley: I’ve been trying to do this $$PlayerSide$ReportColor$ in the span color code to capture both the PlayerSide And the associated color I want for the font.
At the end, I decided to make an inventory of all the cards, tiles, items and their protos to create the calculated property once for each of them … Darn ! All of that because of the Yellow PlayerSide !

If you do that, I hope you will use a Prototype when adding the Calculated Property (in other words, add the calculated property to a Global Prototype, and then reference that with a Prototype trait in each piece you want to have the calculated property). Otherwise as soon as you decide to adjust something (e.g. make the yellow color a little more/less yellow, whatever), you will have to go change every single piece in your game all over again. Much easier with the prototype – once added to all the pieces, you can edit the central prototype once and it will change everywhere.

Yup, sir ! That’s what I did (at first) : finding my 5 different trees of proto, and added 1 global proto to all 5.
So this calculated property would be available everywhere. (but as as said in another post I decided not to rely on this, after all, for my colored reports).
Thanks for the advice, though ;)