Help with creating ammo tracking

Successfully added Fire Weapon using Dynamic Property, which adds an property to the game piece, which is great. Is there an recommended method for tracking ammo and reporting the weapon and ammo count to the command line?

The Report Action does not track Game Piece properties, so it seems I should create an global property. Any help is appreciated am reading here:
https://vassalengine.org/doc/latest/ReferenceManual/Properties.html#top

Alright so I tested Dynamic Property to use for tracking ammo, and it worked, however I cannot display weapon type shot to the command line and the current amount of ammo, should I create some types that can be added to Dynamic Property, like Weapon.

My question is how do I report game piece properties to the command line? Thanks

If by “command line” you are referring to the Chat Log (https://vassalengine.org/doc/latest/ReferenceManual/ChatLog.html#top), I’d suggest adding one or more Report Actions (https://vassalengine.org/doc/latest/ReferenceManual/ReportChanges.html#top). Report Actions send reports to the Chat Log. You can also use Trigger Actions (https://vassalengine.org/doc/latest/ReferenceManual/TriggerAction.html#top) to group several automated actions together, structure branching (if this, then do that), and loop actions (do these actions in this order for this many times).

Thanks PawnPusher, the chat log is exactly what I meant. The problem i’m having is i want to report an dynamic property at the game piece level, and Report Action can only insert properties from VASSAL global variables and MAP global variables.

1 Like

This isn’t accurate. My modules use boatloads of Report Action traits to output piece-specific properties to the log.

If the problem is that you’re trying this and it’s not working, we can try to assist!

1 Like

He’s not wrong, this is a bug… Just looked at this on 3.6.4 WIN 64

If you use the Expression Builder for Report Actions, it doesn’t display the drop down for Piece Properties.

Using the Expression Builder on Dynamic Property, the Piece property drop down does display…

It wasn’t clear to me that construction via Expression Builder was being referred to here, but yes that limitation exists. My point was broadly about the capability of the Report Action trait, which can certainly output properties on the piece to which it belongs.

Absolutely!

@choffman83

Ignore the expression builder for your piece property and just manually insert it into the Report Action trait (e.g., $piecepropertytodisplay$)

2 Likes

Tried this…and the nice validator stayed an red X and did not turn green…I took this to mean the interpreter did not accept or see it.

Will try it again manually, thank you

Key here is to type $pieceproperty$ directly into the Report Format without using Expression builder.

After you do this and save it, if you go back to Expression Builder, you will see it format it like: “+pieceproperty+” in Expression Builder.

I’m not a developer, so I can’t tell you why it does this… But you can definitely get piece properties to report…

1 Like

Excellent! Thank you

Reporting successfully to the chat window – I have the code loaded in IntelliJ if you tell me what to fix I can give it a shot.