Calculated Properties are also ignored on the Palette, in case that helps track the cause down.
OK, this is another version of what used to happen with Calculated Properties. During building of the Piece Slot, the Piece is built out from itâs prototypes, but if a Calculated Property is referenced in a Text Label, it causes the CP to be evaluated. If the CP references properties in deeper protoytype levels that have not been expanded yet, it can cause a Bad Data in Module error, if you take a substring of what is now an empty String for instance.
We âsolvedâ this using the fairly heavy-handed approach of not evaluating a CP on counters that are in a GamePiece palette.
The counters in this module use {} expressions within Text Label formats (Aside: This is generally not a good idea if your module has many counters with labels doing this, you may find that general performance is affected). Any {} expression is essentially an in-line Calculated Property, so the same problem occurs when used in Text Labels.
I could use the same approach (not evaluate Text Labels in Palettes), but that would be heavy-handed as it shuts down labels that actually work. I can see a better approach that just evaluates Labels in Palettes âquietlyâ and ignores errors.
I could also apply this technique to Calculated Properties and turn these back âonâ in the palette, just suppress errors.
Could you (and Mark) please try out the test build 13490-PaletteErrors going up now in http://vassalengine.org/build.
Check that it solves the problem, but that your module still works
I believe this resolves the problem, plus I have turned evaluation of Calculated Properties in GamePiece Palettes back on, but have suppressed the error reporting on these as well. Itâs a much better solution.
CCN v5 looks like it still works. I donât have a ready replica of bad data module errors, so I havenât tested that as yet.
Hi Mark and Brent I can get to the code but I need to download an executable for Mac. I can get the code, but have no idea how to run it from there
"Aside: This is generally not a good idea if your module has many counters with labels doing this, you may find that general performance is affectedâ
I agree. If there were that array command then I donât think I would need to evaluate. I could just get the nth item in the array. I realize this is a labor of love and I donât reasonably expect that to show up but that is why I want it.
Thank you again for the help. Muting the error is a great solution AFIK.
VASSAL-3.8.0-SNAPSHOT-bb76350-13490-PaletteErrors-macos-universal.dmg Should do it.
Even still you would likely have issues. Itâs not the complexity of the expression so much as using a Beanshell expression at all. The overheads of using any Calculated Property or {} at all is quite high. You would still need Calculated Expressions to use my proposed Array implementation.