Module Feature for Card Game

Hi, I’m here to ask if it will ever be possible to add the following function:

A “Piece” is made up of a “Basic Piece” which represents an image. What I am asking is if it is possible to implement a “text” function (perhaps that can support html) and that it is displayed only when the mouse is over it.

Or, is there an alternative? I’ve already asked a few times but never got an answer xD
Vassal is the best platform I have for this game, I know how to work on Vassal, but not at pro levels.

This is an example, i made it with Paint.

In short, something like that. The mouse when it is over the card shows both the card in large and the text, while when the card is on the field it shows only the card itself without displaying the text.

Sure. Add a Calculated Property (CP), call it zoomtext or whatever you like. The expression for the CP would be DrawingMouseover ? "<text to display>" : ""–this sets the CP to nothing if the mouse isn’t hovering over the piece, or to the text to display (and yes, you can use HTML here, IIRC) when the mouse is hovering over the piece.

Next, add a Text Label whose contents are simply $zoomtext$.

Finally, add a Mouse-over Stack Viewer to the map. Now, when the Mouse-over Stack Viewer triggers, the Text Label will be populated; the rest of the time, it will be empty.

Need some changes right?

Yes–expressions have to be enclosed in curly braces: { }, and you’re missing an empty set of double quotes at the end "", representing the no text option.

I have come to this point. (I added what was missing in the experiment and now it’s correct)

Do I have to do anything else? Because the text is still displayed on the field anyway. And I would like to avoid this. At least, as long as I don’t hover the mouse over the card

The one exception is for Calculated Properties; the curly braces are assumed and you need to leave them out.

You need to replace <text to display> in the Calculated Property with the actual text that you put in the Label text field of the Text Label, add : "" to the end of the expression (which translates to “else an empty string”), give the Calculated Property an actual name (this is where that suggested zoomtext should go), move the $zoomtext$ from the Name format field to the Label text field, and reset Name format back to $pieceName$.

You’ll also want to delete the text from the Menu command field, unless you want users to be able to right-click on the piece and select that option to change the text while in play.

Thanks a lot to both of you for your help, but I’m here again to ask for further advice.

Is it possible to show a different image from the “Basic Piece”? As I show in this example picture. I know there is a way to create a table, but I don’t know it can always be active when I hover over it and without having to press any keys. If there was a way for that too, I’d be happy to be informed :slight_smile:

Yes, add a Layer trait to the piece. Enable the Always active and Levels follow expression value checkboxes, and for the Expression use {DrawingMouseoverIndex} (as mentioned in the Mouse-over Stack Viewer docs). Leave Image 1 unset (this is what to draw when not mousing over the piece), and make Image 2 the alternate image you want to replace the normal image when mousing over.

Edit: Note that this alternate image will be drawn on top of the original image–if it’s smaller than the original, part of the original will still show.