坚持“ ismousebuttonpressed”状况
我尝试随时为LGHUB进行流产写脚本。当我按G5时,按G1按钮按G1按钮,并发布G1,如果我发布G5。
我不是很有经验的lua用户,我使用了书面代码,但是我了解逻辑以及该代码的工作原理,但是问题是,该脚本在开始时正在逐步中止,但是不是。我一遍又一遍地阅读我的脚本,但我不明白代码中有什么问题。
例如,当我使用“ exiting = not ismodifierPressed(“ ctrl”)”时 - 它可以按照假定的方式工作,通过取消压制控制
脚本,它非常简单,让我们看一下:
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
感谢您的帮助和关注!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用“ ismousebuttonpressed” - 确保,该按钮在GHUB应用中起作用,我不确定我对bonded Macroses on Button上的脚本的感情,无论您的按钮是否具有默认按钮,该按钮都绑定,此按钮能够与“ Ismousebuttonpressed”相关,在其他方面无法进行。感谢您的关注!
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!