GKC 'alert' pop up

I have a GKC button on the main toolbar that unflips every flipped counter; basically an ‘end of (game) turn’ function. Much easier than having to do all that manually. A game turn consists of a number of impulses.

But, people do accidentally press this button during a game turn. This can get annoying.

Is there a way to have a ‘pop-up’ window that activates when the GKC button is pushed that states the familiar ‘Are you sure’ with 2 action buttons of ‘OK’ & ‘Cancel’. Pressing OK will allow the GKC action to proceed. Pressing Cancel will stop the GKC from running.

I appreciate that there is an Alert capability for beanshell expressions, but I feel that this may not be relevant here. Could be so totally wrong about that feeling though.

Correct. The Alert is not relevant because it is not interactive in the sense that you can’t change any behavior in the module. It just basically pauses everything until the player clicks OK, presumably after reading the alert, then Vassal continues on its merry way.

I’d suggest a Dynamic Property with a user prompt to select from a list (“Yes”, “No”). If the Dynamic Property == “Yes”, then fire the actual GKC that flips all the pieces. The complication is that you need your GKC button to trigger an intermediary piece that contains the DP and the real GKC. I usually use the turn marker to hold stuff like that. You can really use any piece that will never be deleted. Just hide all the menu commands so players never see them…

Thanks for the suggestion. I have tried, but failed. I used a GKC to trigger a hotkey (decision1set). I setup an ‘at start deck’ containing 1 piece (any map). I defined a GP called decision1, with initial value of No (without “”).

The piece has 2 triggers and a DP trait. Trigger one should fire on the tool bar GKC hotkey of decision1set. This in turn should fire the DP (setd1) and then fire another keystroke (rungkc1go). Trigger two should then fire if decision1 is Yes. This triggers the (old) GKC to unflip all flipped units and then reset decision1 back to No.

Trouble is nothing happens. I would have thought that the DP would fire up the dialogue box at the very least.

Perhaps if I can see what you have done in a module things will be more clear. If you can give a link to one of these modules it would be appreciated.

Finally got the GP to display the pop-up (note not a DP). But the old EOT Unflip GKC is not working. It works when directly clicked on, but for some reason the hotkey from the trigger does nothing. I’ve tried using a keyword and keyboard commands (alt+ctrl+U). The latter works directly with the EOT Unflip GKC, but not via the trigger.


All working now. Realised I should be using the global hotkey trait, not the trigger trait. Thanks for the advice.

1 Like