Trigger referencing property ref other property value

OK, I’m sure this should be relatively simple, but I hope someone can spell it out for me anyway.

PlayerSide: possible values Red Blue Yellow etc. (this determines which hand you can view)
Red: possible values Player2, Player3, etc. (this indicates which seat at the table is associated with which colour)
Blue: possible values Player2 etc.
Yellow: possible values Player2 etc.

Got a global key command “Rest”, which I want to only target a RestControl.

RestControl traits have some triggers, and a given trigger should only activate based on the following check: the PlayerSide that clicked rest corresponds to which value among Player2, Player3, etc., via the GPs Red, Blue, etc. That determines which pieces will be affected by more triggered global key commands.

I think I need some combination of GetProperty() and maybe $$ signs, but my sleep-deprived brain is coming up with only things that don’t work.

If the property PlayerSide contains the string Red, and the property Red contains the string Russians, then:

  • GetProperty(“PlayerSide”) would return “Red”
  • GetProperty(“Red”) would return “Russians”
  • GetProperty(PlayerSide) would return “Russians”

The last one of those is an example of how to doing the kind of indirect reference it sounds like you need.

If you needed to go ANOTHER level of indirection, imagine that a property Russians contained Communists, then:

  • GetProperty(GetProperty(PlayerSide)) would return “Communists”


1 Like

Related (I think) question: players in the game will each have a specific color (Red, Blue, etc.). How to I set up a text label to display the playerName for each color?

I guess you have realised that you will need a means of associating each label with its player, hence the question.

One relatively simple way would be to make each text label an Action Button.
Have the players click on their side’s label when they join the game.
The Action Button should trigger setting a Dynamic Property that will store the playerName, making it available to display to the other players.

The Text Label will display the value of the Dynamic Property.

You might use a Command Restriction so that only the Red side player can click on the Red side button etc.

If the initial value of the DP (let’s call it “dName”) is null you could use something like this Beanshell as the Text in the Text label -
{ dName == “” ? (playerSide==“Red” ? “Click Here” : “”) : dName }
So this would prompt the Red player (only) to click on that label.

You can use basic HTML to format the text label &/ or superimpose it on an image/piece.

By careful putting Beanshell into text labels; Vassal tolerates it but is prone to infinite loops is the beanshell is invalid.

Hope that helps.


Thanks! That mostly works for me, except I couldn’t get the text label itself to be clickable. Instead, I had to add a graphic icon, which can be clicked. But that’s good enough!

FYI, Action Buttons default to being 40x40 pixels (IIRC) at the center of the piece; you need to change the dimensions if you want the entire piece (text label, in this case) to be clickable. I’ve found it works fine to make the Action Button bigger than the piece; it won’t actually extend past the edges no matter how large you set it.

I’d already tried that at button size 40x200 and failed to successfully click all over it! I assumed it was the funny beanshell text format that was screwing Vassal up.