Results 1 to 12 of 12
  1. #1
    insomniac2k1's Avatar
    Join Date
    Dec 2015
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    4

    Exclamation Universal (Adjustable) Logitech No-Recoil, Auto-Run, Auto-FlashLight, Auto-Spot

    Description:

    This macro is written for a G700 mouse, but will work on any Logitech G key. Including keyboard, etc.

    This macro is fine tuned for the AWS. Dont ask me to tune it for your gun. This macro is universal and will require adjustments for your setup and gun.

    Assumptions:

    You have a G13 keyboard and have created a macro named "spot" that presses and releases "Q". This Lua will call this macro to automatically spot enemy upon normal "WASD" movement. You can use the spot function that i added, but i like the use macros on this better, due to lack of added delay. Your choice.

    You have "Lshift" bound to run, in game

    You have unbound left mouse click as fire and have bound "U" to fire, in game.

    You have unbound G10 and G9 from their regular DPI setting and will now use them as in-game height adjustment for recoil.

    You have unbound G11 and will now use it to enable or disable the Macro, in game.


    Configuration:


    "modifier" is the starting default recoil adjustment when the macro is started. Adjust this to your gun defaults. Then fine tune in game if needed (switching scopes, etc.)

    Fine tune the "recoil_coords" to you gun if they need more left/right adjustment.

    In-game Configuration:

    G10 is less recoil reduction
    G9 is more recoil reduction

    Code:
    EnablePrimaryMouseButtonEvents(true);
    
    local recoil_coords = {
        { x = 0, y = 1 } 
    }
    
    local recoil_coords_0 = {
        { x = -1, y = 0 }
    }
    local recoil_coords_1 = {
        { x = -1, y = 1 }
    }
    
    local recoil_coords_2 = {
        { x = -2, y = 1 }
    }
    
    local recoil_coords_noclick = {
        { x = 0, y = 2 }
    }
    
    local recoil = not true;
    local key = "U";
    local key2 = "t";
    local key3 = "q";
    local state1 = not true;
    local state2 = not true;
    local modifier = 7;
    
    function flashlight ()
        if not IsMouseButtonPressed(3)and not state1 then
            state1 = true;           
            PressKey(key2)
            Sleep(40)
            ReleaseKey(key2)
        end
    end
    
    function flashlight_off ()
        if state2 then
            state1 = not true;
            state2 = not true;
        else
            state1 = not true;
            state2 = not true;
            PressKey(key2)
            Sleep(40)
            ReleaseKey(key2)
        end
    end
    
    function suppress (x,y,sleep)
        if not sleep then sleep="22" end
        PressKey(key)
        Sleep(sleep)
        MoveMouseRelative(x,y)
        Sleep(sleep)
        MoveMouseRelative(x,modifier)
        ReleaseKey(key)
        Sleep(38)
    end
    
    function spot ()
        PressAndReleaseKey(key3)     
    end
    
    
    function OnEvent(event, arg)
        if (event == "MOUSE_BUTTON_PRESSED" and arg == 11)    then
            recoil = not recoil
            OutputLogMessage("AWS - No-Recoil-Flashlight-spot, %s \n", tostring(recoil))
         end
    
         if recoil then
         Sleep(1)
    
    -- Section below assumes that you have a G13 or similar keyboard. Comment out if you do not have macro configurable keyboard "WASD" keys
         if (event == "G_PRESSED" and arg == 4) then
             PressKey("lshift")
         end
         
         if (event == "G_RELEASED" and arg == 4) then
             ReleaseKey("lshift")
         end
         
         
         if (event == "G_PRESSED" and arg == 10) then
             PlayMacro("spot")
         end
         
         if (event == "G_PRESSED" and arg == 11) then
             PlayMacro("spot")
         end
         
         if (event == "G_PRESSED" and arg == 12) then
         PlayMacro("spot")
         end
    -- Section above assumes that you have a G13 or similar keyboard. Comment out if you do not have macro configurable keyboard "WASD" keys
         
         if (event == "MOUSE_BUTTON_PRESSED" and arg == 9) then
             modifier = modifier +1;
         end
         
         if (event == "MOUSE_BUTTON_PRESSED" and arg == 10) then
             modifier = modifier -1;
         end
    
         if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) then
            repeat
            for i, v in ipairs(recoil_coords) do
                if (IsMouseButtonPressed(3)) then
                    state1 = true; 
                    state2 = true;                                    
                    suppress(recoil_coords_0[i].x,recoil_coords_0[i].y+modifier)
                    suppress(recoil_coords_1[i].x,recoil_coords_1[i].y+modifier)
                else    
                    suppress(recoil_coords_noclick[i].x,recoil_coords_noclick[i].y)
                    -- flashlight() -- only enable if you have a flashlight equipped
                end
            end   
            until not IsMouseButtonPressed(1)
            --flashlight_off()  -- only enable if you have a flashlight equipped
         end
    
         else 
             if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) then
                 PressKey(key)
             end
             if (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
                 ReleaseKey(key)
             end
        end
    end
    Thank you to the other contributers out there that helped me get started with this script. I used logic from a few of their scripts as a base to complete this one.

    Enjoy!
    Last edited by insomniac2k1; 01-01-2016 at 08:17 PM.

  2. The Following 4 Users Say Thank You to insomniac2k1 For This Useful Post:

    AAPFire (01-01-2016),froggiez (07-24-2016),Patriot99 (04-15-2016),tmx (07-18-2016)

  3. #2
    kompormeleduq's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    which LGS version did u use ?

  4. #3
    insomniac2k1's Avatar
    Join Date
    Dec 2015
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    4
    8.76 Latest i believe

  5. #4
    bootst's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    6
    Reputation
    10
    Thanks
    0
    This code works for logitech g300?

  6. #5
    krawumme's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    would be nice i have an g300 too

  7. #6
    sakuchi139595's Avatar
    Join Date
    Nov 2015
    Gender
    male
    Posts
    11
    Reputation
    10
    Thanks
    0
    how to use hack ?

  8. #7
    Darakulus's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    0
    working ???

  9. #8
    xdrachenx's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    Possible to modify it for a g502? (just one DPI Button)

  10. #9
    TheDarkMasterX's Avatar
    Join Date
    Feb 2016
    Gender
    male
    Posts
    204
    Reputation
    42
    Thanks
    157
    My Mood
    Inspired
    This stuff is awesome!

  11. #10
    joetiptoey's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Posts
    32
    Reputation
    10
    Thanks
    1
    Hm... how would I adjust G keys? This mouse doesn't have that many G-keys...

  12. #11
    mangledpumpkin's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    London
    Posts
    49
    Reputation
    10
    Thanks
    1
    My Mood
    Fine
    This is really great post! THANKS!

  13. #12
    Patriot99's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    2
    ok help a noob out, this code needs to be .xml right? How do I do that? I tried putting it in notepad and save is .xml but logitech says invalid.....

    Thanks

Similar Threads

  1. Fix Phoenix server auto-run!
    By Mew in forum Realm of the Mad God Private Servers Tutorials/Source Code
    Replies: 4
    Last Post: 07-12-2014, 06:01 AM
  2. Can using a auto run program get you banned?
    By Gloserous in forum DayZ Help & Requests
    Replies: 4
    Last Post: 01-14-2014, 10:00 AM
  3. [Help Request] Auto run script for alienware tact x keyboard
    By Robosky in forum DayZ Help & Requests
    Replies: 0
    Last Post: 09-22-2013, 05:46 PM
  4. [Help Request] Adding program to auto run after being ran
    By GrieferCreeper in forum C++/C Programming
    Replies: 5
    Last Post: 02-28-2013, 06:09 AM
  5. Dayz Auto Run by HomeDevs
    By homedev in forum General Gaming
    Replies: 3
    Last Post: 10-14-2012, 09:16 PM