loop is not repeating and won't stop

29 views Asked by At

enter image description here

EnablePrimaryMouseButtonEvents(true);
function OnEvent(event, arg)
if IsKeyLockOn("numlock" )then


         if IsMouseButtonPressed(1) then
         
                Sleep(50)
                MoveMouseRelative(0, 1)
                Sleep(100)
                MoveMouseRelative(0, 16)
                Sleep(100)
                MoveMouseRelative(0, 26)
                Sleep(100)
                MoveMouseRelative(-2, 25)
                Sleep(100)
                MoveMouseRelative(10, 28)
                Sleep(100)
                MoveMouseRelative(8, 25)
                Sleep(100)
                MoveMouseRelative(10, 15)
                Sleep(100)
                MoveMouseRelative(-14, 15)
                Sleep(100)
                MoveMouseRelative(-34, -1)
                Sleep(100)
                MoveMouseRelative(-18, 0)
                Sleep(100)
                MoveMouseRelative(10, 10)
                Sleep(100)
                MoveMouseRelative(-13, 5)
                Sleep(100)
                MoveMouseRelative(-20, -5)
                Sleep(100)
       
          end
  coroutine.resume(cor)
  repeat
     Sleep(100)
     coroutine.resume(cor)
  until not IsMouseButtonPressed(1)
        end
    end

Trying to move mouse to one direction and after sometime move to another and loop need to be stopped soon as i left go of the button.

Currently its running entire loops even after let go of the button and it won't repeat when i don't let go of the mouse. please check the gif.

Thanks

0

There are 0 answers