I’m working on my first module (Tito - I figured nobody will get hurt if I bugger it up that way ), and I’m running into a little problem. I’ve set up a Trigger Action that is supposed to mark a unit moved and then send off the hotkey for a die roll. I know the action is triggering correctly, as the Mark Moved works, but the die roll never appears. Am I missing something?
For what it’s worth, I configured this just before I updated to 3.1.6; I could be hallucinating, but I think it worked before the update. Can’t really say for sure, though. This is on a Mac OS X 10.5.7 machine, fully updated (Update 4 for the JRE).
I’ve boiled it down to a demonstration module, attached.
No, this is not a bug and never would have worked.
A Trigger Action trait only sends the Hotkeys counters, so the F2 is only being sent to the counter. But the counter does not roll the Dice, that’s done by the top-level Vassal component. So no amount of sending F2’s to any counter will ever make that Dice roll.
To have a counter fire off a Vassal component with a hot-key, you have to use a ‘Global Hotkey’ trait as an intermediary. The ‘Global Hotkey’ sends a specified hotkey to all the top-level components. Use your Trigger Action to initiate the Global Hotkey. You can keep F2 as the Key Stroke, then setup the global hotkey as:
Description: Roll Die
Keyboard Command: F2
Global Hotkey: F2
Whenever the Global Hotkey trait sees an F2 sent to the counter, it will issue a corresponding F2 to the Vassal top-level components, including the Dice Button.
Thanks - I would have thought that “Perform these Keystrokes” was equivalent to pressing those keys. It was not clear to me from the documentation that the scope of those commands was limited to the piece in question.
One related question - is there an easy way to make the die roll message appear on the same line as (or after) an associated Report Action’s report? Currently it appears before the report, which is suboptimal.
I found this thread in a search and it appears to respond to exactly what I need to do - which is to select a menu item of a piece menu and have that then trigger an additional action done by a custom-class buildable in our module (VASL). When you say “top-level Vassal component”, would that include a buildable with a key listener in the module being used?
If not, is there an other way to trigger that buildable’s keypressed event from a piece menu item?
I have tried to set this up as you suggested but so far the Global HotKey is not issuing the keycombo to the VASL buildable.