'Stuck with "IsMouseButtonPressed" condition
I've tryed write script with abortion at any time for LGHUB. Script pressing G1 Button, when i'm pressing G5, and releases G1, if i release G5.
I'm not very much experienced user of Lua, cos of it i used written code, but i understand logic and how this code works, but problem is, that script is aborting right at start like G5 released, but it is not. I read my script over and over, but i didnt understand what wrong in code.
For example, when i'm using "exiting = not IsModifierPressed("ctrl")" - it works as supposed, by unpressing control
Script, it's quite simple, let's take a look:
function OnEvent(event, gkey, family)
OutputLogMessage(event, arg)
if ((event == "MOUSE_BUTTON_PRESSED" and gkey == 5) and IsModifierPressed("ctrl")
and IsKeyLockOn("scrolllock")
and IsModifierPressed("ctrl")) then
repeat
PressKey("c")
Sleep(10)
PressMouseButton(1)
ReleaseKey("c")
local tm = GetRunningTime()
local exiting
repeat
Sleep(50)
exiting = not IsMouseButtonPressed(5) --not working
until exiting or GetRunningTime() - tm > 10000
ReleaseMouseButton(1)
Sleep(10)
until exiting
end
end
Thanks for help and ur attention!
Solution 1:[1]
If u use "IsMouseButtonPressed" - be sure, that button is functional in GHUB app, i'm not sure about affection to script from binded macroses on button, whatever, if ur button has (for example G5) has default bind, this button be able to interract with "IsMouseButtonPressed", in other ways it s could not. Thanks for attention!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Okhota.Krepkaya |
