Tim,
Thanks for offering to help. I posted details to the problem on the following forum.
Now onto your response. The reason I mentioned clicking is that it seems to me there is a concept of a “selected” piece. E.g. when you hit a keystroke, I believe that the keystroke is sent to the selected piece. I thought the way you selected a piece was by clicking on it. E.g. if you left-click on a card and then press ctrl-a, it will add THAT card to your hand. If you left-click on a different card, then the ctrl-a will apply to that card instead. There will often be logic in a prototype that fires conditionally based on attributes of a piece; the values of those attributes, I assume, is based on the left-click selection of that piece.
That is why I assumed that #2 and #3 are different. After writing that, it occurred to me that there’s a #5 which is dragging the piece.
The reason I broke out #3 and #4 is it seems to me there are plenty of places in the code where there is a keystroke trigger for a key that it is assumed will be pressed by the engine and not a player (a dumb way to call a function IMO but that’s a separate topic.)
On the programming vs. modding topic, I understand that supporting the VASSAL engine is different work from supporting a module. But I would call both programming, it’s just that in the former you’re programming in the functional programming language of Java whereas in the latter you’re programming in the declarative language VASSAL. Java has a very clear instruction manual. If you want to know what order things happen in Java, it’s very clearly documented. Things also happen in a specific order in the VASSAL programming language, but I’ve been having trouble finding the documentation that will tell me what order key listeners will execute in. But whether it’s programming or modding I guess is a semantic debate.
I had a look at the code and it looks to me like the “active” and “passive” keys in a TriggerAction are treated identically.
From TriggerAction.java:
[code]
public Command myKeyEvent(KeyStroke stroke) {
/*
* 1. Are we interested in this key command? Is it our command key? Does it
* match one of our watching keystrokes?
*/
boolean seen = false;
if (key.equals(stroke)) {
seen = true;
}
for (int i = 0; i < watchKeys.length && !seen; i++) {
if (watchKeys[i].equals(stroke)) {
seen = true;
}
}[/code]