G502(X)通用射击游戏宏
2025年3月9日约 563 字大约 2 分钟...
射击游戏G502/G502X通用宏
仅在G502X上测试过,使用G HUB版本为2025.2.687008。
必须安装G HUB,其他罗技鼠标可能在修改键位后兼容。
简介
通过鼠标滚轮左G10(-)右G11(+)来控制自动压枪力度
通过按住射击精度键G6的方式切换修改垂直/水平后座,按下以在控制台显示当前速率
通过内存切换键G9开关此宏
基础代码借鉴自Bilibili@第一局永远tec-9
关于版权
原作者声明放弃版权公开,但此修改版保留版权并根据GPL-3.0 license许可,但有以下限制(优先于GPL-3.0):
未经作者明确许可,您不得出售、授权或以其他方式收取此代码的费用,包括但不限于销售软件或将其纳入商业产品产生盈利的部分(例如收费使用或者插入广告)。
代码
EnablePrimaryMouseButtonEvents(1)
speed = 12.0 -- 默认垂直速度
hori = 0.0 -- 默认水平速度
vert_mult = 2.0-- 默认垂直修改速度
hori_mult = 0.5-- 默认水平修改速度
k = true -- 默认开启
adjustHorizontal = false -- 标记是否处于水平调整模式
function OnEvent(event, arg)
-- OutputLogMessage("Event: " .. event .. " Arg: " .. arg .. "\n")
if (event == "MOUSE_BUTTON_PRESSED" and arg == 9) then
k = not k
if k then
OutputLogMessage("kai\n")
else
OutputLogMessage("guan\n")
end
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
adjustHorizontal = true
OutputLogMessage("Horizontal adjustment mode activated\n")
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 5) then
adjustHorizontal = false
OutputLogMessage("Current vertical speed: " .. string.format("%.1f", speed) .. "\n")
OutputLogMessage("Current horizontal speed: " .. string.format("%.1f", hori) .. "\n")
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 8) then
if adjustHorizontal then
hori = hori + hori_mult
OutputLogMessage("Horizontal speed increased to: " .. string.format("%.1f", hori) .. "\n")
else
speed = speed + vert_mult
OutputLogMessage("Vertical speed increased to: " .. string.format("%.1f", speed) .. "\n")
end
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 7) then
if adjustHorizontal then
hori = hori - hori_mult
OutputLogMessage("Horizontal speed decreased to: " .. string.format("%.1f", hori) .. "\n")
else
speed = speed - vert_mult
OutputLogMessage("Vertical speed decreased to: " .. string.format("%.1f", speed) .. "\n")
end
end
if k then
Sleep(50)
if IsMouseButtonPressed(1) then
if IsMouseButtonPressed(3) then
MoveMouseRelative(hori, speed)
repeat
Sleep(5)
MoveMouseRelative(hori, speed)
until not IsMouseButtonPressed(1) or not IsMouseButtonPressed(3)
end
end
end
end
本文为作者武乙凌薇原创内容,转载请注明出处并附上原文链接。(blog.wuyilingwei.com)