Reverse Option in a Deck

3.4.11
The Deck component has a check box called “Reversible?”. If checked, it reverses the order of the cards in the deck. The check box is accompanied by the fields “Reverse Command Menu Text” and “Reverse Hot Key.” I want to be able to define the hot key (as a string) so I can reverse the deck programmically, but I don’t want to expose the command to the user. So I set the command menu text blank, and I inserted a string (e.g. reverseRedCards) in the hot key field.

It works mostly as I want, but there is a glitch here. When I right-click the deck, a blank line appears in the command list, and if I click the blank line, it reverses the deck. Apparently it’s not skipping over the blank command menu text when it composes the deck’s command list. It’s treating an empty command text field as a valid, choose-able field. Not desirable in any scenario.

(I’m working on a personal module for “Lost Ruins of Arnak,” and in it you have to shuffle a bunch of discards and put them at the bottom of an unshuffled main deck. Rather that moving them there one at a time and pushing them to the bottom, I thought I might reverse the deck, throw the discards on top, and then reverse it once again so they end up at the bottom.)

Thus spake shilinski:

3.4.11
The Deck component has a check box called “Reversible?”. If checked, it
reverses the order of the cards in the deck. The check box is
accompanied by the fields “Reverse Command Menu Text” and “Reverse Hot
Key.” I want to be able to define the hot key (as a string) so I can
reverse the deck programmically, but I don’t want to expose the command
to the user. So I set the command menu text blank, and I inserted a
string (e.g. reverseRedCards) in the hot key field.

It works mostly as I want, but there is a glitch here. When I
right-click the deck, a blank line appears in the command list, and if I
click the blank line, it reverses the deck. Apparently it’s not skipping
over the blank command menu text when it composes the deck’s command
list. It’s treating an empty command text field as a valid, choose-able
field. Not desirable in any scenario.

That’s a bug. We removed some empty menu entries earlier in the year,
but not systematically.

Try VASSAL-3.4.12-SNAPSHOT-5961bb471, available here:

vassalengine.org/~uckelman/tmp/

Does that solve the problem for you?


J.

I will try it tomorrow night. It’s not the only bug, by the way. If I blank the “shuffle” command but add a key to shuffle, it also produces a blank line in the right-click list.

I tried it tonight. It didn’t work. Adding a shuffle hot key without a menu command still produces a blank line (with shuffle action) in the right-click menu. It appears though that the reverse hot key without a menu command does work because I didn’t see a blank line for it.

The original fix correctly removed empty entries from menus, but couldn’t work as intended because some entries that should have been empty were not. Try VASSAL-3.4.12-SNAPSHOT-no_empty_menu_items-f3bcac0b3, available from the same place. Does that solve the problem for you?

No.

Ok, in that case, I need to see the module where this happens, as I can’t replicate the problem after the change in VASSAL-3.4.12-SNAPSHOT-no_empty_menu_items-f3bcac0b3. Where can I get the module?

I will post a slimmed-down demo module on Dropbox in a few hours—after double checking so I don’t look stupid. I’ll get back to you.

I just ran into this same bug, tried also with the latest snapshot mentioned above (as well as 3.2.17 and 3.4.11).

More precisely, I was not looking at the Reverse command but at the Re-Shuffle one: an empty Re-Shuffle text will show as an empty line when right clicking on the deck, and the reshuffle command key will be executed.

For comparison, the include command to send entire deck to another deck instead works all right (nothing showing if the text is empty), in all versions of the engine tested (see above).

[attachment=0]PTHreportbug1.jpg[/attachment]

I tried turning on reversible and clearing the text and there is no empty right-click menu with the latest snapshot mentioned above.

I think perhaps only the re-shuffle needs to be fixed now.

Try VASSAL-3.4.12-SNAPSHOT-no_empty_menu_items-5999fb1b3, from the same location. The code for producing menu text was duplicated in two places, which I hadn’t known before. I fixed only one of them on the first try. Now the duplication is gone. Does this work for you?

I can confirm that I don’t see the empty line for re-shuffle anymore with that latest build.

While you are at it…

It would be nice to be able to assign a command to flip a deck face up or face down. At present, contents can be set to be face down on a right click command (as opposed to “always”, or “never”) but there is no way to set a command key for it or to change/wipe out the command text (always showing as “Face up” in the right click menu).

Great. This fix went out in 3.4.12 on Sunday.

If you want to make sure this request doesn’t get lost, file an issue for it in the tracker.