我有一个脚本,可以使用F1打开/关闭,并且F2,F3,F4等具有与它们不同的代码。当我按下鼠标左键时,每个代码都会运行。
if (event == "G_PRESSED" and arg == 1) then
start = not start
end
if (event == "G_PRESSED" and arg == 2) then
code 1 = not code 1
end
if (event == "G_PRESSED" and arg == 3) then
code 2 = not code 2
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and start) then
if code 1 then
repeat
action 1
until not IsMouseButtonPressed(1)
end
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and start) then
if code 2 then
repeat
action 2
until not IsMouseButtonPressed(1)
(请注意,代码1 /代码2 /动作1 /动作2不是实际的代码)
但是,如果我按F1和F2,这两个代码将同时运行。有什么方法可以使如果按下F1来关闭F2,F3,F4?如果我按F2键,其他的将被关闭?