罗技压枪脚本教学 |
您所在的位置:网站首页 › 罗技402cf瞬狙鼠标宏 › 罗技压枪脚本教学 |
虽然用于游戏不是好东西,但是还是想分享下 不多bb,直接上一个宏的代码,我们逐步分析(代码源于网络,略加修改),如果大佬想自己完成可以考虑直接api自己写,关键词:G-series Lua API 。 --step是压枪强度,recoil的是启动判断变量 local click = false local recoil = false local step = 8 function OnEvent(event, arg) --输出按键,方便你多个功能键能区分 OutputLogMessage("event = %s, arg = %d\n", event, arg) --判断你得按键,6是关,5是消弱,4是增强,3是还原 if (event == "MOUSE_BUTTON_PRESSED" and arg == 7) then recoil = true end if (event == "MOUSE_BUTTON_PRESSED" and arg == 6 ) then recoil = false end if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then if (recoil == false) then recoil = true else step = step * 0.8 end end if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then if (recoil == false) then recoil = true else step = step * 1.25 end end if (event == "MOUSE_BUTTON_PRESSED" and arg == 3) then step = 8 end --以下是核心触发内容,大概意思就是当if成立,调整click值,并持续按下(MOUSE_BUTTON_PRESSED是按下按键的条件) if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil and not IsModifierPressed("lalt")) then click = true SetMKeyState(3) end --大概意思就是当if成立,调整click值(MOUSE_BUTTON_RELEASED是释放按键的意思) if (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then click = false end --核心操作,上面SetMKeyState(3),这里接着判断,通过后会触发按下1,停止12ms,释放1,向下移动step。 --大概就是按下左键,这里给循环:鼠标下移-睡眠-鼠标下移,完成压枪的操作 if (event == "M_RELEASED" and arg == 3 and click) then PressMouseButton(1) Sleep(12) ReleaseMouseButton(1) MoveMouseRelative(0, step) if click then SetMKeyState(3) end end end扩展思维: 反复测试可以获取固定的step值(可能是函数),完成完美压枪游戏内会有左右扩散的,可以在MoveMouseRelative(0, step)附近考虑如何操作现在,已经有了一个简单的压枪程序了。不同代码有不同的实现方式,这里仅提供一种,已经是个成熟的程序猿了,多的自己看api文档。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |