Lua g502 脚本
Lua script for g502
我正在尝试为我的鼠标制作一个游戏脚本。基本上这是它必须做的:
- 当 num lock 关闭时,他必须在每次同时单击鼠标右键和鼠标左键时按 q 键
- 当 num lock 开启时,他必须执行第 1 段,但是当我按住鼠标右键 (ads) 时按下 f 键并在鼠标右键按下时再次按下 f 键
发布
这是我一直在尝试编写但无法理解我请求的第二部分的代码:
感谢您的帮助:)
local zoomed = false
local weapons = true
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == 2 and weapons) then
zoomed = true
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 2 and weapons) then
zoomed = false
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and zoomed) then
PressKey("q")
ReleaseKey("q")
end
if IsKeyLockOn("numlock")then
if (event == "MOUSE_BUTTON_PRESSED" and arg == 2) then
PressKey("f")
Sleep(5)
ReleaseKey("f")
end
end
end
设置标志 press_F_on_RMB_release
以了解应该在下一次鼠标右键释放事件中按下 F
。
local RMB_pressed = false
local press_F_on_RMB_release = false
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 2 then
RMB_pressed = true
elseif event == "MOUSE_BUTTON_RELEASED" and arg == 2 then
RMB_pressed = false
if press_F_on_RMB_release then
PressKey("f")
Sleep(30)
ReleaseKey("f")
press_F_on_RMB_release = false
end
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and RMB_pressed then
PressKey("q")
Sleep(30)
ReleaseKey("q")
if IsKeyLockOn("numlock") then
PressKey("f")
Sleep(30)
ReleaseKey("f")
press_F_on_RMB_release = true
end
end
end
我正在尝试为我的鼠标制作一个游戏脚本。基本上这是它必须做的:
- 当 num lock 关闭时,他必须在每次同时单击鼠标右键和鼠标左键时按 q 键
- 当 num lock 开启时,他必须执行第 1 段,但是当我按住鼠标右键 (ads) 时按下 f 键并在鼠标右键按下时再次按下 f 键 发布
这是我一直在尝试编写但无法理解我请求的第二部分的代码:
感谢您的帮助:)
local zoomed = false
local weapons = true
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == 2 and weapons) then
zoomed = true
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 2 and weapons) then
zoomed = false
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and zoomed) then
PressKey("q")
ReleaseKey("q")
end
if IsKeyLockOn("numlock")then
if (event == "MOUSE_BUTTON_PRESSED" and arg == 2) then
PressKey("f")
Sleep(5)
ReleaseKey("f")
end
end
end
设置标志 press_F_on_RMB_release
以了解应该在下一次鼠标右键释放事件中按下 F
。
local RMB_pressed = false
local press_F_on_RMB_release = false
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 2 then
RMB_pressed = true
elseif event == "MOUSE_BUTTON_RELEASED" and arg == 2 then
RMB_pressed = false
if press_F_on_RMB_release then
PressKey("f")
Sleep(30)
ReleaseKey("f")
press_F_on_RMB_release = false
end
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and RMB_pressed then
PressKey("q")
Sleep(30)
ReleaseKey("q")
if IsKeyLockOn("numlock") then
PressKey("f")
Sleep(30)
ReleaseKey("f")
press_F_on_RMB_release = true
end
end
end