Key hold with multiple keys

How can be this controlled in that simulator? Can HIDmacros be used with this application?
Post Reply
akewt77
Posts: 2
Joined: 12 Nov 2019, 23:38

Key hold with multiple keys

Post by akewt77 » 12 Nov 2019, 23:54

Hello
New to this fantastic piece of software and it has nearly answered my prayers.
I use some software at work which has 3d viewport navigation using a combination of right mouse button hold and arrow keys hold. multiple arrow keys are held at the same time. essentially like unreal editor wasd
is there a function for 'key hold' and hwo do i stop key interefering with one another ie canceling on second arrow press.

may basic script so far:

Code: Select all

lmc_device_set_name('radiantpad','8A43DEA')
lmc_print_devices()
lmc_set_handler('radiantpad',function(button,direction)
  if (direction == 0) then return end
  if (button == 87) then
  	lmc_send_keys('{UP})', 50)
  elseif (button == 65) then
  	lmc_send_keys('{LEFT}', 50)
  elseif (button == 68) then
  	lmc_send_keys('{RIGHT}', 50)
  elseif (button == 83) then
  	lmc_send_keys('{DOWN}', 50)
  	end
  end
  )      

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Key hold with multiple keys

Post by admin » 13 Nov 2019, 09:11

Use lmc_send_input - it can send just press and just release, so the key is "hold" until you release it with the next call.
Petr Medek
LUAmacros author

akewt77
Posts: 2
Joined: 12 Nov 2019, 23:38

Re: Key hold with multiple keys

Post by akewt77 » 13 Nov 2019, 18:01

THANKS! so i got something different but its definitely not correct. It doesn't release rn and also i think it's screwing with the standard arrows.
Sorry in advance coding doesn't come naturally. I've searched for use cases but can't extract the correct parts.

Code: Select all

lmc_device_set_name('radiantpad','8A43DEA')
lmc_print_devices()
lmc_set_handler('radiantpad',function(button,direction)
  if (direction == 0) then return end
  if (button == 87) then -- up
    lmc_send_input(38, 0, 2);
    lmc_send_input(38, 0, 0);
  elseif (button == 68) then  -- left
    lmc_send_input(37, 0, 2);
    lmc_send_input(37, 0, 0);
  elseif (button == 65) then   -- right
    lmc_send_input(39, 0, 2);
    lmc_send_input(39, 0, 0);
  elseif (button == 83) then    -- down
    lmc_send_input(40, 0, 2);
    lmc_send_input(40, 0, 0);
  	end
  end
  )
         

Post Reply