Inventory window - superfluous error?

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?

Thanks for any help,
-Mark R.

Is there a property called Unit?

Is there a property called Unit?

There is. That’s how it distinguishes military unit pieces from game marker pieces.

Thanks for the thought, though.

-Mark R.

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?

Hmm… perhaps you’re on to something.

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.

-Mark R.

in the old format you would put:

Unit = $Unit$ && CurrentMap = Global Map

.I think you can still type it in the old way and it should convert for you

Thanks Tim, for the additional suggestions - I’ll give them a go in necessary.

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.

Thanks Grouchy and Tim!

-Mark R.

So, it turns out the (Unit==Unit) clause is as silly as it looks - I was getting all pieces, not just units.

The correct expression is this:
{(Unit==true) && (CurrentMap==“Global Map”)}