Shuffle Button

Hello all!

I’m having a problem with something I thought would be simple, but I’ve been not having luck. I want to create a button that will shuffle a deck of cards, so I don’t have to right click and choose re-shuffle.

I have the re-shuffle hotkey set to alt ctrl s

I created a Global Key Command named Shuffle:
Key Command alt ctrl s
Within a deck: apply to all pieces

However the button is not working! After several different attempts and variations I decided to ask for help again.

Thanks in advance!

How do you know it is not working? Put something in the Reshuffle report such as “Test” to verify which you can see in the chat window. Try hitting your hotkey to verify it does as well - Start from there, see what working, whats not

I know its not working because there are many different masks for the deck. If I use the alt ctrl s hotkey, I can see the top card change to a different mask. When I use the button, it stays the same even after hitting it over and over again. Currently there are only 5 cards with 2 different masks, so after several hits (10 to 15) it should change :slight_smile:

Forgot to mention that the hitting alt ctrl s does do its job and shuffle the deck. I thought I had mentioned that in my original post, but in re-reading, I notice I hadn’t.

Although this post is a year old, I just had this same problem. I thought I’d post the solution in detail.

Suppose the deck is set with a Re-shuffle Hot Key = ALT-CTRL-S. You want a Global Command Button to shuffle the deck.
It turns out you need an intermediate piece to do it.
Create a piece with the following properties:

Mask: shuffler=1
Global Hotkey: Keyboard Command=ALT-SHIFT-S, Global Hotkey=ALT-CTRL-S

Then you can set your Global Command Button as follows:

Key Command: ALT-SHIFT-S
Matching Properties: shuffler=1

Interesting - I’ve never done much with Global Hotkey, but it’s good to know it can fire off the shuffle command. I wonder if it works for reverse as well?


Indeed, it does work for reverse! Just a note, the key is the Global Hotkey trait. It can be triggered by a Global Key Command button, but it can also be triggered in other ways - for example, with the ‘send command to pieces ending movement’ map property, or by other traits, i.e. Trigger Action, on the piece. I believe the global hotkey sent by an empty deck should work as well, but I haven’t tested it.

Thank you, dogboy, for posting the solution, even though the thread was very old. It can be very frustrating to do a web search and find only unanswered forum threads!

However I’m afraid I’m still new to Vassal and don’t quite understand everything. Perhaps someone can explain the solution to me.

When you say create a piece with Mask: shuffler=1, what does that mean? When I create a new Mask for a piece there are many fields. Do I put Shuffler=1 as the name of the mask? What do I do about the image? And does this piece have to be an existing piece on the board or can it be a “dummy” piece that never exists?

Next you say to make a “Global Hotkey” but I only have a “Global Key Command.” Is that the same thing?

Finally the instructions say to set a Global Command Button. Is that the same as the “Global Key Command” listed in the main menu?

Thanks for your help, I am looking forward to getting this button working!

I think dogboy meant to say you would use a Marker with name: shuffler, value: 1. However, all you need to get this working is some piece with a Global Hotkey trait. You can then trigger the piece many ways - with a Global Key Command toolbar button, with a right-click menu entry to trigger the shuffling - basically, any of the ways that you can trigger a Trait on a piece. The Mask property is unnecessary.
Here’s one outline you could use:

  1. Add a ‘Global Key Command’ to your main map. Set ‘Key Command’ to, say, CTRL-ALT-A, and set ‘Matching Properties’ to ‘BasicName = Shuffler’
  2. Add an at-start stack and a piece to the map containing the deck you want to shuffle. Name the piece ‘Shuffler’.
  3. Add a ‘Global Hotkey’ trait to the Shuffler piece. ‘Keyboard Command’ should be CTRL-ALT-A, and ‘Global Hotkey’ should match the keyboard shortcut you set on the deck itself.
  4. Profit.