Set Piece Property Directly?

The Mask trait offers a single activation command. The problem I have is that this toggles on/off the piece property “ObscuredToOthers”. The project I am working on requires that the opponent NEVER sees the indicators under the mask. So, given that there is only a toggle, as a designer, I can never fire the command to ensure the property is “true”. So, is there a workaround where I can set a piece property to a specific value even if it is not supported by the trait command? I’m hoping this is not a custom code situation.

If anyone is interested, I have a workaround. I’d still like to be able to set properties directly if anyone has a way to do that. But, in this case, I can get the effect I want by using a TriggerAction trait to trigger the Mask trait and use a beanshell expression in the TriggerAction trait to block the action if “Property==true”. This results in the behavior I want.

1 Like

Do you think a trigger action would be able to detect when a piece is attached to a Mat and trigger the mask command for the new Mat Cargo piece ? I have not found a way to get it to work.

So, when you attach a cargo-piece to a mat, you want that action to also trigger the mask of the cargo-piece? Did I get that right?

Yes and thank you for the reply. I am trying to use CurrentMat==“String” as the trigger. If I enable a menu item for the trigger it enables when the cargo attaches to the mat but when I try to get it to trigger without a menu item it will not go.
Thanks again,

You have to have a “Key Command” for the item to trigger, but you don’t have to have a menu item – just don’t put the menu text. The “Key Command” doesn’t have to be an actual key sequence (in the righthand box), it can instead be a “Named Key Command” (in the lefthand box), just give it a unique name

Cattlesquat is one of the Devs, so his advice is much more authoritative than mine. My only comment is to elaborate on his response in case you need additional verbosity.

I think the gist of the issue is that the “TriggerAction” trait comparison of "CurrentMat==“String” will not happen spontaneously. It must be triggered by a menu action. So, the “TriggerAction” only evaluates your comparison if the “TriggerAction” trait’s menu item has been selected and therefore “fired” or the shortcut keystroke has been used, also causing it to be fired. So, bottom line, the property comparison expression can only act to limit which cases cause the “TriggerAction” procedure to be followed. It will not spontaneously trigger as soon as the specified comparison expression is “true”.

I hope this helped and didn’t confuse the issue further. Apologies to @Cattlesquat if I took this in a direction he doesn’t agree with.

Thanks to all, HaraldFair, I believe you are correct. I was expecting the trigger to fire on the property value only.

You can also do what you want by using the “restrict command” trait. It has the added benefit that you can set it up so the command grays out OR it completely disappears from the context menu when restricted. Make sure though that restrict-command is lower down the trait list then the command it restricts.

I tend to use restrict-command when I don’t want the menu option to appear or it’s a one-off. I tend to use conditional triggers when either I need to do a list of commands or I’m watching for another command’s execution.