网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
12月05日漏签0天
罗技吧 关注:229,126贴子:386,767
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 1 2 3 下一页 尾页
  • 108回复贴,共3页
  • ,跳到 页  
<<返回罗技吧
>0< 加载中...

有人试过 Logitech Gaming Software 的 Lua 脚本功能么?

  • 只看楼主
  • 收藏

  • 回复
  • AndroidOL
  • 核心吧友
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


  • AndroidOL
  • 核心吧友
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
以下脚本实现了默认的 G1~G6 输出数字 1~6。
flag = 0
--ClearLog()
--[[
function getScanCode()
  OutputLogMessage("Call Function.\n")
  PressAndReleaseMouseButton(1)
end
]]--
function OnEvent(event, arg)
  --getScanCode()
  if (flag > 10) then
    ClearLog()
    flag = 0
  else
    flag = flag + 1
  end
  if (event == "G_PRESSED") then
    OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
    PressKey(1 + arg)
  end
  if (event == "G_RELEASED") then
    OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
    ReleaseKey(1 + arg)
  end
end


2025-12-05 14:19:50
广告
不感兴趣
开通SVIP免广告
  • AndroidOL
  • 核心吧友
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
以下代码实现 G1~G6 联合 M1~M3 输出数字 1~18。
flag = 0
--ClearLog()
--[[
function getScanCode()
  OutputLogMessage("Call Function.\n")
  PressAndReleaseMouseButton(1)
end
]]--
function OnEvent(event, arg)
  --getScanCode()
  if (flag > 10) then
    ClearLog()
    flag = 0
  else
    flag = flag + 1
  end
  if (GetMKeyState() == 1) then
    if (event == "G_PRESSED") then
      OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
      PressKey(1 + arg)
    end
    if (event == "G_RELEASED") then
      OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
      ReleaseKey(1 + arg)
    end
  elseif (GetMKeyState() == 2) then
    if (arg < 4) then
      PressAndReleaseKey(7 + arg)
    elseif (arg == 4) then
      PressAndReleaseKey(2)
      PressAndReleaseKey(11)
    else
      PressAndReleaseKey(2)
      PressAndReleaseKey(1 + arg - 4)
    end
  elseif (GetMKeyState() == 3) then
    PressAndReleaseKey(2)
    PressAndReleaseKey(3 + arg)
  else
    OutputLogMessage("Bad Input!")
  end
end


  • AndroidOL
  • 核心吧友
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
以下代码修正了第二段代码出现按下 M1~M3 时不必要的字符输出,并且处理了连续输出两次的问题。
flag = 0
--ClearLog()
--[[
function getScanCode()
  OutputLogMessage("Call Function.\n")
  PressAndReleaseMouseButton(1)
end
]]--
function OnEvent(event, arg)
  --getScanCode()
  if (flag > 10) then
    ClearLog()
    flag = 0
  else
    flag = flag + 1
  end
  flag_MKey = GetMKeyState()
  if (flag_MKey == 1) then
    if (event == "G_PRESSED") then
      OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
      PressKey(1 + arg)
    end
    if (event == "G_RELEASED") then
      OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
      ReleaseKey(1 + arg)
    end
  elseif (flag_MKey == 2) then
    if (arg < 4) then
      if (event == "G_PRESSED") then
        PressKey(7 + arg)
      end
      if (event == "G_RELEASED") then
        ReleaseKey(7 + arg)
      end
    elseif (arg == 4) then
      if (event == "G_PRESSED") then
        PressKey(2)
        PressKey(11)
      end
      if (event == "G_RELEASED") then
        ReleaseKey(2)
        ReleaseKey(11)
      end
    elseif (arg == 5) then
      if (event == "G_PRESSED") then
        PressKey(2)
        ReleaseKey(2)
        PressKey(1 + arg - 4)
      end
      if (event == "G_RELEASED") then
        --ReleaseKey(2)
        ReleaseKey(1 + arg - 4)
      end
    else
      if (event == "G_PRESSED") then
        PressKey(2)
        PressKey(1 + arg - 4)
      end
      if (event == "G_RELEASED") then
        ReleaseKey(2)
        ReleaseKey(1 + arg - 4)
      end
    end
  elseif (flag_MKey == 3) then
    if (event == "G_PRESSED") then
      PressKey(2)
      PressKey(3 + arg)
    end
    if (event == "G_RELEASED") then
      ReleaseKey(2)
      ReleaseKey(3 + arg)
    end
  else
    OutputLogMessage("Bad Input!")
  end
--[[
  if (arg == 1) then
    MoveMouseToVirtual(0, 0)
  elseif (arg == 2) then
    MoveMouseToVirtual(65535, 0)
  elseif (arg == 3) then
    MoveMouseToVirtual(0, 65535)
  elseif (arg == 4) then
    MoveMouseToVirtual(65535, 65535)
  else
    MoveMouseToVirtual(65535 / 2, 65535 / 2)
  end
]]--
end


  • AndroidOL
  • 核心吧友
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
增加 M Key 判断
flag = 0
--ClearLog()
--[[
function getScanCode()
  OutputLogMessage("Call Function.\n")
  PressAndReleaseMouseButton(1)
end
]]--
function OnEvent(event, arg)
  --getScanCode()
  if (flag > 10) then
    ClearLog()
    flag = 0
  else
    flag = flag + 1
  end
  flag_MKey = GetMKeyState()
  if (event == "M_PRESSED") then
    OutputLogMessage("M%d-Key was pressed. Event time: %s!\n", arg, GetDate())
    flag_MKey = arg
  elseif (event == "M_RELEASED") then
    OutputLogMessage("M%d-Key was released. Event time: %s!\n", arg, GetDate())
    flag_MKey = arg
  elseif (flag_MKey == 1) then
    if (event == "G_PRESSED") then
      OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
      PressKey(1 + arg)
    end
    if (event == "G_RELEASED") then
      OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
      ReleaseKey(1 + arg)
    end
  elseif (flag_MKey == 2) then
    if (arg < 4) then
      if (event == "G_PRESSED") then
        OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
        PressKey(7 + arg)
      end
      if (event == "G_RELEASED") then
        OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
        ReleaseKey(7 + arg)
      end
    elseif (arg == 4) then
      if (event == "G_PRESSED") then
        OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
        PressKey(2)
        PressKey(11)
      end
      if (event == "G_RELEASED") then
        OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
        ReleaseKey(2)
        ReleaseKey(11)
      end
    elseif (arg == 5) then
      if (event == "G_PRESSED") then
        OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
        PressKey(2)
        ReleaseKey(2)
        PressKey(1 + arg - 4)
      end
      if (event == "G_RELEASED") then
        OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
        --ReleaseKey(2)
        ReleaseKey(1 + arg - 4)
      end
    else
      if (event == "G_PRESSED") then
        OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
        PressKey(2)
        PressKey(1 + arg - 4)
      end
      if (event == "G_RELEASED") then
        OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
        ReleaseKey(2)
        ReleaseKey(1 + arg - 4)
      end
    end
  elseif (flag_MKey == 3) then
    if (event == "G_PRESSED") then
      OutputLogMessage("G%d-Key was pressed. Event time: %s!\n", arg, GetDate())
      PressKey(2)
      PressKey(3 + arg)
    end
    if (event == "G_RELEASED") then
      OutputLogMessage("G%d-Key was released. Event time: %s!\n", arg, GetDate())
      ReleaseKey(2)
      ReleaseKey(3 + arg)
    end
  else
    OutputLogMessage("Bad Input!")
  end
end


  • zzxxccwql
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
- -这是你哪找来的...能发一下么..我想试着学着用.


  • 天游盒饭
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
偶就一个g502的鼠标
知道怎么写一段 按下鼠标4键就开始一段循环脚本 再按下就能停止脚本运行么喵。。


  • 冻死的覀瓜
  • 铁杆吧友
    9
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
求解这个脚本有什么用?


2025-12-05 14:13:50
广告
不感兴趣
开通SVIP免广告
  • atgjateeq
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
大神求助。怎样通过g键来控制鼠标位置,并点击。万分感谢。。。


  • micmil
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
我用罗技G602,实现了星际争霸2的 p一键刷兵
实现了T的一键造兵、一键甩枪兵
Z的一键造兵,一键注卵
所有3族的一键造农民


  • 1051bigbang
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
@micmil
@AndroidOL
翻译的中文版在哪 QQ多少啊 我想学 甩鼠标指令MoveMouseTo 这种 教教我好吗 我小白


  • AndroidOL
  • 核心吧友
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
@1051bigbang 帮助文档写的也挺详细的。
比如 MoveMouseTo:
The MoveMouseTo() function is used to move the mouse cursor to an absolute position on the screen.
比如 GetMousePosition:
The GetMousePosition() function returns the normalized coordinates of the current mouse cursor location.
既然知道函数作用就可以写代码了,比如水平向右移动屏幕的1/10距离:
x, y = GetMousePosition();
MoveMouseTo(x + 65535*(1/10), y)
结合上面的代码,在G1或其他键按下或松开的时候触发代码。
if (event == "G_PRESSED") then
x, y = GetMousePosition();
MoveMouseTo(x + 65535*(1/10), y)
end
就可以避免触发两次了。


  • AndroidOL
  • 核心吧友
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
@1051bigbang 能不能说串指令 比如 转180度之后按下S+右键这样的
if (event == "G_PRESSED") then
x, y = GetMousePosition();
MoveMouseTo(x + 65535*(1/10), y)
Sleep(10)
PressKey("a")
PressMouseButton(3)
ReleaseKey("s")
end


  • AndroidOL
  • 核心吧友
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
if (event == "G_PRESSED") then
x, y = GetMousePosition();
MoveMouseTo(x + 65535*(1/10), y)
Sleep(10)
PressKey("s")
PressMouseButton(3)
ReleaseMouseButton(3)
ReleaseKey("s")
end
上面再编辑的时候按倒ctrl+enter了


2025-12-05 14:07:50
广告
不感兴趣
开通SVIP免广告
  • 1051bigbang
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 1 2 3 下一页 尾页
  • 108回复贴,共3页
  • ,跳到 页  
<<返回罗技吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示