EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsMouseButtonPressed(3) and IsKeyLockOn("numlock") then
-- first group of moves: 10 steps in direction (-1,13), total group time = 750 ms
for i = 1, 10 do
MoveMouseRelative(-1,13)
Sleep(75)
if not IsMouseButtonPressed(1) then return end
end
-- second group of moves: 5 steps in direction (1,12), total group time = 375 ms
for i = 1, 5 do
MoveMouseRelative(1,12)
Sleep(75)
if not IsMouseButtonPressed(1) then return end
end
-- you can add more groups
end
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsMouseButtonPressed(3) and IsKeyLockOn("scrolllock") then
-- first group of moves: 10 steps in direction (-1,13), total group time = 750 ms
for i = 1, 10 do
MoveMouseRelative(-1,13)
Sleep(75)
if not IsMouseButtonPressed(1) then return end
end
-- second group of moves: 5 steps in direction (1,12), total group time = 375 ms
for i = 1, 5 do
MoveMouseRelative(1,12)
Sleep(75)
if not IsMouseButtonPressed(1) then return end
end
-- you can add more groups
end
end
更新:
步骤 0。
您将要修改鼠标左键的行为。
这是一个潜在的危险操作:没有 LMB,您几乎无法在计算机上执行任何操作。
所以你必须创建一个“备用 LMB”。
例如,如果你不使用 Mouse Button 8,你可以让它在 LMB 上表现得像一个克隆。
转到 LGS 中的大鼠标图片并将命令“左键单击”分配给您的物理 MB#8。
现在,如果出现问题并且您的 LMB 停止工作,您可以按 MB#8 而不是 LMB。
第 1 步
:您在游戏中使用鼠标按钮 4(“返回”)吗?
- 如果是(游戏中某些动作设置为 MB#4),则继续“步骤 2”。
- 如果否(游戏忽略 MB#4 按下),跳过“步骤 2”并继续进行“步骤 3”。
第 2 步。
您必须将游戏动作从 MB#4 重新映射到其他键。
请执行下列操作:
- 选择您当前未在游戏中使用的键盘键
(假设F12
当前未使用该键)
- 转到 LGS 中的大鼠标图片并将命令分配
F12
给您的物理 MB#4
- 转到您的游戏设置并将游戏操作设置为
F12
而不是 MB#4
因此,当您按下物理 MB#4 时,游戏会接收F12
并激活游戏动作。
现在跳过“步骤 3”并继续执行“步骤 4”。
Step 3.
进入 LGS 中的大鼠标图片。
从物理 MB#4 取消分配标准命令“返回”(从下拉菜单中选择“取消分配”)。
步骤 4.
设置脚本(见下文)。
步骤 5.
转到 LGS 中的大鼠标图片。
将命令“返回”分配给您的物理 LMB。
您将看到有关潜在危险操作的警告。
允许此操作,因为如果出现问题,您有“备用 LMB”。
-- rapid fire (CAPSLOCK) is independent from anti-recoil (NUMLOCK and SCROLLLOCK)
local rapid_fire_interval = 30 -- milliseconds between LMB press/release simulation
local LMB_down, rapid_fire, prev_time, next_LMB_time
local function PressOrReleaseLMB(only_release)
if LMB_down then
ReleaseMouseButton(1)
LMB_down = false
elseif not only_release then
PressMouseButton(1)
LMB_down = true
end
end
local function Sleep_with_rapid_fire(ms)
-- returns true if LMB was released by user
prev_time = prev_time + ms
while GetRunningTime() < prev_time do
Sleep(10)
if not IsMouseButtonPressed(4) then
return true
end
while rapid_fire and GetRunningTime() >= next_LMB_time then
next_LMB_time = next_LMB_time + rapid_fire_interval
PressOrReleaseLMB() -- press LMB (if it's up) or release LMB (if it's down)
end
end
end
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" or event == "MOUSE_BUTTON_RELEASED" and arg == 1 then
PressOrReleaseLMB(true) -- release LMB
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
PressOrReleaseLMB() -- press LMB
prev_time = GetRunningTime()
next_LMB_time = prev_time + rapid_fire_interval
rapid_fire = IsKeyLockOn("capslock")
if IsMouseButtonPressed(3) then -- RMB pressed
if IsKeyLockOn("numlock") then
-- first group of moves: 10 steps in direction (-1,13), total group time = 750 ms
for i = 1, 10 do
MoveMouseRelative(-1,13)
if Sleep_with_rapid_fire(75) then return end
end
-- second group of moves: 5 steps in direction (1,12), total group time = 375 ms
for i = 1, 5 do
MoveMouseRelative(1,12)
if Sleep_with_rapid_fire(75) then return end
end
-- you can add more groups
elseif IsKeyLockOn("scrolllock") then
-- first group of moves: 10 steps in direction (-1,13), total group time = 750 ms
for i = 1, 10 do
MoveMouseRelative(-1,13)
if Sleep_with_rapid_fire(75) then return end
end
-- second group of moves: 5 steps in direction (1,12), total group time = 375 ms
for i = 1, 5 do
MoveMouseRelative(1,12)
if Sleep_with_rapid_fire(75) then return end
end
-- you can add more groups
end
end
Sleep_with_rapid_fire(math.huge) -- until user released LMB
end
end