外设天下 - 电脑外设发烧友聚集地

Logitech Gaming Software G 系列 Lua API 中文参考文档 | 更新 RGB 渐变及键值输出

查看数: 264674 | 评论数: 46 | 收藏 4
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2014-9-20 21:11

正文摘要:

本帖最后由 AndroidOL 于 2014-10-13 15:58 编辑   自从入了第一把机械后就在外设长期潜水(似乎没注册帐号应该连潜水也算不上吧),最近由于某些需求需要使用一些脚本就行自动操作,无意间发现 Logitech Gamin ...

回复

AndroidOL 发表于 2014-9-21 08:03

LUA 接近于自然语言编程所以应该不会有多少学习障碍。

if (event == "G_RELEASED") then
 ReleaseKey(2)
 ReleaseKey(1 + arg - 4)
end

如果 (事件 为 G键释放) 则
 释放按键 2
 释放按键 1 + arg - 4
结束
AndroidOL 发表于 2014-9-21 13:42

调用 API 移动鼠标以及输出按键信息

本帖最后由 AndroidOL 于 2014-10-12 15:30 编辑
  1. flag = 0
  2. --ClearLog()

  3. --[[
  4. function getScanCode()
  5.   OutputLogMessage("Call Function.\n")
  6.   PressAndReleaseMouseButton(1)
  7. end
  8. ]]--

  9. function OnEvent(event, arg)
  10.   --getScanCode()
  11.   if (flag > 10) then
  12.     ClearLog()
  13.     flag = 0
  14.   else
  15.     flag = flag + 1
  16.   end
  17.   flag_MKey = GetMKeyState()
  18.   if (event == "M_PRESSED") then
  19.     OutputLogMessage("M%d-Key was pressed. Event time: %s!\n", arg, GetDate())
  20.     flag_MKey = arg
  21.   elseif (event == "M_RELEASED") then
  22.     OutputLogMessage("M%d-Key was released. Event time: %s!\n", arg, GetDate())
  23.     flag_MKey = arg
  24.   elseif (flag_MKey == 1) then
  25.     if (event == "G_PRESSED") then
  26.       OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
  27.       PressKey(1 + arg)
  28.     end
  29.     if (event == "G_RELEASED") then
  30.       OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
  31.       ReleaseKey(1 + arg)
  32.     end
  33.   elseif (flag_MKey == 2) then
  34.     if (arg < 4) then
  35.       if (event == "G_PRESSED") then
  36.         OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
  37.         PressKey(7 + arg)
  38.       end
  39.       if (event == "G_RELEASED") then
  40.         OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
  41.         ReleaseKey(7 + arg)
  42.       end
  43.     elseif (arg == 4) then
  44.       if (event == "G_PRESSED") then
  45.         OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
  46.         PressKey(2)
  47.         PressKey(11)
  48.       end
  49.       if (event == "G_RELEASED") then
  50.         OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
  51.         ReleaseKey(2)
  52.         ReleaseKey(11)
  53.       end
  54.     elseif (arg == 5) then
  55.       if (event == "G_PRESSED") then
  56.         OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
  57.         PressKey(2)
  58.         ReleaseKey(2)
  59.         PressKey(1 + arg - 4)
  60.       end
  61.       if (event == "G_RELEASED") then
  62.         OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
  63.         --ReleaseKey(2)
  64.         ReleaseKey(1 + arg - 4)
  65.       end
  66.     else
  67.       if (event == "G_PRESSED") then
  68.         OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
  69.         PressKey(2)
  70.         PressKey(1 + arg - 4)
  71.       end
  72.       if (event == "G_RELEASED") then
  73.         OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
  74.         ReleaseKey(2)
  75.         ReleaseKey(1 + arg - 4)
  76.       end
  77.     end
  78.   elseif (flag_MKey == 3) then
  79.     if (event == "G_PRESSED") then
  80.       OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
  81.       PressKey(2)
  82.       PressKey(3 + arg)
  83.     end
  84.     if (event == "G_RELEASED") then
  85.       OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
  86.       ReleaseKey(2)
  87.       ReleaseKey(3 + arg)
  88.     end
  89.   else
  90.     OutputLogMessage("Bad Input!")
  91.   end
  92. --[[
  93.   if (arg == 1) then
  94.     MoveMouseToVirtual(0, 0)
  95.   elseif (arg == 2) then
  96.     MoveMouseToVirtual(65535, 0)
  97.   elseif (arg == 3) then
  98.     MoveMouseToVirtual(0, 65535)
  99.   elseif (arg == 4) then
  100.     MoveMouseToVirtual(65535, 65535)
  101.   else
  102.     MoveMouseToVirtual(65535 / 2, 65535 / 2)
  103.   end
  104. ]]--
  105. end
复制代码
AndroidOL 发表于 2014-9-21 10:51
硬伤啊,才发现居然一秒检测一次,理论无法执行超过一秒的脚本。。。
jihang1991 发表于 2014-9-20 22:16
没看懂- -
亲切的黄瓜 发表于 2014-9-20 22:11
貌似很高端
AndroidOL 发表于 2014-9-20 21:14

使用 G1~G6 联合 M1~M3 输出数字 1~18 且不影响原功能

本帖最后由 AndroidOL 于 2014-10-12 19:25 编辑
  1. flag = 0
  2. --ClearLog()

  3. --[[
  4. function getScanCode()
  5.   OutputLogMessage("Call Function.\n")
  6.   PressAndReleaseMouseButton(1)
  7. end
  8. ]]--

  9. function OnEvent(event, arg)
  10.   --getScanCode()
  11.   if (flag > 10) then
  12.     ClearLog()
  13.     flag = 0
  14.   else
  15.     flag = flag + 1
  16.   end
  17.   flag_MKey = GetMKeyState()
  18.   if (flag_MKey == 1) then
  19.     if (event == "G_PRESSED") then
  20.       OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
  21.       PressKey(1 + arg)
  22.     end
  23.     if (event == "G_RELEASED") then
  24.       OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
  25.       ReleaseKey(1 + arg)
  26.     end
  27.   elseif (flag_MKey == 2) then
  28.     if (arg < 4) then
  29.       if (event == "G_PRESSED") then
  30.         PressKey(7 + arg)
  31.       end
  32.       if (event == "G_RELEASED") then
  33.         ReleaseKey(7 + arg)
  34.       end
  35.     elseif (arg == 4) then
  36.       if (event == "G_PRESSED") then
  37.         PressKey(2)
  38.         PressKey(11)
  39.       end
  40.       if (event == "G_RELEASED") then
  41.         ReleaseKey(2)
  42.         ReleaseKey(11)
  43.       end
  44.     elseif (arg == 5) then
  45.       if (event == "G_PRESSED") then
  46.         PressKey(2)
  47.         ReleaseKey(2)
  48.         PressKey(1 + arg - 4)
  49.       end
  50.       if (event == "G_RELEASED") then
  51.         --ReleaseKey(2)
  52.         ReleaseKey(1 + arg - 4)
  53.       end
  54.     else
  55.       if (event == "G_PRESSED") then
  56.         PressKey(2)
  57.         PressKey(1 + arg - 4)
  58.       end
  59.       if (event == "G_RELEASED") then
  60.         ReleaseKey(2)
  61.         ReleaseKey(1 + arg - 4)
  62.       end
  63.     end
  64.   elseif (flag_MKey == 3) then
  65.     if (event == "G_PRESSED") then
  66.       PressKey(2)
  67.       PressKey(3 + arg)
  68.     end
  69.     if (event == "G_RELEASED") then
  70.       ReleaseKey(2)
  71.       ReleaseKey(3 + arg)
  72.     end
  73.   else
  74.     OutputLogMessage("Bad Input!")
  75.   end
  76. --[[
  77.   if (arg == 1) then
  78.     MoveMouseToVirtual(0, 0)
  79.   elseif (arg == 2) then
  80.     MoveMouseToVirtual(65535, 0)
  81.   elseif (arg == 3) then
  82.     MoveMouseToVirtual(0, 65535)
  83.   elseif (arg == 4) then
  84.     MoveMouseToVirtual(65535, 65535)
  85.   else
  86.     MoveMouseToVirtual(65535 / 2, 65535 / 2)
  87.   end
  88. ]]--
  89. end
复制代码
周木木 发表于 2024-3-15 14:55
怎么下载
[发帖际遇]: 周木木 在lol排位中连跪20局 奖励2 元 发烧值,偷偷安慰你一下. 幸运榜 / 衰神榜
_private 发表于 2021-9-2 14:29
楼主牛逼。翻译文档绝对称得上是“功在当代利在千秋”。CSDN和百度文库之类网站卖的资源不知道是不是盗的你的。
[发帖际遇]: _private的女朋友操劳过度漏气了,赞助11 元 发烧值购买新的. 幸运榜 / 衰神榜
402951015 发表于 2018-1-15 01:49
尝试了好久…还是不会弄这些代码语言…能不能请楼主帮忙写个脚本,循环鼠标5键的宏100次然后执行鼠标4键一次,一直循环这套操作,F3作为总开关2014年的贴…还是试试运气吧
idwma 发表于 2016-2-19 11:21
厉害,怎样实现左键按住就循环双击(间隔延时随机为50到100毫秒之间),左键放开就停止
AndroidOL 发表于 2016-2-2 15:50

有啥看不懂的。。。右键配置文档点脚本就行了。
天使是你吗 发表于 2016-2-1 08:48
看不懂啊

点评

有啥看不懂的。。。右键配置文档就行了。  详情 回复 发表于 2016-2-2 15:50
AndroidOL 发表于 2016-1-31 20:22
卖肾看大家装逼 发表于 2015-12-9 10:32
哇哇,程序猿都吊啊,顶顶顶

客气了:)
卖肾看大家装逼 发表于 2015-12-9 10:32
哇哇,程序猿都吊啊,顶顶顶

点评

客气了:)  详情 回复 发表于 2016-1-31 20:22
来自安卓客户端来自安卓客户端
AndroidOL 发表于 2015-12-8 22:04
剑开天门 发表于 2015-8-27 04:57
路人表示看不懂!今天无意在贴吧看见的,赶脚好高端,求教脚罗技脚本怎么使用?

直接使用就可以了。。。
剑开天门 发表于 2015-8-27 04:57
路人表示看不懂!今天无意在贴吧看见的,赶脚好高端,求教脚罗技脚本怎么使用?

点评

直接使用就可以了。。。  详情 回复 发表于 2015-12-8 22:04