Hi there,
I have a portable which doesn't have the NUMLOCKPLUS and NUMLOCKMINUS... So I resorted to buying a small extension keyboard (half the size / function keys only go to F5) and remapping it as follows :
In Autohotkey :
F10::NumPadAdd
F11::NumPadSub
F12::NumPadMult
And in LUAMacros (used the sample code from the Wiki) :
lmc_assign_keyboard('MACROS');
lmc_set_handler('MACROS',function(button, direction)
if (direction == 1) then return end -- ignore down
if (button == string.byte('Q')) then lmc_send_keys('{F10}')
elseif (button == string.byte('W')) then lmc_send_keys('{F11}')
elseif (button == string.byte('E')) then lmc_send_keys('{F12}')
else print('Not yet assigned: ' .. button)
end
end)
In W10, this works - I've opened a keyboard tester and the Q/W and E on my halfsized keyboard, resolve to +, - and *
But in Commandos (the GOG version), this doesn't seem to do anything. F10/F11/F12 on my portable work, Q/W/E on my half keyboard do nothing.
Any suggestions would be very appreciated
/dimi
UPDATE : As I realized that the Autohotkey part was overkill and redundant, I modified it to (still nothing being triggered in that game though):
if (button == string.byte('Q')) then lmc_send_keys('{NUMPLUS}')
elseif (button == string.byte('W')) then lmc_send_keys('{NUMMINUS}')
elseif (button == string.byte('E')) then lmc_send_keys('{NUMMULTIPLY}')
No "result" in an old game? Commandos 1...
Re: No "result" in an old game? Commandos 1...
Ahh, Commandos 1, I remember
Anyway I'm afraid there's not much to be done. Some games can read keyboard directly and not using windows events. In that case those "fake inputs" aka virtual key-presses won't work.
The only other thing you can try is to use lmc_send_input which is using different windows function (then lmc_send_keys) to send key presses from macro.
Anyway I'm afraid there's not much to be done. Some games can read keyboard directly and not using windows events. In that case those "fake inputs" aka virtual key-presses won't work.
The only other thing you can try is to use lmc_send_input which is using different windows function (then lmc_send_keys) to send key presses from macro.
Petr Medek
LUAmacros author
LUAmacros author
Re: No "result" in an old game? Commandos 1...
Hi there Petr,
Thanks so much for the kind and helpful reply - that explains a lot indeed I'm currently at work but that alternative function (lmc_send_input) : will give it a go this evening... And if it doesn't work : that would be a pity but there should be a different "fix" out there that involves some hex editing. And besides that : Commandos is still brilliant but I've been doing some LuaMacros magic last night and I'm impressed : made some macros for my Firefox, after that I dabbled in Premiere and Lightroom for some macros and it has already helped me to be more productive. And faster while working, that too So my thanks for making this! Commandos might not work but everything else does And also my thanks for supporting it, sincerely appreciated!
/dimi
Thanks so much for the kind and helpful reply - that explains a lot indeed I'm currently at work but that alternative function (lmc_send_input) : will give it a go this evening... And if it doesn't work : that would be a pity but there should be a different "fix" out there that involves some hex editing. And besides that : Commandos is still brilliant but I've been doing some LuaMacros magic last night and I'm impressed : made some macros for my Firefox, after that I dabbled in Premiere and Lightroom for some macros and it has already helped me to be more productive. And faster while working, that too So my thanks for making this! Commandos might not work but everything else does And also my thanks for supporting it, sincerely appreciated!
/dimi
Re: No "result" in an old game? Commandos 1...
And alas : lmc_send_input also didn't work
Wrote this :
And same story : works in Windows / doesn't work in Commandos... Oh well / it was a fun exercise
thanks again!
/dimi
Wrote this :
Code: Select all
...
elseif (button == string.byte('E')) then F109()
...
function F109()
lmc_send_input(109, 0, 0) -- press +
lmc_send_input(109, 0, 2) -- release +
end
thanks again!
/dimi