Logitech Macro Layouts

07/27/2017 22:07 hannes93#1
Layout 1
Code:
function OnEvent(event, arg)
    OutputLogMessage("event = %s, arg = %d\n", event, arg)
    if (event == "PROFILE_ACTIVATED") then
        EnablePrimaryMouseButtonEvents(true)
    elseif event == "PROFILE_DEACTIVATED" then
        ReleaseMouseButton(2)  -- to prevent it from being
                               -- stuck(suck) on give a fuck ^^ ;)
end

if (event == "MOUSE_BUTTON_PRESSED" and arg == 7) then
        recoil = not recoil

    else if (event == "MOUSE_BUTTON_PRESSED" and arg == 11) then
        recoilhard = not recoilhard

    end

    if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil then
        if recoil then
            repeat
                Sleep(60)
                MoveMouseRelative(0, 35)                
                Sleep(60)
                MoveMouseRelative(0, 35)
-- VSS Unmodded
            until not IsMouseButtonPressed(1)
end

    else if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoilhard then
        if recoilhard then
            repeat
                Sleep(60)
                MoveMouseRelative(0, 31)                
                Sleep(60)
                MoveMouseRelative(0, 31)
-- General

                until not IsMouseButtonPressed(1)
                              
        end
    end
end
end
end
Layout 2
Code:
function OnEvent(event, arg)
    OutputLogMessage("event = %s, arg = %s\n", event, arg)
end
    local recoil = false local aim = false
     sleep_duration = 66
     MaxBreak = 200
     TimeStamp = -MaxBreak-1    -- it's negative 2 seconds
     recoil_coords1 = {
         { x = 18, y = 27 },        
         { x = 16, y = 38 },        
         { x = -16, y = 38 },        
         { x = -28, y = 33 },        
         { x = -26, y = 58 },
         { x = 30, y = 38 },        
         { x = 30, y = -36 },        
         { x = 38, y = 58 },                             
         }
recoil_count = # recoil_coords1
     LastIndex = 1

sleep_duration2 = 66     
recoil_coords = {
         { x = 0, y = 50 },        
         { x = 0, y = 50 },        
         { x = 0, y = 50 },        
         { x = -28, y = 33 },        
         { x = -26, y = 58 },
         { x = 30, y = 38 },        
         { x = 30, y = -36 },        
         { x = 38, y = 58 },                             
     }
     recoil_count = # recoil_coords
     LastIndex = 1
     function OnEvent(event, arg)    
         if event == "PROFILE_ACTIVATED" then
             EnablePrimaryMouseButtonEvents(true)
         end
     
     
         
         if (event == "MOUSE_BUTTON_PRESSED" and arg == 11) then
             recoil1 = not recoil1 
             if (recoil1 == false) then
                 OutputLogMessage("RecoilScript turned OFF AK\n")
             else 
                 OutputLogMessage("RecoilScript turned ON AK\n")
     end
       else if (event == "MOUSE_BUTTON_PRESSED" and arg == 10) then
             recoil2 = not recoil2 
             if (recoil2 == false) then
                 OutputLogMessage("RecoilScript turned OFF\n")
             else 
                 OutputLogMessage("RecoilScript turned ON\n")
             end


            else if (event == "MOUSE_BUTTON_PRESSED" and arg == 7) then
            recoilhard = not recoilhard
     end
         
     
     
         if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) and recoil1  then
                          
             if (GetRunningTime() - TimeStamp < MaxBreak) and (LastIndex <= recoil_count) then
                 i = LastIndex
             else
                 i = 1
             end
             while i <= recoil_count do
                 Sleep(sleep_duration)
                 if not IsMouseButtonPressed(1) then
                     LastIndex = i
                     TimeStamp = GetRunningTime()
                     break
                 end
                 MoveMouseRelative( recoil_coords1[i].x, recoil_coords1[i].y )
                 if not IsMouseButtonPressed(1) then break end
                 i = i + 1
             end

        else if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) and recoil2  then
                          
             if (GetRunningTime() - TimeStamp < MaxBreak) and (LastIndex <= recoil_count) then
                 i = LastIndex
             else
                 i = 1
             end
             while i <= recoil_count do
                 Sleep(sleep_duration2)
                 if not IsMouseButtonPressed(1) then
                     LastIndex = i
                     TimeStamp = GetRunningTime()
                     break
                 end
                 MoveMouseRelative( recoil_coords[i].x, recoil_coords[i].y )
                 if not IsMouseButtonPressed(1) then break end
                 i = i + 1
             end
          
            else if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoilhard then
            if recoilhard then
            repeat
                Sleep(60)
                MoveMouseRelative(0, 35)                
                Sleep(60)
                MoveMouseRelative(0, 35)

                until not IsMouseButtonPressed(1)
             end

         end
     end 
end
end
end
end
Feel free to post your own..
07/28/2017 04:40 dhiedotz#2
how to use it sir
07/28/2017 13:16 S0nY__#3
For what weapon is that macro for? I don't get it.
11/27/2017 12:54 Allen Smithee#4
what do I have to change in the code if I use invert mouse?