Create account / Log in
Bug 13145 - Send Hot Key ignored by Deck
Send Hot Key ignored by Deck
Product: VASSAL
Classification: Applications
Component: Player
Macintosh Mac OS
: unspecified normal
: 3.5.4
Assigned To: Joel Uckelman
Depends on:
  Show dependency treegraph
Reported: 2020-07-03 13:39 CEST by Mark Benson
Modified: 2021-03-26 21:12 CET (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Mark Benson 2020-07-03 13:39:41 CEST
This problem exists also in previous Vassal versions.

The problem:-

A module can have multiple decks sharing the same command key to trigger a re-shuffle (the "Send Hot-Key"). However, only one of the decks will actually respond to the command key and be re-shuffled to its target deck.

This bug prevents automation of the re-shuffle action for one or more decks sharing a common Send Hot-Key.

Example - Commands & Colors Napoleonics, v3.42.

To recreate using the example module;

1. Start any of the preset scenarios and any command deck option, along with the Tactician deck. 

2. draw and discard a card from each of these decks.

3. Observe how the right-click menu for each deck presents a reshuffle option, both keyed to "ALT CTRL SHIFT L".

4. Try pressing ALT CTRL SHIFT L on the leftmost discard pile (Command Deck). Observe that it has no effect.

5. Repeat with rightmost discard pile (Red/tactician deck). Observe that the deck is reshuffled.

6. repeat step 2-5 but this time simply select the right-click menu option, observe that it performs correctly in both cases.
Comment 1 Stewart Webb 2020-07-20 11:00:58 CEST
Having a look at this, it looks like "Send Hot-Key" creates a Global Hot key, these are overwritten on build (which is why you get only one working), assumedly this is a design choice as-to not make the global hot keys messy, and be able to update them dynamically, if desired... So changing this, would risk breaking other modules.

I've been trying to figure out an alternative method for you, which at the moment, I'm feeling will be something along-the-lines-of defining unique global hot keys for left and right discard piles, then having a separately defined global hot key which will execute a sequence of global hot keys assigned to the left, then right discard piles.

@more knowledgable VASSAL devs: please correct me if I'm talking complete garbage here.
Comment 2 Mark Benson 2020-07-20 15:39:08 CEST
Thanks for looking at this Stewart.

I hadn't appreciated that distinct features of Global Hot Keys compared to an ordinary right-click command key. 

The solution that I found to my requirement was to put a "send to deck" (targeted on the draw deck) command on each card with a hidden command-key combination.  Then I have a global key command to send that command to  the Discard Pile whenever I need to trigger a shuffle.

This problem report is now less important to me but I think it shows that it would be useful to be able to "Refresh" the properties of a Deck using the "Refresh Counters" function, as we have a situation where an error in preset scenarios cannot be corrected except by rebuilding the entire set of scenarios.
Comment 3 Stewart Webb 2020-07-20 16:14:18 CEST
So I've had a look at GameRefresher.. and it looks like it *should* refresh all Deck GamePiece's currently loaded... without me reading over it more than once..

I can see that you would probably have to load each vsav file, then save them and put them back in the module...

Are you asking that the GameRefresher also loads (and saves) all .vsav files in your module? Or is the refresher not refreshing the Decks properly after you load the save?
Comment 4 Stewart Webb 2020-07-20 16:54:21 CEST
Having another look at the code, there might be a clue commented in the header of this file:
Note: Counters that are Hidden or Obscured to us cannot be updated.

I assume this means theModule.getGameState().getAllPieces() might not get hidden items..

Having seen your module, it has buttons so the user can add the Decks they want, so assumedly they could be hidden... that could be why this is happening.

This might be worth opening another bug for, to be honest.

I'll do a bit more digging when I get some time.
Comment 5 Mark Benson 2020-07-20 22:02:35 CEST
The issue is not the pieces within the decks. Yes, the Refresher does deal with them. 

However, so far, I have been unsuccessful in propagating any changes to properties of a DECK  (or At-Stack Stacks, proper for that matter.
Comment 6 Mark Benson 2020-12-16 23:53:55 CET
It is possible to define the same Hot Key on multiple decks but only one will work. A further issue arises once a module has got pre-set scenarios, because it is not possible to change Deck properties and propagate those changes to the pre-set scenarios. Hence this tickets is linked to 13824 for a fix to the later issue.
Comment 7 Mark Benson 2021-03-12 12:32:34 CET
New information:

I was mistaken to infer that a duplicated hot-key would not reshuffle both decks.

In fact, only the manual keyboard hotkey is affected. If the Global Hotkey trait provides the keystroke then both decks sharing that hotkey are shuffled.