Adding a dynamic text box?

I want to have a text box on the map that will display text set by the module, rather than entering it manually.
Specifically, what I would like it to do is, if I click on a card/piece that is on the map, the text box will be filled with information taken from the piece’s properties/traits.
Adding a Text Label trait to each piece does not work, as the label rotates when the piece does.

I “could” do something like creating a giant game piece that contains a Spreadsheet, but I would like it to be able to be dynamic enough to change depending on what piece I select. Is this possible, or am I just asking too much out of Vassal?

I’ve done what you want with a property sheet trait.
If you don’t want the rotate trait to rotate trait X, put X below rotate in the trait list.

Disclaimer: Haven’t tried this - your milage may vary

  1. Define a Action Button trait to your pieces that triggers a key command - say ShowDetails
  2. Add an Attachement trait to your pieces with some specific name, say PieceDetails with
    • Key command to attach pieces: AttachToDisplay with conditions such as {BasicName=="PieceDisplay"}
  3. Add a Global Key Command trait to your pieces listening for DoShowDetails, and that that does Fast Match on Current Attachments and send key command ShowDetails
  4. Add a Trigger Action trait to your pieces that listens for the Action Button key command - e.g., ShowDetails, and performs the key commands
    • AttachToDisplay
    • DoShowDetails
  5. Prepare a piece - say PieceDetailViewer - the “display piece” - with some large image and a bunch of
    • Text Label traits, each which gets specific value of a Dynamic Property (e.g., Property1)
    • Dynamic Property traits (e.g., Property1) that listen for the key command ShowDetails and uses expressions like
      {PieceDetails_AttachCount <= 0 ? "" : GetAttachProperty("PieceDetails",Property)}
      
  6. Add an Attachement trait to your pieces with some specific name, say PieceDetails with
    • Before adding attachments: Clear existing attachments first
    • When another piece attaches to this one using this attachment’s name: Attach to that piece

What should then happen is

  • User clicks a piece
    • That triggers ShowDetails
      • Which then triggers AtttachToDisplay which then
        • Attaches the piece to the display piece
        • But only after that piece cleared all other attachements
        • and the display piece attaches back to the selected piece
    • Then triggers DoShowDetails which
      • Sends ShowDetails to the display piece
      • Which triggers all the Dynamic Property traits to take the propery values from the selected (attached) piece
      • And the Text Label traits see the change and update

At least, that’s the thinking :slight_smile:

An alternative could be

  • Define a Trigger Action trait in your pieces (or prototype) with menu command Print and key Ctrl-P (say).
  • Define a Report Action trait in your pieces (or prototype) which listens for the key (Ctrl-P) and simply prints relevant piece properties to the chat. Remember that you can somewhat format your output.

This is simpler, and should have very little overhead.

Note, you cannot set the content of Spreadsheet cells from the pieces - only the user can enter information.

Yours,
Christan