Want to hide text label from one side or other

I have a module where i have damage listed on the counter front of a ship. I want that Text Label to be hidden for opponents. Just that Text Label.

Screenshot-2024-04-04-at-7.06.19 AM

Can I do that?

The text labe properties look like this

I have a nationality set on the piece

And I can compare that with the PlayerSide

Any help would be appreciated.

I tried Restrict Commands and Invisible

You will need to be able to identify the ship counters by Side - e.g. with a Marker trait, or maybe in the name of the piece.

If you have got such a side id, you can then check the PlayerSide in the Text Label. For example, if you have a Marker called Side that contains the name of the Side owning the counter, this Text label will only display to the Player on that Side.

{PlayerSide == Side ? localHull/10 : ""}

If your module has a moderator or solitaire side then you may need something like this, allowing whatever those PlayerSide name are:
{PlayerSide == Side || PlayerSide == "Solitaire" ? localHull/10 : ""}

This suggestion takes advantage of the fact that the Label text field will accept Beanshell, even though it lacks an Expression Builder.

2 Likes

Couple things I note:

Use Calculated Properties sparingly, as they have performance impacts. If you just want to assign a text string as a property of a piece and it won’t change, the Marker trait is ideal.

Restrict Commands is to conditionally hide/block the ability to execute a key command, not conditionally display the contents of a Text Label. In this instance you have a menu command (hideHull) assigned to what would be the feature that lets you change the content of a Text Label, but no key command assigned, so that won’t currently work. Your Restrict Commands has no key commands listed to be hidden anyway, so it’s non-functional as well. If you set a key command on the Text Label and put that same key command as the thing to be hidden by the Restrict Commands trait, all you’d accomplish is block one player from being able to change what the contents of the Text Label shows, not display it to one player but hide it from the other.

2 Likes

Your advice was perfect. Thank you.
It took some fiddling but this is what I ended up with.

In the text label for the localHull I ended up with
{PlayerSide != “Entente” ? localHull+“/10” : “”}
Since there are Solo, Umpire, Central Powers, and Entente I just disallowed the enemy side to allow the others

I also restricted the commands for the enemy player so now one side, Solo, and Umpire can interact with the units but only the enemy cannot nor see the hull values.

Thank you. Spot on.

Entente View

Central Powers View

2 Likes

FWIW - IMHO, this is the kind of thing that should be captured in a “Module Design Pattern” document.

I can see a future use case for something like this, but by the time I need it, finding it in the forums may be problematic…

2 Likes

@Korval

A library of sample modules that demonstrate this sort of thing would go a long way to reduce the learning curve. Contributions could be made by designers and stored here online in the Modules section. I have found that a sample Module makes things so much clearer than written explanations and less time wasted for all. Just my 2c :slightly_smiling_face:

Darren

2 Likes

I agree a module that shows good design patterns. I would help with that.

1 Like

What you guys just said is exactly what I was thinking. This concept here is something I may use and so I was going to ask what game this is so I can download and explore the design to learn from it.