第 1 步。
确保您没有在游戏中使用 MB#4(“后退”)。
如果您在游戏中不使用 MB#4,请跳过“步骤 1”。
如果在游戏中为 MB#4 分配了某些操作,请执行以下操作:
- 选择您当前未在游戏中使用的键盘按钮(例如,
F12
)
- 转到 GHUB(键选项卡);绑定
F12
到您的物理 MB#4
- 转到游戏选项;将操作绑定到
F12
而不是 MB#4
现在,当您按下物理 MB#4 时,游戏会看到 F12 并激活您的旧操作。
步骤 2.
转到 GHUB(系统选项卡)
从 MB#4 取消绑定
“返回”将“返回”绑定到 MB#6
步骤 3.
脚本。
local all_buttons = {
[4] = { -- mouse button #6
{time=0, x=50 }, -- at time 0 move mouse right 50 pixels
{time=150, x=-50}, -- at time 150 move mouse left 50 pixels
{time=150+1500}, -- at time 150+1500 repeat the loop
},
[3] = { -- right mouse button
{time=0, y=50}, -- at time 0 move mouse down 50 pixels
{time=1000}, -- at time 1000 repeat the loop
}
}
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_PRESSED" then
repeat
Sleep(10)
local tm = GetRunningTime()
local some_loop_is_active
for btn_no, info in pairs(all_buttons) do
if not info.started and IsMouseButtonPressed(btn_no) then
info.started = tm
info.next_step = 1
end
some_loop_is_active = some_loop_is_active or info.started
local next_action = info[info.next_step]
if info.started and tm - info.started >= next_action.time then
info.next_step = info.next_step + 1
local x, y = next_action.x, next_action.y
if x or y then
x, y = x or 0, y or 0
local sx, sy = x < 0 and -1 or 1, y < 0 and -1 or 1
x, y = x*sx, y*sy
while x > 0 or y > 0 do
local px, py = x < 127 and x or 127, y < 127 and y or 127
MoveMouseRelative(px*sx, py*sy)
x, y = x-px, y-py
end
else
info.started = nil
end
end
end
until not some_loop_is_active
end
end
您应该知道 MoveMouseRelative() 被限制为 127 像素。
要将鼠标光标移动 300 像素,您应该调用它 3 次:
MoveMouseRelative(0,100);MoveMouseRelative(0,100);MoveMouseRelative(0,100)