GlobalKeyCommand trait: Set Dynamic Properties fields don't works with beanshell expressions?

This is how i’ve set a GKC trait:

It works, but if i change $MoraleIncrement$ with {MoraleIncrement} it always set the property to 0.

Is this expected (so, is this the meaning of the “Use $$ for source values” bold label)?

Note: the page Passing values to pieces seems truncated, so i can’t get any help from the manual.

Thanks

$MoraleIncrement$ Here the property value is assessed on the source piece, where the GKC trait sits.

{MoraleIncrement}Here the property is assessed on the target piece, where the GKC Key Command is processed.

The key aspect is that the “$” delimiter is determining this behaviour. In the context of GKC “additional properties or “Dynamic Property” fields this applies even inside the beanshell expression. So, here you could also use, {$MoraleIncrement$}

1 Like

Thank you very much.

Your reply should be copied as it is and put in the reference manual on every page it would be relevant.

The addition of passed dps like this is, to me, one of the most significant new vassal features. I use it all the time. I can pass arguments! I have found that the safest way to set values is to use both $ and quotes, e.g. {“$value$”}. Sure, I don’t need the quotes for integers, but I’ve had problems with markers, and it won’t hurt no matter what. If you follow this advice, you’ll never go wrong.