我提前道歉,因为我确信这已经得到了回答,但是没有任何编程经验,我很难将其他帖子中的解决方案翻译成我自己的代码。我有一个 for 循环,我想在每个间隔期间检查一个全局变量。下面的代码不起作用,因为它认为“continue_loop”是一个局部变量。有什么建议么?
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) then
continue_loop = 1
Click()
end
if (event == "M_RELEASED" and arg == 3) then
Click()
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
Stopclick()
end
function Stopclick()
continue_loop = 0
end
function Click()
PressMouseButton(1)
Sleep (10)
ReleaseMouseButton(1)
for i=1,10 do
if (continue_loop == 1) then
MoveMouseRelative(0,5)
Sleep (30)
else return
end
end
if (continue_loop == 0) then
Stopclick()
elseif (continue_loop == 1) then SetMKeyState(3)
else Stopclick()
end
end