How to reveal hands?

Hey guys,

I’m pretty darn new to creating Vassal modules, so I wasn’t sure how easy revealing cards from hands would be to enable. I want to make it so that players can reveal their hands, or maybe just individual cards if they want to.

Thanks in advance!

My efforts in searching deeper were rewarded with the suggestion to create a shared hand, visible to all players.

But what if you just wanna reveal it to one player?

You might wanna try programming Vassal modules with the module editor (not with Java). I’m attempting to redo the Pandemic module. It’s a fast game, 1 hour at most to play with board pieces. But after I automate it (within the next 2 days), it will take 15 minutes to play each game.

You may want to use the Pandemic module to see how Vassal programming can be done. I’m gonna be working with the latest Vassal (v3.2 trunk), and showing off all the bells and whistles possible with the latest-and-greatest Vassal.

Basically, every game piece will have functions (behaviors). Within each function, you can have if-else blocks, and even for-loops.

All programming is done via “Traits” for each and every game piece. One Trait you must know well is the TriggerAction trait.

If you are a programmer, think of a Trait as a single line of code. 2 Traits is 2 lines of code.
To do function names: use TriggerAction (v3.2, use the trunk)
if-else: use TriggerAction
for-loops: use TriggerAction

So, yeah. TriggerAction is your flow control, pretty much.

Believe me, even if you’re not a programmer, you’ll get the hang of Vassal programming within a day or 2.

Just remember this!! The flow control flows “bottom up”. Just reverse your way of thinking and reading to go from bottom up.

There’s probably a traditional reason for this “bottom up” thing. “Traits” probably used to be just that — traits of game pieces. The first trait (top one) is the trait that is the most primal, or basic, or fundamental. This first trait will override any other traits that are less fundamental (below). Eg, having 2 Traits that set the name of the game piece will mean only the top trait taking effect. Hmm. Sounds like I may have gotten the history wrong.

Anyways, it works. You can do very complex programming and logic with Vassal.

If you’re a programmer, note one caveat. Don’t do re-usable functions. None of the functions (done with Traits) are re-entrant. There is no stack (since there are no array data structure) in Vassal programming. Hence, no re-entrant functions possible. Well, this isn’t entirely true. You can actually create linked lists and stacks in Vassal, but that is pretty clunky to do.

I’m not a programmer, and thus some of your post was a little over my head, but have you got an answer to this question? I’ve posed this question in another thread right here on Page 1 but it’s not getting any love…

Each card should have a mask trait with a key command to hide/reveal the card (I think it defaults to “Flip” Ctrl F - whatever)

In your player’s hand add a toolbar button GKC that uses Ctrl F (or the matching key command you have chosen) with a property match expression CurrentMap = WhateverTheNameOfThePlayerMapIs

Now, when the button is pushed all cards on the map will hide/reveal themselves. If you want to hide/reveal individual cards just select the card and choose it’s right click command that executes this feature.

Further things to consider, if you are using a private map or player hand you will have to set visibilities and permissions for other players if they too are suppose to be able to view/interact with the hand like operating the button etc…

Create private maps that are only accessible to the specific players in question. This of course means you may need multiple private maps. As a result, to clear clutter on the main toolbar, use a toolbar menu to hold all the different private maps which players can open to select the specific map when they need them

Ah, I see. So when the time came, Player 1 would essentially move his cards from his hand to the ‘Player 1 and Player 4’ map, for instance?

You got it.

If you wanted to be fancy, you could execute this all from a single button but involves a lot of work, probably more trouble than its worth. The Vassal ui is not very friendly in this regard for automating these types of functions

The basic method should work just fine, and be easy enough for players to understand. Thank you for the help!

Hmm. Guys, let me know if this can work in VassalEngine? How about this…

Each player’s hand is a MapView with a MapBoard, say we call it PlayerHandBoard.

In each PlayerHandBoard, we have an area the size of a single card, reserved for other players revealing their cards to the owner of the PlayerHandBoard. Let’s call this OtherPlayersRevealCardArea.

Now, say I am Player 1 and I wanna reveal a card in my hand to Player 3.

On my PlayerHandBoard, I right-click a card, say Card A. I execute command say “Reveal Card to Other Player”. Upon executing this command, 4 buttons (say there are 5 players) appear just below the card, each one representing players 2-5. These are just 4 game pieces with logic (via Traits) behind them. Once I click on the button representing Player 3, Card A will be:

[]Cloned (note that this shifts the focus to the cloned card, so all further Traits executed are those of this cloned card)[/]
[]Set a dynamic property “isCloned” to “true”[/]
[]Moved to Player 3’s PlayerHandBoard (via SendToLocation)[/]

On Card A, at the bottom of the list of all Traits (read “Top of Traits Stack/Layer”, as each Trait is like a matryoshka doll layer), RestrictCommand(s) will properly prevent Player 3 from operating on my card like it is his. Card A’s commands will be hidden to Player 3 because of those RestrictCommand(s).

Then, after Player 3 is satisfied with looking at my card, I right-click on Card A again, and execute command say “Unreveal Card to Other Player”. The command mops up all game pieces that are clones of Card A.