Hide blank options from Dynamic Property lists

Since you can utilize BeanShell expressions when creating lists for Dynamic Properties, it would be helpful to be able to hide blank entries. For instance, if one of the list values was defined as {LocationName=~“Berlin|Hamburg|Munich”?“Germany”:""}, then it would list “Germany” as the value if the selected Piece was in Berlin, Hamburg, or Munich, but hide the entry entirely instead of displaying a blank value.

1 Like

You can currently do that w/ a Restrict Properties for whatever the key command or named key command is for that action, an expression for when you want it hidden.

Are you saying the Restrict Command propegates down to the Dynamic Property lists that are generated when you choose “Prompt user to select from list”? I’ve never noticed that, but I haven’t explictily tested for it either…

It should hide anything on the piece that has a key command assigned. If it doesn’t, let me know!

I had a look at this and I logically I don’t see any way this could possibly be implementing. The Restrict Command hides an entire key command, not each list entry. For instance, let’s say CTRL-D deploys a new unit in Germany. If I want the player to be able to choose the deploy location, I’d create a Dynamic Property called DeployName that is initiated by CTRL-D. The Type is “Prompt user to select from list”. There is no key command associated with each entry on that list. Therefore there is no way Restrict Command can affect each of those list entries other than hiding the entire CTRL-D command, which is not what I’m asking for. If the list consisted of the entries Berlin, Breslau, Hamburg, Königsberg, and Munich but Breslau and Königsberg were illegal choices based on whatever expression, I’d want the list to show “Berlin, Hamburg, Munich” but presently it displays as “Berlin, , Hamburg, , and Munich”. It doesn’t affect play but it’s an ugly UI thing.

1 Like

I’m revisiting this request because it would be very useful in many of the modules I’ve created and it seems I was unable to convince the developers that Vassal doesn’t already do this.

For Dynamic or Global Properties, when a command changes the value and the user is prompted to select from a list:

The list varies because I use expressions for each entry. Some of the entries are blank, as seen here while running the module:

image

I would like to be able to hide those blank entries so the user cannot see or choose them.

1 Like

I would like to see this feature too. This could be very handy in economic games where the list of possible choices throughout the game might be more than twenty, and the likely number of these choices available at any one time would be closer to five. That would be a lot of blank spaces, and some of the currently viable choices might require scrolling to find.

Could this be implemented using an expression that results in a string with each choice being a substring ending with a separation character and allowing the module designer to specify the separation character?

The feature would be:
The module editor allows the user input choices to be an expression resulting in one continuous string of choices each separated by a special character, and the module editor has another field for the designer to enter the separation character in parsing the string into a list separate choices.

For example I’ll borrow from m3tan:
Possible choices throughout the game are: Berlin, Breslau, Hamburg, Königsberg, and Munich. So the module designer creates an expression, let’s call it ChoiceExpression to contain a string of the choices available at that point in the game each separated by a given character.
So the module editor has a field for ChoiceExpression and field for the separation character.
For the example let’s say the separation character is an underscore “_”.
When all the possible choices are valid ChoiceExpression would result in: “Berlin_Breslau_Hamburg_Königsberg_Munich”
and the user would see the choices displayed as:
Berlin
Breslau
Hamburg
Königsberg
Munich

When the valid choices are: Berlin, Hamburg, and Munich ChoiceExpression would result in: “Berlin_Hamburg_Munich”
and the user would see the choices displayed as:
Berlin
Hamburg
Munich

IIRC, this PR does what you’re looking for, but we weren’t able to satisfy ourselves that it wouldn’t change behavior on which someone was depending.

I’ll add a +1 to the request. I think* it would justify a backward compatibility option but the more usual requirement imo is what has been requested. *with zero knowledge of the overhead/complexity this introduces.

The workarounds I’ve used include (a) looping around again if the blank option is selected and (b) substituting a valid value, even though it duplicates something already in the list.

1 Like