Titan 2 - Logitech Mouse/Keyboard scripting (AntiRecoil)

Gtuner IV general support. Operation, questions, updates, feature request.

Titan 2 - Logitech Mouse/Keyboard scripting (AntiRecoil)

Postby Shaag7 » Tue Nov 20, 2018 12:39 pm

Hey All,

I was using XIM4 for years together with T1/T2 but latest XIM Apex made me to stay just with T2 for Mouse/Keyboard gameplay.

I was using T2 scripting with XIM4 for all games but with direct T2 M/KB capture I left most of the T2 scripting and I tried Logitech LUA scripting on my mouse.

I'll add brief guide how to add scripting to your Logitech device (let it be headset or mouse). Simply rightclick on your logitech profile and click on Scripting. Paste code bellow and play with it to fit your play style/weapons.

As I rly like our Titan community, there is my script which I use for Battlefield series.
It offers two stages configurable Anti-Recoil (standard is with scroll-lock and for bipod u have to have scroll-lock on and also caps-lock on). Adjust can be done via holding left alt and pressing 4th / 5th mouse button (side buttons).

I feel this as the best way how to deal with scripting right now as it is just in the input device driver and T2 offers awesome speed in direct capture communication.

You can adjust dynamic Anti-recoil by usiong wmulti1 parameter. It will dynamicaly inrease/decrease antirecoil strength which is rly usefull for Battlefield LMGs.

Let me know if you need any advice or customization.

Code: Select all
EnablePrimaryMouseButtonEvents (true)
local step = 12.0
local wait = 32.0
local wmulti1 = 1
 
 
local wait1
local step1
 
 
function OnEvent(event, arg)   
      if IsKeyLockOn("scrolllock")and not IsModifierPressed('lshift') then
          if not IsKeyLockOn("capslock")then
                if IsMouseButtonPressed(1) then
                        wait1 = wait
                        OutputLogMessage("step1 = %s, wait1 = %s\n", step, wait1)
                            repeat                           
                                MoveMouseRelative(0,step)
                                --wait1 = wait1 * (wmulti1 + rng3) * (wmulti2 +rng3)
                                wait1 = wait1 * (wmulti1)
                                Sleep(wait1)
                                --OutputLogMessage("step1 = %s, wait1 = %s\n", step, wait1)
                        until not IsMouseButtonPressed(1)
                end             
                if IsMouseButtonPressed(3) then
                    repeat
                        if IsMouseButtonPressed(1) then
                        wait1 = wait
                        OutputLogMessage("step1 = %s, wait1 = %s\n", step, wait1)
                            repeat                           
                                MoveMouseRelative(0,step)
                                --wait1 = wait1 * (wmulti1 + rng3) * (wmulti2 +rng3)
                                wait1 = wait1 * (wmulti1)
                                Sleep(wait1)
                                --OutputLogMessage("step1 = %s, wait1 = %s\n", step, wait1)
                            until not IsMouseButtonPressed(1)
                        end
                    until not IsMouseButtonPressed(3)                       
                end
            end
 
        if IsKeyLockOn("capslock")then
                        if IsMouseButtonPressed(1) then
 
--                        wait1 = wait
                        wait1 = 5*wait
                        step1 = step
                                    OutputLogMessage("event = %s, arg = %d, step = %s\n", event, arg, step)
 
                            repeat                           
                                MoveMouseRelative(0,step1)
                                --wait1 = wait1 * (wmulti1 + rng3) * (wmulti2 +rng3)
                                wait1 = wait1 * (wmulti1)
                                Sleep(wait1)
                                OutputLogMessage("step1 = %s, wait1 = %s\n", step, wait)
                            until not IsMouseButtonPressed(1)
                        end           
                if IsMouseButtonPressed(3) then
                    repeat
                        if IsMouseButtonPressed(1) then
                        wait1 = 5*wait
                        step1 = step                       
--                        step1 = step/6
                                    OutputLogMessage("event = %s, arg = %d, step = %s\n", event, arg, step)
 
                            repeat                           
                                MoveMouseRelative(0,step1)
                                --wait1 = wait1 * (wmulti1 + rng3) * (wmulti2 +rng3)
                                wait1 = wait1 * (wmulti1)
                                Sleep(wait1)
                                OutputLogMessage("step1 = %s, wait1 = %s\n", step, wait1)
                            until not IsMouseButtonPressed(1)
                        end
                    until not IsMouseButtonPressed(3)
                end
 
        end
    end
    if IsModifierPressed('lalt')then
                if IsMouseButtonPressed(5) then
                    step = step - 1
                                    OutputLogMessage("event = %s, arg = %d, step = %s\n", event, arg, step)
                end
                if IsMouseButtonPressed(4) then
                    step = step + 1
                                    OutputLogMessage("event = %s, arg = %d, step = %s\n", event, arg, step)
                end   
    end
end
 
 
Last edited by Shaag7 on Wed Nov 21, 2018 9:20 am, edited 1 time in total.
PS4 - Titan2/Titan1 - Xim4 / XIM Apex - Logitech G502 Hero / Logitech G13 Advanced Gameboard / Logitech G213 Keyboard - DS4v2
User avatar
Shaag7
Command Sergeant Major
Command Sergeant Major
 
Posts: 121
Joined: Mon Sep 14, 2015 3:03 pm
Location: EU

Re: Titan 2 - Logitech Mouse/Keyboard scripting

Postby J2Kbr » Wed Nov 21, 2018 9:04 am

Thank you for sharing your experience and finding with Logitech LUA.

For this to work you need use Gtuner's KMG Capture right? I mean, the mouse can't run the script by itself, right?
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 17924
Joined: Tue Mar 18, 2014 1:39 pm

Re: Titan 2 - Logitech Mouse/Keyboard scripting

Postby Shaag7 » Wed Nov 21, 2018 9:18 am

J2Kbr wrote:Thank you for sharing your experience and finding with Logitech LUA.

For this to work you need use Gtuner's KMG Capture right? I mean, the mouse can't run the script by itself, right?


LUA script is ran by Logitech Gaming Software and it cannot be stored in mouse itself.
So Gtuner's KMG Capture is really needed.
PS4 - Titan2/Titan1 - Xim4 / XIM Apex - Logitech G502 Hero / Logitech G13 Advanced Gameboard / Logitech G213 Keyboard - DS4v2
User avatar
Shaag7
Command Sergeant Major
Command Sergeant Major
 
Posts: 121
Joined: Mon Sep 14, 2015 3:03 pm
Location: EU

Re: Titan 2 - Logitech Mouse/Keyboard scripting (AntiRecoil)

Postby Gjin Yuko » Sun Aug 11, 2019 1:26 am

Whats the correct setup to use it like this?

how can i use the KMG Capture and my Xim Apex at the same time?

And also can i then use AHK Scipts and Scripts on the Logitech Gaming Software like anti recoil on my Xim Apex
without useing the Titan Two for Scripts?

Thanks
User avatar
Gjin Yuko
Master Sergeant
Master Sergeant
 
Posts: 40
Joined: Mon Aug 05, 2019 10:00 pm

Re: Titan 2 - Logitech Mouse/Keyboard scripting (AntiRecoil)

Postby Gjin Yuko » Thu Sep 05, 2019 10:51 pm

COuld you maybe add rapidfire to that Code?
User avatar
Gjin Yuko
Master Sergeant
Master Sergeant
 
Posts: 40
Joined: Mon Aug 05, 2019 10:00 pm

Re: Titan 2 - Logitech Mouse/Keyboard scripting (AntiRecoil)

Postby J2Kbr » Fri Sep 06, 2019 9:53 am

Gjin Yuko wrote:how can i use the KMG Capture and my Xim Apex at the same time? And also can i then use AHK Scipts and Scripts on the Logitech Gaming Software like anti recoil on my Xim Apex without useing the Titan Two for Scripts?

This may be possible. For that you will need configure the Titan Two to output as USB Multi HID Interface, connect the Titan Two output to XIM and XIM to the console. You will also need run a script to forward the keyboard and mouse inputs, coming from Gtuner's KMG Capture, to XIM. I saw in other topic you have already found such script.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 17924
Joined: Tue Mar 18, 2014 1:39 pm

Re: Titan 2 - Logitech Mouse/Keyboard scripting (AntiRecoil)

Postby Gjin Yuko » Fri Sep 06, 2019 9:38 pm

Yes J2 but it doesnt work for me because i cant look around withou useing this script
Code: Select all
init {
  mousemapping();
}
 
main {
  mouse_passthru();
  key_passthru();
}


I just want this with rapidfire nothing more
User avatar
Gjin Yuko
Master Sergeant
Master Sergeant
 
Posts: 40
Joined: Mon Aug 05, 2019 10:00 pm

Re: Titan 2 - Logitech Mouse/Keyboard scripting (AntiRecoil)

Postby J2Kbr » Fri Sep 06, 2019 9:52 pm

Please note that regular Gamepacks and scripts will not work when the device is working in this mode of operation. You can, however, extend the above script to add any functionality using the keyboard and mouse dedicated GPC functions such as key_set() and mouse_set(). Unfortunately, I am not in my main computer at the moment to send you an example of that. If you can wait, I will be able post here an example by Sunday night/ Monday morning. thanks.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 17924
Joined: Tue Mar 18, 2014 1:39 pm

Re: Titan 2 - Logitech Mouse/Keyboard scripting (AntiRecoil)

Postby Gjin Yuko » Fri Sep 06, 2019 10:01 pm

I will do that tanks J2
User avatar
Gjin Yuko
Master Sergeant
Master Sergeant
 
Posts: 40
Joined: Mon Aug 05, 2019 10:00 pm


Return to Gtuner IV Support (Titan Two)

Who is online

Users browsing this forum: No registered users and 5 guests