Immediately break the loop when condition is not met and go to next line

29 Views Asked by At
EnablePrimaryMouseButtonEvents(true);
function OnEvent(event, arg)
if IsKeyLockOn("numlock" )then
    if IsMouseButtonPressed(3)then
  

        repeat  
                if IsMouseButtonPressed(1) then
PressKey("z")
ReleaseKey("z")


    repeat
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
                PressKey("a")
ReleaseKey("a")
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
                 PressKey("b")
ReleaseKey("b")
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
           PressKey("c")
ReleaseKey("c")
                   if not IsMouseButtonPressed(1) then break end; Sleep(91)
           PressKey("d")
ReleaseKey("d")
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
          PressKey("e")
ReleaseKey("e")
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
     PressKey("f")
ReleaseKey("f")
            end         


        until not IsMouseButtonPressed(3)
PressKey("z")
ReleaseKey("z")


        end     


                if IsMouseButtonPressed(1) then
PressKey("z")
ReleaseKey("z")
    repeat



                if not IsMouseButtonPressed(1) then break end; Sleep(91)
                PressKey("a")
ReleaseKey("a")
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
                 PressKey("b")
ReleaseKey("b")
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
           PressKey("c")
ReleaseKey("c")
                   if not IsMouseButtonPressed(1) then break end; Sleep(91)
           PressKey("d")
ReleaseKey("d")
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
          PressKey("e")
ReleaseKey("e")
                if not IsMouseButtonPressed(1) then break end; Sleep(91)
     PressKey("f")
ReleaseKey("f")

                    until not IsMouseButtonPressed(1)

PressKey("z")
ReleaseKey("z")
        end         



    end
end

Z key need to be pressed once and type " A B C D E F G" in loop, loop should Immediately stop when let go of the left mouse button and when let go the right mouse button Z key need to pressed once again.

Currently when let go of the left mouse its completely stops the script and Z key is getting pressed again. I want Z key to be controlled by right mouse button.

enter image description here

0

There are 0 best solutions below