Using multiple modifiers

Announcements, questions
Post Reply
teddy268268
Posts: 1
Joined: 04 Oct 2019, 05:53

Using multiple modifiers

Post by teddy268268 » 04 Oct 2019, 06:04

From all of my searching through any documentation i could, i always found that no one ever needed to use multiple modifiers for their macros.

I am trying to set up a second keyboard to run along side arma3, which currently uses ever every key plus every modifier including left and right shift, alt, and ctrl, it even has quite a few double modifiers but i'm less concerned about those functions.

From what i was able to gather after a day of working, i have this simple code worked off of the sample lua,

Code: Select all

-- assign logical name to macro keyboard
lmc_assign_keyboard('MACROS');

-- define callback for whole device
lmc_set_handler('MACROS',function(button, direction)
  if (direction == 1) then return end  -- ignore down
  if     (button == string.byte('Q')) then lmc_send_keys('+>(Q)', 50)
  elseif (button == string.byte('W')) then lmc_send_keys('%>(W)', 50)
  elseif (button == string.byte('E')) then lmc_send_keys('%>(E)', 50)
  elseif (button == string.byte('R')) then lmc_send_keys('%>(R)', 50)
  elseif (button == string.byte('T')) then lmc_send_keys('%>(T)', 50)
  elseif (button == string.byte('Y')) then lmc_send_keys('%>(Y)', 50)
  elseif (button == string.byte('U')) then lmc_send_keys('%>(U)', 50)
  elseif (button == string.byte('I')) then lmc_send_keys('%>(I)', 50)
  elseif (button == string.byte('O')) then lmc_send_keys('%>(O)', 50)
  elseif (button == string.byte('P')) then lmc_send_keys('%>(P)', 50)
  elseif (button == string.byte('[')) then lmc_send_keys('%>([)', 50)
  elseif (button == string.byte(']')) then lmc_send_keys('%>(])', 50)

  elseif (button == string.byte('A')) then lmc_send_keys('%>(A)', 50)
  elseif (button == string.byte('S')) then lmc_send_keys('%>(S)', 50)
  elseif (button == string.byte('D')) then lmc_send_keys('%>(D)', 50)
  elseif (button == string.byte('F')) then lmc_send_keys('%>(F)', 50)
  elseif (button == string.byte('G')) then lmc_send_keys('%>(G)', 50)
  elseif (button == string.byte('H')) then lmc_send_keys('%>(H)', 50)
  elseif (button == string.byte('J')) then lmc_send_keys('%>(J)', 50)
  elseif (button == string.byte('K')) then lmc_send_keys('%>(K)', 50)
  elseif (button == string.byte('L')) then lmc_send_keys('%>(L)', 50)
  elseif (button == string.byte(';')) then lmc_send_keys('%>(;)', 50)
  elseif (button == string.byte('/')) then lmc_send_keys('%>(/)', 50)

  elseif (button == string.byte('Z')) then lmc_send_keys('%>(Z)', 50)
  elseif (button == string.byte('X')) then lmc_send_keys('%>(X)', 50)
  elseif (button == string.byte('C')) then lmc_send_keys('%>(C)', 50)
  elseif (button == string.byte('V')) then lmc_send_keys('%>(V)', 50)
  elseif (button == string.byte('B')) then lmc_send_keys('%>(B)', 50)
  elseif (button == string.byte('N')) then lmc_send_keys('%>(N)', 50)
  elseif (button == string.byte('M')) then lmc_send_keys('%>(M)', 50)
  elseif (button == string.byte(',')) then lmc_send_keys('%>(.)', 50)
  elseif (button == string.byte('.')) then lmc_send_keys('%>(,)', 50)
  elseif (button == string.byte('/')) then lmc_send_keys('%>(/)', 50)

  elseif (button == string.byte('F3')) then lmc_send_keys('%>{F3}', 50)

  else print('Not yet assigned: ' .. button)
  end
end)                                                                

tldr; how add multiple modifiers to lmc_send_keys()

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

Re: Using multiple modifiers

Post by admin » 04 Oct 2019, 08:02

If you need such control I would rather focus on lmc_send_input which gives you more possibilities.
Se recent example file here: https://github.com/me2d13/luamacros/blo ... ations.lua
It send alt+shift+key combinations for 'A' press. You can modify it to include ctrl and probably even choose left or right (see MSDN doc for send_input)
Petr Medek
LUAmacros author

Post Reply