In my module, I’ve created an inventory window to shows all pieces with the property “Unit” and that are on the “Global Map”. I used the following expression in the Game piece inventory properties dialog box:
Show only pieces matching these properties: {Unit && CurrentMap == “Global Map”}
However, when a player opens the inventory window while playing the game, the following error message is issued to the VASSAL control window:
Bad Data in Module: Expression evaluation error Expression={Unit && CurrentMap == “Global Map”}, Error= inline evaluation of: ``_xyzzy=_plugh();’’ internal Error: Unimplemented binary String operator
Yet, the inventory window is displayed and has the exact behavior I’m seeking, i.e., it works correctly, making me feel like the above error message is superfluous. Any thoughts? Is my expression malformed in some manner?
All right, even though docs say nothing about it, shouldn’t the expression look like Unit == “xxx” && CurrentMap = “yyy”? If you leave the == “xxx” part, doesn’t Vassal assume you are trying to do some binary calculations?
Unit is a dynamic property and is assigned a value of 1 for units. Maybe I need Unit == “1” in the expression.
The expression is definitely being evaluated properly as originally written since non units (i.e., pieces with Unit not equal to “1”) do not show up in inventory window. Perhaps it’s just the syntax checker that’s gagging on the terse expression.
Thanks for the idea - I’ll give it a go this evening.
The following two variations of the expression didn’t cause an error message, but also didn’t work - there were no pieces displayed in the inventory window at all.
{Unit == “1” && CurrentMap == “Global Map”}
{Unit == 1 && CurrentMap == “Global Map”}
This expression, based on Tim’s suggestions, did the trick (no error and proper behavior): {(Unit==Unit) && (CurrentMap==“Global Map”)}
I’m going to test it more thoroughly, but looks like gold right now.