Define [piece trait - border outline] depending on player

Hello people,

I’m currently updating a personnalised Vassal module.
Previously, army pieces border outlines were directly in the imported png images of the pieces, which isn’t great when two players want to play the same army pieces.
Now, I’m looking to make generic (no border) pieces now, and defining border outlines depending on the player.
Here is my question : is there a way to globally define piece border outline depending on the player selecting its pieces ?
Or it is necessary to define border outline in every piece traits ? If so, what would be the good [property name] formula to do so ? Something like {player == “PLAYER 1”} for each player available ?

Thanks for reading me, have a nice day,
Smeagol

Seeing the lack of answers, i’m wondering if i used the proper tags…
Can at least someone tell me if this is okay :

  • in “Game Piece Prototype Defnitions”, I created one with army border outlines prototypes
  • For each prototype, I changed the color and put $PlayerSide$==“Player X”
  • I associated this definition with every game piece.

Is this a good thing to do ?

thats what I do

1 Like

Thank you for your answer !

However i don’t see border outlines on my pieces, even while changing border outline thickness.
I removed spaces in playersides names to be sure. Is the “property name (optionnal)” of my “border outline properties” correct like this :

  • $PlayerSide$==“PlayerX”

?
I made a prototype with a different color for each playerside using this formula, and put this prototype in every game piece, I don’t see what i’m missing…

Your syntax is off; it should be either:

  1. PlayerSide=PlayerX (or $PlayerSide$=PlayerX; the “$” are optional on the left side of the =, if I remember correctly); this is the “old-style”, less powerful syntax;
    or
  2. {PlayerSide == "PlayerX"}; this is BeanShell syntax. BeanShell is more powerful and allows for advanced expressions, but you don’t actually need it here.

Note that either way, PlayerX must match the name of the player side exactly, including any spaces and capitalization (and PlayerSide must match this exactly, too).

1 Like

What do you mean by

(and PlayerSide must match this exactly, too).

?

I tried without expression, it works (even if the border is a rectangle while i would like circles, but i’ll check on this later).
However, I tried many expressions, can’t make it work. I used simple letters as playerside names, and tried these :

  • playerSide=A
  • PlayerSide=B
  • $playerSide=C
  • $PlayerSide=D
  • $playerSide$=E
  • $PlayerSide$=F
  • {playerSide == “G”}
  • {PlayerSide == “H”}
  • {playerSide==“I”}
  • {PlayerSide==“J”}

None of these work for me. I just feel dumb, wasting everyone time. Does anyone have any idea ?

Where exactly are you entering those expressions? The Border trait doesn’t want expressions. The only thing it accepts is a property, which I find to be a pain in the butt. If you are writing an expression where it expects a property, then it will never work.

Also, a LOT of people like to play games solo even if it means hotseating between sides. In many of my mods, I include a solo player side just for them. If you trigger on PlayerSide, you are cutting them out of the fun.

2 Likes

Good thing, now i can include captions, it will make the communication a lot easier.
What i’m doing :


Is it, as you say, not an “expression-required” field ? How should i do it, then ?

As for the “solo playing”, i’m simulating a wargame which isn’t fit for being played solo. Yet, your remark is valid. I’ll see what i can do.

I suggest you press the “aide” button, which is at the bottom of the Border dialog box. It will explain where you went wrong.

To get this to work, you must define a property—global, dynamic, calculated, which you will provide to Border. It will need to do something like this:
ThisNewProperty = PlayerSide == “player 1”
How you do this depends on the type of property.
Notice that according to the documentation, it must have a true or false value.

1 Like

YEEEEEEEEEEEEEEEEEEEEEEES !!!
You are right, that was the problem. I defined a Calculated property using the exact syntax you say, then I used this property in the border outline optionnal property. It works perfectly fine !!
THANK YOU VERY MUCH :heart_eyes: