ID:1838806
 
BYOND Version:507
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 42.0.2311.90
Applies to:Dream Seeker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Ok I don't know how helpful this report will be but in my game I have macros that do different things on "Key Down" and "Key Ups". Like you hold the macro down and it toggles something on, and when you release it it is toggled off. They're not repeat macros, I guess is what I'm saying.

NOW TO THE PROBLEM: If a player presses the macro down, then an input() window appears, and they release the key, a key up event is never called. In my game input() and alert() menus can appear during gameplay for many reasons. My movement system uses a "Key Down" to toggle movement for that direction ON, and "Key Up" to toggle the movement OFF. Most games use the repeat macros, I don't. So if during movement an input() window appears for that player, when they release the key they don't stop moving, probably because focus has been moved off the map and ON TO the input() window when it pops up. So their character continues moving on its own til they get rid of the input() window and tap the directional key again.

Numbered Steps to Reproduce Problem:
See code snippet. Use an Interface to assign the 2 verbs to the same macro key, one when the key is pressed down, the other when it is released. I didn't test it but hopefully it is conceptually accurate to the problem I described. I believe the problem is when focus changes from the map to the input window, from when the input window pops up it changes the focus.

Code Snippet (if applicable) to Reproduce Problem:
//hold the key down until the random input() window appears. then release

mob/var/key_down=false

mob/verb
KeyDown()
key_down=true
KeyUp()
key_down=false

mob/proc/Key_checker_loop() spawn
while(src)
if(key_down) src<<"Key is still registered as being down"
spawn if(prob(1)) input(src,"hi","hi") in list("hi","cancel")
sleep(1)

mob/New()
Key_checker_loop()
..()


Does the problem occur:
Every time? Or how often? Yea
In other games? Idk
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?
Idk

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Idk

Workarounds:
Idk
SUMMARY:
When a client is holding down a macro, then while they are holding it down an input() window appears for any reason, then they release that macro to respond to that input() window, a "key up" event for that macro is never called.
Curious. I was certain this was fixed some time ago. I'll look into it.
The servers are running 507
I found something here, but it only impacts modifier keys. Is that the key that you were using? That would've been good information to include in the report if so.

I have not been able to replicate the problem for non-modifier keys, leading me to believe that's all this was. If you can confirm that, I can close this report as fixed.
I don't know what a modifier key is but if you mean that in the macro setup menu for the game's interface that I have the tickbox for CTRL, ALT, or SHIFT ticked, then I do not have any of those ticked for any of the macros in my game.
OH, Lummox this is the problem I was paging you about aswell yestarday night :), Lizard sama explained it alot better though, GG!
In response to Lizard_Sphere_X
I'll need a test project then. I was not able to confirm this with anything except the modifier keys.

However, if you were using FA's keyboard lib and relying on that, it does trap those keys and could explain much.
In response to Lummox JR
Lummox JR wrote:
I'll need a test project then. I was not able to confirm this with anything except the modifier keys.

However, if you were using FA's keyboard lib and relying on that, it does trap those keys and could explain much.

It's all custom. But if I can prepare something I will post it here.