Keeping button pressed
Posted: 26 Jan 2019, 09:36
Hello
I have a game device. I'm trying to map one of it's buttons to keyboard button 'b'. So far, this of course works.
However, the game distinguishes between a "click" (just key down and then immediately up) and a "long press" (key down, wait for 500+ms, key up*).
lmc_send_keys() cannot of course do this, but then I found out about lmc_send_keys(). But I can't make it work.
I've tried these approaches:
Neither of those work. In my head, both should work similarly to pressing and hold down "b" on the keyboard, but they don't. If used in notepad, both ways just send one letter 'b' to the program, not repeating like it does if you hold down a key.
I've also contemplated on using two different keys and just sending the same event, but the other with a pause, but that doesn't work either. Like this:
For some reason that I can't figure out, this does not work either.
ps. The game in question is Star Citizen, can it just somehow be incompatible with lmc_send_input()?
I have a game device. I'm trying to map one of it's buttons to keyboard button 'b'. So far, this of course works.
However, the game distinguishes between a "click" (just key down and then immediately up) and a "long press" (key down, wait for 500+ms, key up*).
lmc_send_keys() cannot of course do this, but then I found out about lmc_send_keys(). But I can't make it work.
I've tried these approaches:
Code: Select all
if (direction == 0) and (button == 19) then lmc_send_input(66,0,2) end
if (direction == 1) and (button == 19) then lmc_send_input(66,0,0) end
Code: Select all
if (button == 19) then
if (direction == 1) then
timer19 = ts
elseif (direction == 0) then
pressed19 = ts - timer19
lmc_send_input(66,0,0)
lmc_sleep(pressed19)
lmc_send_input(66,0,2)
end
end
I've also contemplated on using two different keys and just sending the same event, but the other with a pause, but that doesn't work either. Like this:
Code: Select all
if (button == 19) then lmc_send_keys('b') end
if (button == 20) then
lmc_send_input(66,0,0)
lmc_sleep(1000)
lmc_send_input(66,0,2)
end
ps. The game in question is Star Citizen, can it just somehow be incompatible with lmc_send_input()?