Disabling a button causes it to grey-out, not disappear.
As I understand it, not in this case. There is an option to “Hide button when disabled”.
It seems that Brent’s new version has removed the option to hide the button, but the button is not greyed out, and I also checked that the button function works.
Hide button was a v3.7beta change that had to be reverted as it caused other button problems that couldn’t be resolved. Seems like GPL still had that half implemented.
Yes, Hiding buttons is not implemented in current Vassal, only disabling.
Given that, does the proposed fix resolve the problem?
Thanks.
No, unfortunately not. As I wrote in my previous post, the button was not grey, and i specifically checked that it still worked, i.e. it was not disabled.
I had given the Global Property an initial value of true, and had not changed it. However, I have no way of knowing if it actually has the value of true. If not, this could also be the root of the problem.
I wonder if there is a minimal module that could be used to demonstrate such bugs in a way where we can be sure that nothing else in the module affects the behaviour of a bug.
Let me offer a suggestion for displaying the value of a global property. I use an Action Button component of a map to display a global property in that map’s tool bar. I just include the property in the button text and maybe give the button a description.
I’m currently developing an 18xx module where players sometimes act as investors and other times as companies which they direct. To help keep tabs on this my module has a Global Property named “ActiveEntity” and the value is the name of the player or company that is currently acting. To help make the display a bit more noticeable I added some html formatting: "<html><span style=background-color:#a5f3f3ff;font-size:22;font-weight:bold;> "+ActiveEntity+" </span></html>"
Other than the description and the button text, everything else is blank:
There are other ways to display property values, but this seems pretty quick and easy to me, especially if you don’t add any html formatting.
I did create a minimal module that both reproduced the problem in current Vassal and resolved the issue in the new version.
If you use changeable text labels in any counter, then just add $GPname$ to the text. Or create a dummy counter with a text label and add it to your game.
Thanks to you both for the suggestions.
I created a blank counter with the label text <$HideFromRAF$>, and I gave the GPL an alternative button image for when the button is disabled.
The button was not disabled, The counter label showed , so the GP should have resulted in the button being disabled.
Interestingly, in the official 3.7.8, the counter shows <{true}>, so either the value is different, or the display representation of is altered in the beta.
By the way, is there a possibility that the GP is defined after the GPL, so that the value was undefined when the GPL was evaluated? The order of the definitions is so that the GP comes before the GPL.
The counter label showed what exactly?
In your beta build it showed
true
In 3.7.8 it showed
{true}
STOP PRESS! I have solved this problem with the beta version!
I wondered why there was no effect from the Global Property, and then I thought that perhaps the Game Piece Layer Control could not find the GP. I then moved the GP from map level to module level, and then it works!
I thought of this solution when I had another problem with a GP that could not be located even though I specifically indicated that the GP was in the main map. It seems that GPs should always be located on the module level.
Thanks, Brent for the beta version. I look forward to the final version!
Just for the record, this appears to only work for async or solo play. I thought this was a viable solution until testing revealed it doesn’t work for live play.
Is there any possible link here to @cholmcc’s post last week? He was doing some live connected testing to run down a zone highlighting issue and appeared to be finding changes in certain Global Properties not being seen on the other connected machine.
Off-hand - no. The issue addressed by the pull request, that has since been merged, was when the property was in a Zone - not in a Map, as @steenkh seems to indicate was the case.
I suspect that @steenkh may not have configured the Set Global Property trait properly - specifically Locate Property starting in the, or that the Global Key Command was a module level key command, and so the map level defined property to inhibit that would not have been seen by the module Global Key Command (property searches go up the hierarchy: piece→(deck)→zone→board→map→module).
Yours,
Christian
Note, in a Action Button or Global Key Command if you enable the Toolbar button can be disabled by a property, then the you should give a property name in Global Property to disable this button when “true” - not an expression.
Also the property you name in Global Property to disable this button when “true” must be visible at the same level as the Action Button or Global Key Command. Thus, if you add these to the module, then the property must also be visible to the module (e.g, it cannot be a Map Window or Zone property. Also note that the button will be disabled when the property evaluates to true - hence the name below of NotRAF.
The easiest way to set this up is to define a Global Property, and attach a Change Property Toolbar Button to it.
Consider that we have the Global Key Command “RAF-Action”, and we want to disable that if the CurrentSide isn’t RAF or the current phase (defined via a Turn Counter) doesn’t contain the sub-string "RAF". We have
- Global Key Command
- Button Text:
RAF-Action - Toolbar button can be disabled by a property:
true - Global Property to disable this button when “true”:
NotRAF
- Button Text:
- Global Property
- Name:
NotRAF - Is numeric:
true - Initial value:
false - Change Property Toolbar Button
- Hotkey:
checkRAF - Type: Set value directly
- Expression:
{CurrentSide != "RAF" || !Phase.contains("RAF")}
- Hotkey:
- Name:
When the command checkRAF is fired - for example from a Turn Counter hotkey, then the expression sets NotRAF to true if the CurrentSide is not RAF or if the current phase name does not contain the substring "RAF".
with this set-up, you don’t need a “hidden” piece on the map.
Yours,
Christian
It is very likely that the Global Key Command was a module level key command, and that the map level defined property to inhibit it would not have been seen by the module Global Key Command.
If this is a reply specifically to my post, the issue is simpler: jrwatts’ suggestion probably works fine when it changes the GP on a player loading a log, as in an async game, but in a live game there’s nothing keeping track of which player is active when using a Startup Global Key Command set to apply a “Global Key Command”, “At Start of Fresh Game or Player Join/Side-Change”, so the GP remains stuck on true for one PlayerSide and not the other.
