Menu-item's command happens twice

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
Post Reply
User avatar
Samonella
Posts: 381
Joined: January 8th, 2016, 5:41 pm
Location: USA

Menu-item's command happens twice

Post by Samonella »

In my current umc project, there are a few menu-items (created via [set_menu_item] of course) that the player uses quite frequently, so I added a [default_hotkey] to them. I immediately noticed that, when using the hotkey instead of the right-click-menu, sometimes the code in the [command] happens twice. I'm almost certain it's a wesnoth bug, not a bug in my code, because everything still works well when right-clicking.

It's a strange bug because, even when using the hotkey, the [command] usually only runs once. It only misbehaves about 1 out of 4 times I press the hotkey. I can't find any pattern in when the bug occurs, only that I've never noticed it two key-presses in a row. There was one isolated case, however, when the [command] happened not once or twice, but four times, after pressing the hotkey only once.

I'm on Windows 8 with Wesnoth 1.13.7.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
User avatar
Zap-Zarap
Posts: 159
Joined: March 16th, 2015, 2:18 pm

Re: Menu-item's command happens twice

Post by Zap-Zarap »

Sounds like a hardware issue.
Did you try a different keyboard? Or try to assign to a different key, and see, if it is still happening?
Cookie crumbs under the keys?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Menu-item's command happens twice

Post by zookeeper »

It seems the menu item keeps firing repeatedly as long as you hold down the key. So, in your case, it could just be a case of the keyboard repeat rate (look in your Windows keyboard settings) being so short that even a short press causes the menu item to fire several times.

Arguably, menu items should not behave that way but should instead just fire once per key pressed (or released) regardless of how long the key is held down, so I'd call it a bug.
User avatar
Samonella
Posts: 381
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Menu-item's command happens twice

Post by Samonella »

Zap-Zarap wrote:Sounds like a hardware issue.
Did you try a different keyboard? Or try to assign to a different key, and see, if it is still happening?
Cookie crumbs under the keys?
Pretzel crumbs, almost certainly yes :lol: but it's happened on multiple keys, and I have no trouble typing so I doubt it's a problem with my keyboard.
zookeeper wrote:It seems the menu item keeps firing repeatedly as long as you hold down the key. So, in your case, it could just be a case of the keyboard repeat rate (look in your Windows keyboard settings) being so short that even a short press causes the menu item to fire several times.

Arguably, menu items should not behave that way but should instead just fire once per key pressed (or released) regardless of how long the key is held down, so I'd call it a bug.
Hm, this must be related, but it is slightly different. The [command]s I'm using have messages in them, so it takes a while for the command to complete. If I hold the hotkey down that entire time then it always runs the command again, but if I hold it for a few seconds (not until the end of the messages) the command usually still only happens once. Anyway, I would guess that setting the command to only run on key down/up will probably solve both.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Post Reply