Here’s a simple example to illustrate this bug.
local hash_shift = hash("shift")
local hash_action_a = hash("action_a")
local hash_action_kp_4 = hash("action_kp_4")
function init(self)
msg.post(".", "acquire_input_focus")
end
function on_input(self, action_id, action)
if action_id == hash_shift then
if action.pressed then
self.shift = true
print("shift pressed")
elseif action.released then
self.shift = false
print("shift released")
end
elseif action_id == hash_action_a and action.pressed then
if self.shift then
print("shift action a")
else
print("action a")
end
elseif action_id == hash_action_kp_4 and action.pressed then
if self.shift then
print("shift action kp4")
else
print("action kp4")
end
end
end
If I type “a” on the keyboard, and then hold down shift and type “a”, it looks like this:
DEBUG:SCRIPT: action a
DEBUG:SCRIPT: shift pressed
DEBUG:SCRIPT: shift action a
DEBUG:SCRIPT: shift released
However, if I type 4 on the numeric keyboard, and then hold down shift to do the same - you’ll see this:
DEBUG:SCRIPT: action kp4
DEBUG:SCRIPT: shift pressed
DEBUG:SCRIPT: shift released
DEBUG:SCRIPT: action kp4
DEBUG:SCRIPT: shift pressed
DEBUG:SCRIPT: shift released
It sends me a shift released action when I hit kp4, if I’m holding down shift - then another pressed action immediately afterwards.