# Want to hide text label from one side or other

**URL:** <https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347>\
**Category:** Development\
**Created:** [April 4, 2024, 2:15pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347 "2024-04-04T14:15:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/matt/32/9045_2.png) [@Matt](https://forum.vassalengine.org/u/Matt)\
**Post date:** [April 4, 2024, 2:15pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/1 "2024-04-04T14:15:30Z")

</div>

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](https://forum.vassalengine.org/uploads/default/original/2X/9/90a754336a5019886b204afcfa28d8eedb06a871.png)

Can I do that?

The text labe properties look like this

 ![Screenshot 2024-04-04 at 7.10.49 AM](https://forum.vassalengine.org/uploads/default/original/2X/2/2bdd9ae9073de1de71b55c510ac19f9bd239ea93.jpeg)

I have a nationality set on the piece

 ![Screenshot 2024-04-04 at 7.12.53 AM](https://forum.vassalengine.org/uploads/default/original/2X/6/6dd86d78e7620f32859a3929ed6903434b8cdf56.jpeg)

And I can compare that with the PlayerSide

 ![Screenshot 2024-04-04 at 7.13.59 AM](https://forum.vassalengine.org/uploads/default/original/2X/1/1064c95a8cf919782f23056999c95e44d502804e.jpeg)

Any help would be appreciated.

I tried Restrict Commands and Invisible

---

<div class="post-metadata">

**Author:** ![marktb1961](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/marktb1961/32/231_2.png) [@marktb1961](https://forum.vassalengine.org/u/marktb1961)\
**Post date:** [April 4, 2024, 3:23pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/2 "2024-04-04T15:23:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JoelCFC25](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/joelcfc25/32/2687_2.png) [@JoelCFC25](https://forum.vassalengine.org/u/JoelCFC25)\
**Post date:** [April 4, 2024, 3:25pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/3 "2024-04-04T15:25:12Z")

</div>

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](https://vassalengine.org/doc/latest/ReferenceManual/PropertyMarker.html#top) 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.

---

<div class="post-metadata">

**Author:** ![Matt](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/matt/32/9045_2.png) [@Matt](https://forum.vassalengine.org/u/Matt)\
**Post date:** [April 4, 2024, 10:06pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/4 "2024-04-04T22:06:24Z")

</div>

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

 ![Screenshot 2024-04-04 at 2.16.20 PM](https://forum.vassalengine.org/uploads/default/original/2X/e/ec7d7030f77159da705a43b88b086a660cd36665.jpeg)

Central Powers View

 ![Screenshot 2024-04-04 at 2.16.09 PM](https://forum.vassalengine.org/uploads/default/original/2X/e/eac074b2dbe72276a7c56077fd820ca4e40e7ef4.jpeg)

---

<div class="post-metadata">

**Author:** ![Korval](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Korval](https://forum.vassalengine.org/u/Korval)\
**Post date:** [April 5, 2024, 7:59pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/5 "2024-04-05T19:59:29Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![dsmith71](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/d/48db29/32.png) [@dsmith71](https://forum.vassalengine.org/u/dsmith71)\
**Post date:** [April 5, 2024, 8:52pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/6 "2024-04-05T20:52:11Z")

</div>

**@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 🙂

Darren

---

<div class="post-metadata">

**Author:** ![Matt](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/matt/32/9045_2.png) [@Matt](https://forum.vassalengine.org/u/Matt)\
**Post date:** [April 10, 2024, 3:56am UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/7 "2024-04-10T03:56:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lebatron](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/l/958977/32.png) [@Lebatron](https://forum.vassalengine.org/u/Lebatron)\
**Post date:** [April 18, 2024, 2:27pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/8 "2024-04-18T14:27:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matt](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/matt/32/9045_2.png) [@Matt](https://forum.vassalengine.org/u/Matt)\
**Post date:** [July 12, 2024, 4:20pm UTC](https://forum.vassalengine.org/t/want-to-hide-text-label-from-one-side-or-other/79347/9 "2024-07-12T16:20:03Z")

</div>

Hey Lebatron. It is for Avalanche Press Great War at Sea: Jutland 2e. But they are only available to owners of the physical game (their IP so if I want to do the modules, I have to respect that)(Although I am trying to get them to let me release a cut down version of Coral Sea so that I can show this off and get people started on the Vassal Modules and maybe they buy the physical game. )

I don’t get out much, to see many modules, but these are great. we have (old style) Midway, Coral Sea, South Pacific (Solomon Islands Campaign), Java Sea, Eastern Fleet (Ceylon strike in early 1942), Bismarck and Russo Japanese War.

New style we have Jutland 2e (and extensions for North Sea 1914 and Dogger Bank 1915), and Remember the Maine.
