Finding a Key Already in Use

Announcements, general discussion
Post Reply
Rwelk137
Posts: 5
Joined: 25 Jan 2018, 07:46

Finding a Key Already in Use

Post by Rwelk137 » 11 Mar 2018, 03:01

Just a quick question question. When I'm configuring keys with my mini-keyboard, most of the keys not in use get shut off and the code returns the whatever key I'm trying to type with in the little window beneath the code as per the line

Code: Select all

 else print('Not yet assigned: ' .. button) 
But what if a button is already in use? Is there a way I check the value of a button that's already being used for something so I can map it to something else?

Rwelk137
Posts: 5
Joined: 25 Jan 2018, 07:46

Re: Finding a Key Already in Use

Post by Rwelk137 » 11 Mar 2018, 03:07

For reference, I'm trying to remap the arrow keys with the code

Code: Select all

  elseif (button == 188) then
    lmc_send_input(37, 0, 0) -- press LEFT ARROW
    lmc_send_input(37, 0, 1) -- release LEFT ARROW
  elseif (button == 46) then
    lmc_send_input(39, 0, 0) -- press RIGHT ARROW
    lmc_send_input(39, 0, 1) -- release RIGHT ARROW 
A bug that I'm noticing is that when I press the keys, the cursor moves left or right two spaces rather than one. Any help with that would also be appreciated.

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

Re: Finding a Key Already in Use

Post by admin » 12 Mar 2018, 09:35

Rwelk137 wrote:
11 Mar 2018, 03:01
But what if a button is already in use? Is there a way I check the value of a button that's already being used for something so I can map it to something else?
You can put the print command at beginning of the callback handler, not to the last else, can't you?
Petr Medek
LUAmacros author

Post Reply