GLobal Key Command Matchng Properties

I am struggling to get something to work.

I want a button to get all tiles with a certain Marker tag to return to a deck (and do other stuff).

I can get the button to do a Multi-action and I have managed to make one of those actions a general test message.

I am trying to make the next action one that sends all pieces a command. Eventually this will be a “Return to deck” but for now it is another test message which gives me some details about the piece. I have put a Report action in the tile prototype so I know they are acting on it. (I presume everything is getting it but I only put a subscription in the tile Prototype ).

Now where I am stuck is when I try to use the “Matching Properties” part of the Global Key Command.Really the condition I want to look for is that the Marker label on the tile is equal to the CurrentBoard value, but I cannot get that bit to work. Either all the tiles report back or none at all, but always I get the general test message that the button was pressed.

Ah! I fixed it.

The way I fixed it, was to create a “Calculated Property” that was the expression I was trying to use. I added that to the test message. Once I had got that working, I copied the expression to the Global Key Command.

The strange thing is that the mistake seemed to be surrounding one of the properties with $. This is how it is shown in the documentation examples so I am still not quite sure where the error was.

If you’re building the expression in the beanshell expression builder (and I believe Calculated Property uses exclusively beanshell expressions), then you don’t want the $ $'s. In those just putting the name of the property will use its value.

Or if you need to compute the name of the property on the fly you can use GetProperty() as in… GetProperty(GetProperty(“ArmyName”)+"_Strength")

So in that example if you had a property ArmyName which currently held the strength “BEF”, and you had another property named “BEF_Strength” that held the value 5, then the expression above would return 5. But if you knew you just always wanted the value in BEF_Strength (and didn’t need to index by multiple army names) then just putting BEF_Strength would return 5.

Usually you can tell when something is a “beanshell expression” because the system puts { curly braces } around it. But Calculated Property appears to be an exception. And of course the documentation trails behind the actual software and usage, As Is The Tradition In Software Projects Since Time Immemorial :smiley:

Brian