I have been using "if ($mouse.key) break" in my scripts for many years as a cheap abort triggered by holding any of Ctrl/Alt/Shift/Mouse buttons. Since v7.69 extends this variable to expose other key states including Caps/Num/Scrollock as well as Middle click and Right Ctrl/Alt/Shift, I have had to go through and alter these scripts. No big deal.

However, there is no updated documentation explaining the new values offered by $mouse.key, so I have been decoding it myself with a simple timer. Please correct any mistakes or missing keys in the table below. I believe I have discovered a bug, also explained below.

/timer 0 1 if ($mouse.key) echo -a $mouse.key

Code
1 Left mouse button
2 Ctrl key
4 Shift key
8 Alt key
16 Right mouse button
32 Middle mouse button
68 Right Shift key (64+4)
130 Right Ctrl key (128+2)
264 Right Alt key (256+8)
512 CapsLock
1024 ScrlLock
2048 NumLock
???? Menu key


bug: The Right Ctrl/Alt/Shift keys express their own values (128, 256, 64) respectively, but they also present the left-handed key values as well (2, 8, 4 respectively). This prohibits scripts (such as game scripts) from detecting if the right-handed key is being held down while the left-handed key is currently released. Imagine a pinball game where the left-shift is the left paddle, and right-shift is the right paddle. Pressing the right-shift would necessarily have to raise both paddles since there is no way to determine that the left handed shift is not pressed.

bug: The versions.txt says that support for Menu Key was added, but I cannot get a value while pressing and holding my Menu key.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!