Create account / Log in

Problem with keystrokes

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

Problem with keystrokes

Postby drimmer » February 23rd, 2020, 3:43 am

I am trying to use a Trigger Action to activate a Key Command on a Dynamic Property of a counter. The process works fine when using the associated Menu Command but it does not work when using the actual keystrokes.

The Dynamic Property is attached as KEYSNIP1. As you can see there is a menu command Lower CVP associated with the keystroke Shift-H (I have tried with multiple keystroke combinations such as Alt Shift Ctrl A so I don't think it is a keystroke conflict) which is to increment the numeric value of the dynamic property by -1. Selecting Lower CVP from the counter's pop up menu works; using the Shift-H keystroke does not.
KEYSNIP1.PNG
KEYSNIP1.PNG (17.83 KiB) Viewed 2640 times


The Trigger Action (attached as KEYSNIP2) is part of the same counter. Selecting menu command AAA triggers the Shift-H key command on the Dynamic Property but neither the Ctrl-V nor Shift-V keystrokes do so. If I assign a Keyboard Command to the Trigger Action, it does not work either.

KEYSNIP2.PNG
KEYSNIP2.PNG (13.31 KiB) Viewed 2640 times

Any thoughts?

Thanks in advance.
Doug
drimmer
 
Posts: 31
Joined: May 21st, 2014, 4:48 pm

Re: Problem with keystrokes

Postby Cattlesquat » February 23rd, 2020, 2:28 pm

Does the other command ("Reset CVP") work from the keystroke? For the keystrokes to work, the piece/counter has to be selected at the time you issue it (click on it and make sure you see the selection highlight).

One other thing I have learned to avoid plain SHIFT hotkeys (e.g. Shift+H) because the player ends up accidentally typing them when using the chat window. But that's more a problem of hotkeys working "too often".
User avatar
Cattlesquat
 
Posts: 327
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Problem with keystrokes

Postby drimmer » February 23rd, 2020, 11:03 pm

Cattlesquat wrote:Does the other command ("Reset CVP") work from the keystroke? For the keystrokes to work, the piece/counter has to be selected at the time you issue it (click on it and make sure you see the selection highlight).

One other thing I have learned to avoid plain SHIFT hotkeys (e.g. Shift+H) because the player ends up accidentally typing them when using the chat window. But that's more a problem of hotkeys working "too often".


No, neither of the commands now work from the keystroke (I am certain that the Reset CVP was working from the keystroke before I added the second command - months after I created the first one).

Yes, I agree that Shift+H is not a good choice. I had started with more complex ones but was simplifying them in my effort to get something, anything to work. No joy so far. But, agree that once the problem is solved, a better keystroke needs to be used.

Thanks for your response!
Doug
drimmer
 
Posts: 31
Joined: May 21st, 2014, 4:48 pm

Re: Problem with keystrokes

Postby drimmer » February 25th, 2020, 9:15 pm

On further exploration, I find that I cannot get any new keystrokes to work, regardless of the trait i try to use. I have created Place Marker traits, Trigger Actions, and Dynamic Property commands. In all cases, the menu item from the dropdown works but the keystroke itself will not. I have tried simple keystrokes and multiple key keystrokes. Nothing works.

Any thoughts?
Doug
drimmer
 
Posts: 31
Joined: May 21st, 2014, 4:48 pm

Re: Problem with keystrokes

Postby JoelCFC25 » February 25th, 2020, 11:35 pm

Is everything designed in the manner of that "Reduce CVP" Trigger Action as pictured above? Because a menu command without a corresponding keystroke seems like it wouldn't work.

Are you able to post your module in progress somewhere (e.g. Google Drive, Dropbox)?
JoelCFC25
 
Posts: 689
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: Problem with keystrokes

Postby shilinski » February 25th, 2020, 11:55 pm

This has all the characteristics of a piece not having the focus (not selected). Someone questioned this earlier, but you did not respond.
shilinski
 
Posts: 154
Joined: December 22nd, 2007, 8:46 am
Location: Laurel, Maryland

Re: Problem with keystrokes

Postby drimmer » February 26th, 2020, 3:00 am

JoelCFC25 wrote:Is everything designed in the manner of that "Reduce CVP" Trigger Action as pictured above? Because a menu command without a corresponding keystroke seems like it wouldn't work.

Are you able to post your module in progress somewhere (e.g. Google Drive, Dropbox)?


Thanks for your suggestions. From what I can tell, the problem is not with the menu commands. They work. Even if I add (and I have) a keystroke to the trigger action command, I still can't get the "perform these keystrokes" part to work. My sense is that the problem is not with the trigger action but with the dynamic property in the unit counter as I can't get either of the keystroke commands for it to work via keystroke but they do work by menu!

Here is a dropbox link to the module. https://www.dropbox.com/s/fibog3bv1gdbu10/vasl-6.5-beta1.vmod?dl=0

I have been playing with this problem in the Unit and INFMark prototypes and the American 747AEsq unit (first unit found in the VASL counter palette under Allied O/B //American//SQ//Army.
Doug
drimmer
 
Posts: 31
Joined: May 21st, 2014, 4:48 pm

Re: Problem with keystrokes

Postby drimmer » February 26th, 2020, 3:03 am

shilinski wrote:This has all the characteristics of a piece not having the focus (not selected). Someone questioned this earlier, but you did not respond.


Thanks for the comment. I must have missed that part of the earlier response. Yes, I have made very sure that I am testing this on a selected unit. As I said, the popup menu items work but the corresponding keystrokes (when made with a unit selected) do not.
Doug
drimmer
 
Posts: 31
Joined: May 21st, 2014, 4:48 pm

Re: Problem with keystrokes

Postby JoelCFC25 » February 26th, 2020, 3:57 am

I'll have to revisit this tomorrow--I am not able to even drag one of these counters onto any board, not quite sure why.
JoelCFC25
 
Posts: 689
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: Problem with keystrokes

Postby shilinski » February 26th, 2020, 6:00 am

Alright, I don't know what came over me, but I downloaded it, and I found out what was wrong. First off, I smelled a big rat. Why weren't the keystrokes showing up in the right-click command? Why? Because they weren't keystrokes!

Look, when the editor asks for a keystroke, you enter a keystroke (or a label--more about that later). You don't type in literally "ctrl shift left." You actually press the ctrl-shift-left keys. You typed in all these strings thinking they were keystrokes, and they weren't, so that's why keystrokes didn't work--and why they didn't appear in the right-click commands. Vassal saw them as labels and not keystrokes.

Next thing. Vassal will let you use labels (strings) as substitutes for keystrokes. So instead of putting in a keystroke like ctrl-alt-shift-F12, you can type in "decrementICVP" instead (for example). Then in the trigger, you can tell it to "decrementICVP." This is really useful for commands you are hiding from the user. And often you don't need the command string either if you aren't displaying it in a right-click command. However, when you use labels instead of keystrokes, you sacrifice the ability to have keystrokes. If you decide to use labels, anyone who follows you in editing this module will thank you.

If it still puzzles you why sometimes it worked and sometimes it didn't, it's because you were using matching labels and didn't know it. For example, you made the "decrement" command keystroke something like "ctrl shift h," and in the trigger you called "ctrl shift h," and it worked because the strings matched. It had nothing to do with the keystroke. It could have been "ctrl shift dipsy do" and it would have worked too.
shilinski
 
Posts: 154
Joined: December 22nd, 2007, 8:46 am
Location: Laurel, Maryland

Re: Problem with keystrokes

Postby drimmer » February 26th, 2020, 3:28 pm

shilinski wrote:Alright, I don't know what came over me, but I downloaded it, and I found out what was wrong. First off, I smelled a big rat. Why weren't the keystrokes showing up in the right-click command? Why? Because they weren't keystrokes!

Look, when the editor asks for a keystroke, you enter a keystroke (or a label--more about that later). You don't type in literally "ctrl shift left." You actually press the ctrl-shift-left keys. You typed in all these strings thinking they were keystrokes, and they weren't, so that's why keystrokes didn't work--and why they didn't appear in the right-click commands. Vassal saw them as labels and not keystrokes.

Next thing. Vassal will let you use labels (strings) as substitutes for keystrokes. So instead of putting in a keystroke like ctrl-alt-shift-F12, you can type in "decrementICVP" instead (for example). Then in the trigger, you can tell it to "decrementICVP." This is really useful for commands you are hiding from the user. And often you don't need the command string either if you aren't displaying it in a right-click command. However, when you use labels instead of keystrokes, you sacrifice the ability to have keystrokes. If you decide to use labels, anyone who follows you in editing this module will thank you.

If it still puzzles you why sometimes it worked and sometimes it didn't, it's because you were using matching labels and didn't know it. For example, you made the "decrement" command keystroke something like "ctrl shift h," and in the trigger you called "ctrl shift h," and it worked because the strings matched. It had nothing to do with the keystroke. It could have been "ctrl shift dipsy do" and it would have worked too.


Thanks very much for this. I was wondering why the key strokes weren't showing up in the menu as they did for other commands. I would never have guessed that I had to actually enter the keystrokes (although I did notice that sometimes when I typed a key it showed up in the keystroke box. The penny did not drop.). I can certainly use this to fix my problem. And I understand why it sometimes worked just by accident. I appreciate your going to the trouble of downloading the module and exploring it. Many thanks.

OK, that's my rationale response. Inside my head a voice is shrieking "OMG, this it totally insane, my brain is going to explode. Where, oh where, in the gd manual does it say to actually enter the key strokes!!!! AAAARRGGGHH!"

Now, back the the rationale me. VASSAL is a mysterious beast and it works as it works. I appreciate that so many people take the time to help. It's all learning.

Thanks.
Doug
drimmer
 
Posts: 31
Joined: May 21st, 2014, 4:48 pm

Re: Problem with keystrokes

Postby drimmer » February 26th, 2020, 3:30 pm

JoelCFC25 wrote:I'll have to revisit this tomorrow--I am not able to even drag one of these counters onto any board, not quite sure why.


Thanks. See following post. Looks like we have identified the problem and, thankfully, the solution. Turns out it was operator error! LOL.
Doug
drimmer
 
Posts: 31
Joined: May 21st, 2014, 4:48 pm

Re: Problem with keystrokes

Postby shilinski » February 26th, 2020, 4:14 pm

To be fair, it doesn't say to enter a string representation of the keystroke. BTW, in your test module, the "keystroke" for the decrement key did not match the one you had in the TRIGGER trait, so it wasn't going to work no matter what.
shilinski
 
Posts: 154
Joined: December 22nd, 2007, 8:46 am
Location: Laurel, Maryland

Re: Problem with keystrokes

Postby drimmer » February 26th, 2020, 6:39 pm

shilinski wrote:To be fair, it doesn't say to enter a string representation of the keystroke. BTW, in your test module, the "keystroke" for the decrement key did not match the one you had in the TRIGGER trait, so it wasn't going to work no matter what.


Agreed, my poor old brain needs to learn to think in different ways.
Doug
drimmer
 
Posts: 31
Joined: May 21st, 2014, 4:48 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 5 guests