Questions about the PlayerSide matching expression to hide units from toolbar


This expression has been in my older versions of Black Swan. When I used this hide button it worked as a toggle. But in some games I played when Hide was selected it didnt toggle but stayed hidden. I liked that but could not figure out what was different in these modules. I noticed the addition of ObscuredToOthers=false in these other modules. So I played around with adding this statement onto the version you see above. It didn’t work so I thought I was on the wrong path. Researched more and began to think that that had to be it that stopped the toggle effect. I tried many combinations (because I don’t understand expressions well) until I hit apon this version that worked.

First I removed the brackets. No dice. Then I removed the qoutes. Again nothing. Then finally I removed the == and replaced with just single = and bingo the ObscuredToOthers=false addon finally worked.

I guess what I’m scratching my head over is what’s the difference with == vs = and no quotes vs quotes etc. I could not find == in the handbook, so I’m not sure why the guy who created Black Swan V1.0 did it this way.

There is a reference in the manual to ‘Old-sytle simple expressions’, an older style of expression that has been replaced by the new expressions in {}.

The ‘old-style’ expressions (which use =, not ==) suffered from an inconsistent syntax, no () parentheses allowed, and a strange execution order.

Notice how that old expression is NOT enclosed in {}, that indicates that it is an old-style expression.

Fear not, just press on the Calculator button to the right of that field and Vassal will automatically convert it to an equivalent ‘new-style’ expression that you can the work with.

Regards.

1 Like

Can’t tell exactly what you tried, but if you tacked it onto what you had literally as written, i.e.: && ObscuredToOthers=false it would’ve failed due to the lone = inside the curly braces.

Adding: && ObscuredToOthers=="false" should have worked.

Both the Property Match Expressions and Expressions reference pages get into more details on the differences between simple (old style) expressions and BeanShell.

1 Like