我已经尝试过并且总是以无限循环结束。
我的代码:
toggle_button = 5
button_toggled = false
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == toggle_button then
button_toggled = not button_toggled
if button_toggled then
while button_toggled do
OutputLogMessage(tostring(button_toggled))
Sleep(50)
end
else
button_toggled = not button_toggled
end
end
end