More Deck Dealing Challenges

So, I have been following the instructions in this post: http://www.vassalengine.org/forum/viewtopic.php?f=6&t=1558&hilit=deal and all is fine to a point…

I want to deal out from one deck to a number of positions on a map (Merchant) exactly as in the example used in the thread: i.e. a set number of random cards laid out next to each other. I have a couple of extra layers of complexity though. I want to deal up a set number of each card type, but still randomly within each cardtype. In other words I am ammending this piece:

Global Key Command
Description: Deal Cards
Keyboard Command: CTRL 1
Global Key Command: CTRL 2
Matching Properties: CurrentMap = (the map where your deck is) && DeckName = (the name of the deck) && CardType=Improvement
Within a Deck, apply to: 5 pieces

This also works fine, but only if all the cards in the deck are the right CardType. Basically the incrementer seems to keep counting even the excluded cards, so I might get 5 Improvements, but only if the top 5 cards happen to be that CardType. If only 3 of the top 5 cards are Improvements, I’ll only get 3. I want to get 5 however, no matter how far down the deck the programme needs to look, and then I will call for another 5 of a different CardType, etc. Can anyone tell me what I am missing here?

In terms of the logic, traits etc I used the same as in the link above, though with some slight differences in the actual shortcuts (CTRL 1-3 cover the incrementing, Alt Shft D, Shft D, Alt D cover action/trigger, GKC, and reporting it respectively. CTL-R resets the counter).

My traits are ordered as follows (top to bottom on the actual button):
Basic Piece
Does not Stack
Action Button
Trigger
Set Global Property
GKC
Report Action

You’re not missing anything, really. When you specify a set number of cards, Vassal will only check the number of cards specified. That’s just the way Vassal works.

What you can do to solve this is create a temporary deck that’s empty. Send a command to the original deck to move all cards over to the temporary deck that have the trait CardType = Improvements. Then send a command to draw the 5 cards you need from the temporary deck. Then send a command to the temporary deck to send all cards back to the original deck. You don’t have to worry about whether you really have the real estate for another deck as this will all happen so quickly, you’ll never see the temporary deck.

Does that make sense?

I think I could manage that, I’ll give it a crack…

I just can’t get this to work. I can send the wanted cards to a temporary deck “Dealer”, and I can deal the desired number of random cards to the slots, but I just can’t get the cards that are not used sent back to the original deck “CorePack”. This is driving me nuts, because I have a shortcul (ALT-Z) which if I use the keyboard, does send the unwanted cards back to CorePack. However, when I call from the trigger, it doesn’t work, either if I call Atl-Z directly, or if I call a GKC and apply Alt-Z to the “Dealer” deck. This is the second to last command called by the trigger (the last is a report action) and the only one that does not appear to fire. Is this a sequencing issue?

Alt-Z (send cards to “CorePack”) is held on a Prototype for all the cards as a Return to Deck Trait. They also have another Return to Deck Trait called by Alt-A (sends cards to “Dealer”). Although these seem to be identical to me, I can call and execute Alt-A from the trigger, but Alt-Z, which comes further down the list of trigger actions, doesn’t seem to fire.

Can you send me the mod? I’ll take a look at it.

I’ve dropped you a note - or at least I have tried. PM system behaving wierdly so if you receive nothing please let me know!