Hide Game Piece Layer Control button according to player side

In my The Burning Blue module, I would like to hide a button so that the RAF player cannot press it accidentally. The button is implemented with a Game Piece Layer Control. The way to hide it should be through the ‘Global Property to disable this button when “true”’, and “Hide button when disabled”.
But I can’t find a way to set a global property to Side==“Luftwaffe” so that it changes when a player changes side.
Do anybody have a solution for this?

You can add a Startup Global Key Command and set it to apply a “Global Key Command”, “At Start of Fresh Game or Player Join/Side-Change”. You will also need a hidden piece with a Set Global Property trait, that sets your Global Property to {PlayerSide == "Luftwaffe"}; this should have the same Named Key Command that the Startup GKC sends.

Thanks! The idea of using a hidden piece had not occurred to me.

How do I implement a hidden piece? Should I place it on a map layer that is restricted to a non-existent player? Is there a way to have it placed automatically at start?

When I make a hidden piece to help with module automation, I place it in an At-Start Stack in one of the board’s margins and give the piece a Does Not Stack trait selecting “never” for Select piece, Band-Select piece, Move piece, and Piece can stack. Also, I don’t give the piece an image. So the image field is blank in the Basic Piece trait, and the piece does not have a Layer trait.

Thanks for the suggestion.

I have a problem with the At-Start Stack, because it does not show up. I tried putting into the stack a normal counter that can be stacked, and is fully visible, but that doesn’t show up either. No wonder that the Set Global Property does not work.

It appears that I have more problems than just the At-Start Stack: When I give the Global Property an initial value of “true”, it still does not cause the buttons to disappear.

Are you loading a predefined setup (i.e. scenario) in the module that pre-dated your edits when testing to see your changes? If so, you will need to use Tools → Refresh Counters–otherwise that file won’t see your new items.

Yes, I used a pre-defined setup, but I have refreshed the counters - several times (for other reasons).

Perhaps I have made some basic syntactic mistake. This is the definition of the Global Property. It belongs to the (creatively named) Main Map:

This is the definition of the Game Piece Layer that defines the button that I want to disable:

The button works fine, but I can’t disable it by setting HideFromRAF true.

{true} definitely looks wrong. This would try to return the value of a Global Property named true.

Try either true (no braces at all) or {"true"}.

I tried both, but after refreshing setups, there was no change: the buttons are still visible. :slightly_frowning_face:

Can you try in a brand-new game that doesn’t load a predefined setup at all? Refresh Counters will not touch toolbar buttons that you’ve added/modified, I wouldn’t think.

EDIT: Also, won’t you need this ticked?

Joel, that was a very good catch about the setting that enables the button to be disabled, but unfortunately it still didn’t work.

There are only pre-defined scenarios for this module, but I am sure there is some way of enabling a game without them. I’ll have to study some other module to see how it is done.

1 Like

Create a new predefined setup in the Editor, simply leave the “Use pre-defined file” checkbox blank.

Thanks, I didn’t know that a game without a pre-defined scenario is a pre-defined scenario :slight_smile:

But the button is still very much enabled.
I tried to untick the box about hiding the button, but the button is still active. The suspicion grows that this disabling through a Global Property simply does not work.

After some quick basic testing of my own, I’m inclined to agree with you. Setting the property you configure to true neither disables nor hides a Game Piece Layer Control button. This will need to be raised as an issue in Github.

I have no experience with Github, but I’ll try to find out what it is (apart from my general understanding of it).

I have another question about the Game Piece Layer buttons: is there some way of changing the button image to show when it is on or off? I have been confused myself when I have loaded a game that was saved with only planning markers showing. It doesn’t appear so directly.

I’m pretty sure that Vassal beanshell interprets true and false as boolean.

For proof, try this action button:

Yes, either true or “true” will work.

1 Like

I have created a new test build that resolved this problem. Can you try the VASSAL-3.8.0-SNAPSHOT-e09f9b9-13146-GPL-button-control (from Builds of vassalengine/vassal) and see if this resolves the issue?

Thanks.

1 Like

Unfortunately, setting an initial value of “true” to the Global Property does not cause the button to disappear.

In the meantime my module has entered an “existential” crisis because one of the maps has gone blank. But I’ll open a new thread for that.