【发布时间】:2022-06-16 06:41:52
【问题描述】:
软件 = 罗技 G 集线器
我是 Lua 的新手,我很难找到与我想要完成的任务直接相关的信息。
我正在尝试为我喜欢玩的游戏编写一个反冲脚本,但更重要的是同时实际学习一些新东西。
我已经设置了一个功能,当我想使用的枪被激活/停用的输出消息时显示。我还做了一个修改器,设置为 Left Ctrl 以补偿蹲伏与站立时较低的后坐力。
后坐力模式基本上是下降,然后向左下降,然后再次下降并回到左侧。
我尝试使用 MoveMouseRelative,但它只会将鼠标拉到我写的最后一个数字,例如 (-2,0)。
我怎样才能使它遵循一个模式?比如向下 1 秒,然后对角线 1 秒,依此类推......
我还想在我的脚本中添加 x 和 y 表,而不是逐行添加 MoveMouseRelative 但真的不知道。
---GUN MODES---
local AK47_ = 8
local AK47_Keyboard = nil
---RECOIL TABLES---
local recoil_table = {}
recoil_table["AK47"] = {
basic = {20,20,20,20}
}
EnablePrimaryMouseButtonEvents(true);
local recoil = falseB
local weapon = 0
function OnEvent(event, arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == AK47_) or
(event == "G_PRESSED" and arg == AK47_Keyboard) then
recoil = not recoil
weapon = arg
if (recoil == false) then
OutputLogMessage("OFF-Macro-AK47\n")
if IsKeyLockOn("numlock") then
PressAndReleaseKey("numlock")
end
else
OutputLogMessage("ON-NoRecoil-AK47\n")
if not IsKeyLockOn("numlock") then
PressAndReleaseKey("numlock")
end
end
elseif weapon == AK47_ or weapon == AK47_Keyboard then if recoil ==true then
if(IsModifierPressed("lctrl"))then
AK47crouch()
else
AK47()
end
end
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
function AK47()
if IsMouseButtonPressed(3) then
repeat
if IsMouseButtonPressed(1) then
repeat
MoveMouseRelative(-2, 4)
Sleep(10)
until not IsMouseButtonPressed(1)
end
until not IsMouseButtonPressed(3)
end
end
end
function AK47crouch()
if IsMouseButtonPressed(3) then
Sleep(20)
repeat
if IsMouseButtonPressed(1) then
repeat
Sleep(19)
MoveMouseRelative(0,2)
until not IsMouseButtonPressed(1)
end
until not IsMouseButtonPressed(3)
end
end
end
【问题讨论】:
标签: lua scripting macros logitech-gaming-software