Global Hotkey passing PieceName?

I have a module with a dedicated Attack roll button–it’s just a dice roller button that messages “$PlayerName$ rolls an Attack. Result: $result$.” when clicked.

Players can also trigger the Attack button with a Global Hotkey on a Piece. The Global Hotkey will still return, for example, “Bill rolls an attack. Result: 7.” This is accurate and will serve, but it’s not quite what I’d like to do.

What I’d like it to do, is when the player triggers the Global Hotkey on the piece, include the name of the piece in the message, that is: “Bill rolls an attack with a Battleship. Result: 7.” Then there’s no doubt which piece is actually making the attack.

So for the message, I was assuming I’d be able to use something like “$playername$ rolls an attack with $PieceName$. Result: $result$”

Thing is, $PieceName$ and $BasicName$ don’t show up in the message. They’re both blank, so you get “Bill rolls an attack with. Result: 7.” Neither of these piece properties appears to be passed by the Global Hotkey trait.

Is there another property I should use instead that can be passed along? Or is this just not the way to accomplish what I’m trying to do?

Exactly which component is generating the message?

I don’t understand what you mean by a property being ‘passed’ by the Global Hotkey trait. No trait ‘passes’ any property to anything else unless you specifically do it via Global properties.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

The component generating the message is the die roller (Attack) button.

What I’d like it to do is include the name of the piece the player triggered the GH, on in the message returned by the die roller button.

You will need to use a Trigger and set the name of the piece into a Global Property (say called DieTarget) using a Set Global Property trait prior to issuing the Global Hotkey. You can set the Global property to $PieceName$, so the Trigger can be in a prototype. Then, your die roller reports

Attack die rolled by $DieTarget$

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

That worked great, Brent! Thanks!

I want to do the exact same thing, but can’t get it to work.

My prototype have three traits for this.
Trigger, listens for CTRL-6 and performs CTRL-P and ALT-6

The CTRL-P triggers a “Set global property”: Set value directly, selectedUnit=$PieceName$
Also, there is a global property on the module level called selectedUnit.

The ALT-6 triggers a “Global hotkey” that performs a SHIFT-6.

My dice button listens for SHIFT-6 and the report includes $selectedUnit$.

He… now that I tried it again, it worked. Maybe I had to close and start a new game?

Yeah, many changes in the editor can be tested as you make them but others need a restart. I would imagine fooling with Global Properties would require a restart in most cases as these are normally initiated on start (if Vassal works like other programming code I’ve worked with).

I’ve gotten into the habit of always restarting before testing as I had problems in the past that actually didn’t exist.