# Send Key Command to cards in a Deck

**URL:** <https://forum.vassalengine.org/t/send-key-command-to-cards-in-a-deck/3035>\
**Category:** Module Design\
**Created:** [June 16, 2010, 2:10pm UTC](https://forum.vassalengine.org/t/send-key-command-to-cards-in-a-deck/3035 "2010-06-16T14:10:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angel40k](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@Angel40k](https://forum.vassalengine.org/u/Angel40k)\
**Post date:** [June 16, 2010, 2:10pm UTC](https://forum.vassalengine.org/t/send-key-command-to-cards-in-a-deck/3035/1 "2010-06-16T14:10:31Z")

</div>

Is it possible to send a Key Command to cards in a Deck?  
And if yes, how to do it?

Many thanks for your help  
Frederic

---

<div class="post-metadata">

**Author:** ![DrNostromo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/drnostromo/32/12593_2.png) [@DrNostromo](https://forum.vassalengine.org/u/DrNostromo)\
**Post date:** [June 16, 2010, 2:41pm UTC](https://forum.vassalengine.org/t/send-key-command-to-cards-in-a-deck/3035/2 "2010-06-16T14:41:37Z")

</div>

You have to have something to send the command …button, another game piece, menu options, etc.

On the triggering piece, you would use the Global Key Command trait. In this trait, you would enter the GCK that you wish to send to the deck. You would then use the Matching Properties entry to direct where you want the command to go.

Example:  
You have a card deck called DrawPile.  
It resides on a map window called CardTable.

You would send the command to

CurrentMap = CardTable && DeckName = DrawPile

If you want to affect a specific card, you can add the card’s name as BasicName…

CurrentMap = CardTable && DeckName = DrawPile && BasicName = Joker

You can select multiples of a certain type of card by using markers. Let’s say we’re talking about a standard deck of cards. Each of these cards have the marker trait - Suit = Hearts, Clubs, etc. If you want your command to affect only the Clubs, you property filter would be

CurrentMap = CardTable && DeckName = DrawPile && Suit = Clubs

You can also use variables. Let’s say you want a command to affect all of a random suit. Let’s say you have a Random Text Button that’s used to determine the Random Suit and you named this button RandomSuit. You can then use the following to send a command to the deck affecting the roll result:

CurrentMap = CardTable && DeckName = DrawPile && Suit = $RandomSuit\_results$

Does that help?

---

<div class="post-metadata">

**Author:** ![cparrott](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@cparrott](https://forum.vassalengine.org/u/cparrott)\
**Post date:** [June 17, 2010, 2:44pm UTC](https://forum.vassalengine.org/t/send-key-command-to-cards-in-a-deck/3035/3 "2010-06-17T14:44:00Z")

</div>

In addition, global key commands have a field that affects decks. By default  
it’s set to none, but has the option to affect all pieces or a designated  
number of pieces. Depending on how you want to affect the deck, you’ll need  
to set this. For example, if you wanted to draw a specific card in a  
shuffled deck you would set it to all pieces since you don’t know where the  
card is in the deck. You would then use a filter to select the card by name  
or property as Dr Nostromo described.

Post generated using Mail2Forum ([mail2forum.com](http://www.mail2forum.com))

---

<div class="post-metadata">

**Author:** ![DrNostromo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/drnostromo/32/12593_2.png) [@DrNostromo](https://forum.vassalengine.org/u/DrNostromo)\
**Post date:** [June 18, 2010, 2:28am UTC](https://forum.vassalengine.org/t/send-key-command-to-cards-in-a-deck/3035/4 "2010-06-18T02:28:22Z")

</div>

Yeah, thanx for pointing that out. It crossed my mind when I was posting my original message but apparently is slipped out the other ear before I had a chance to include it.

---

<div class="post-metadata">

**Author:** ![Angel40k](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@Angel40k](https://forum.vassalengine.org/u/Angel40k)\
**Post date:** [June 18, 2010, 7:06am UTC](https://forum.vassalengine.org/t/send-key-command-to-cards-in-a-deck/3035/5 "2010-06-18T07:06:21Z")

</div>

Many thanks for the help.

In following your instructions, I have always the problem but I think now know why.

In fact I use a lot of prototype definitions in the module. It seems that the Key Command defined in the prototype does’nt work when I use the Global Key Command or Deck Global Key Command to send the action to execute to a subset of the cards in the deck.

I don’t understand why because the key command work correctly when I use it in selecting the pieces.

To solve the problem, I have copied the definition of the “Send Location” trait in the cards to affect with the Global Key Command.

Best Regards  
Frederic

---

<div class="post-metadata">

**Author:** ![DrNostromo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/drnostromo/32/12593_2.png) [@DrNostromo](https://forum.vassalengine.org/u/DrNostromo)\
**Post date:** [June 18, 2010, 1:30pm UTC](https://forum.vassalengine.org/t/send-key-command-to-cards-in-a-deck/3035/6 "2010-06-18T13:30:48Z")

</div>

GKC’s should work in a prototype without a problem.

If it’s not working in a prototype, it may be some other factor or the trait order or something that isn’t apparent that’s causing the problem.
