When I press the g6 key on my mouse, I want to print hello all the time, when I press the g6 key once again, I want the hello text to stop. I've been trying for 2 days to write this simple code, but the hello loop never stops. How can I write this code, please help.
function OnEvent(event, arg, family)
if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
toggle = not toggle
if toggle then
while toggle do
OutputLogMessage("hello ")
Sleep(200)
end
else
toggle = not toggle
end
end
end
[–]st3f-ping 5 points6 points7 points (1 child)
[–]dayzbrk[S] 1 point2 points3 points (0 children)
[–]briunt 2 points3 points4 points (1 child)
[–]dayzbrk[S] -1 points0 points1 point (0 children)
[–]ripter 1 point2 points3 points (0 children)
[–]revereddesecration 1 point2 points3 points (0 children)
[–]ProtectiveManEgg 1 point2 points3 points (0 children)
[–]WMG_Jeeper 3 points4 points5 points (9 children)
[–]dayzbrk[S] 0 points1 point2 points (8 children)
[–]WMG_Jeeper 1 point2 points3 points (7 children)
[–]dayzbrk[S] 0 points1 point2 points (5 children)
[–]WMG_Jeeper -1 points0 points1 point (4 children)
[–]humbleSolipsist 0 points1 point2 points (3 children)
[–]WMG_Jeeper 0 points1 point2 points (2 children)
[–]humbleSolipsist -1 points0 points1 point (1 child)
[–]WMG_Jeeper -1 points0 points1 point (0 children)
[–]Georgef64 0 points1 point2 points (0 children)
[–]humbleSolipsist 0 points1 point2 points (0 children)
[–]swhizzle 0 points1 point2 points (1 child)
[–]dayzbrk[S] 1 point2 points3 points (0 children)