Need Help Creating Simple Button Sequence

Titan Two general support. Questions, firmware update, feature request.

Need Help Creating Simple Button Sequence

Postby cairo1725 » Wed Nov 10, 2021 10:28 am

Code:
Code: Select all
#include "xb1.gph"
 
main {
    if (event_active(XB1_VIEW)) {
        combo_run(cView);
        combo_run(cSequence);
    }
 
}
 
 combo cView {
     set_val(XB1_VIEW,0);
     wait(200);
 }
 
 // PRESS F1 in GTUNER IV for list of BUTTON_ names
 combo cSequence {
 
 
 
 
 
     set_val(XB1_DOWN,100);    // Down
     wait(40); //press
     wait(40); //release
     set_val(XB1_DOWN,100);        // Down
     wait(40); //press
     wait(40); //release
     set_val(XB1_A,100);    // A
     wait(40); //press
     wait(40); //release
     set_val(XB1_B,100);        // B
     wait(40); //press
     wait(40); //release
 }

//When I run this nothing happens on my controller. I want to make it so that when I press the view button, the script will scrolls down twice, press a then press b. This will allow me to auto select a grenade use it and close out of the inventory extremely quick. but it does not run at all, can someone provide fixed code/explanation? I got a T2 hook up to series 2 elite controller.
User avatar
cairo1725
Sergeant
Sergeant
 
Posts: 8
Joined: Wed Nov 10, 2021 5:13 am

Re: Need Help Creating Simple Button Sequence

Postby Mad » Wed Nov 10, 2021 9:37 pm

Your script is working.

With the Titan Two connected to your PC via the PROG port open Gtuner's device monitor and press the xbox view button and you can see the buttons being pressed.

You can also print to the output panel, example:
Code: Select all
combo cView {
    printf("Combo running");
    wait(0);
    set_val(XB1_VIEW,0);
    wait(200);
}

The main issue would be the wait() times.
You can try this, but you should just reduce your combo first - do one set_val at a time, make sure it's working then add the next part in to get the menu timings correct.
Code: Select all
main {
    if (event_active(XB1_VIEW)) {
        combo_run(cSequence);
    }
}
 
// PRESS F1 in GTUNER IV for list of BUTTON_ names
combo cSequence {
    printf("Combo running");
    wait(0);
    wait(500); // wait for inventory to open
    set_val(XB1_DOWN,100); // Down
    wait(40); //press
    set_val(XB1_DOWN,0); //release
    wait(200);
 
    set_val(XB1_DOWN,100); // Down
    wait(40); //press
    set_val(XB1_DOWN,0); //release
    wait(200);
 
    set_val(XB1_A,100); // A
    wait(40); //press
    wait(200); //release
    set_val(XB1_B,100); // B
    wait(40); //press
    wait(40); //release
    set_val(XB1_VIEW,100); // close inventory
    wait(40);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Need Help Creating Simple Button Sequence

Postby cairo1725 » Thu Nov 11, 2021 3:47 am

Mad wrote:Your script is working.

With the Titan Two connected to your PC via the PROG port open Gtuner's device monitor and press the xbox view button and you can see the buttons being pressed.

You can also print to the output panel, example:
Code: Select all
combo cView {
    printf("Combo running");
    wait(0);
    set_val(XB1_VIEW,0);
    wait(200);
}

The main issue would be the wait() times.
You can try this, but you should just reduce your combo first - do one set_val at a time, make sure it's working then add the next part in to get the menu timings correct.
Code: Select all
main {
    if (event_active(XB1_VIEW)) {
        combo_run(cSequence);
    }
}
 
// PRESS F1 in GTUNER IV for list of BUTTON_ names
combo cSequence {
    printf("Combo running");
    wait(0);
    wait(500); // wait for inventory to open
    set_val(XB1_DOWN,100); // Down
    wait(40); //press
    set_val(XB1_DOWN,0); //release
    wait(200);
 
    set_val(XB1_DOWN,100); // Down
    wait(40); //press
    set_val(XB1_DOWN,0); //release
    wait(200);
 
    set_val(XB1_A,100); // A
    wait(40); //press
    wait(200); //release
    set_val(XB1_B,100); // B
    wait(40); //press
    wait(40); //release
    set_val(XB1_VIEW,100); // close inventory
    wait(40);
}



Ok I think i figured it out. It was working with both our codes, only issue is that when I press the view button instead of opening inventory my character jumps and crouches, so it is registering down down A and B combo. the only issue is to open my inventory I have to rapidly press the view button twice, the first time cause my character is jump/crouching and second to actually open inventory up. Then once in my inventory when I press the view button the combo works, it drops nade and backs out of menu. For whatever reason, it is the initial view press that is not registered the first time to open inventory, instead it jump/crouches. I'll try to switch the event active to a different button press.

EDIT: Got it to work, the prior code was mine but would not overwrite in Gtuner properly, first timer. Load slot 3 maintained my code in it and even when I edited/saved it did not overwrite load slot 3. Had to delete it and make a new GPC, thanks a ton.
User avatar
cairo1725
Sergeant
Sergeant
 
Posts: 8
Joined: Wed Nov 10, 2021 5:13 am


Return to Titan Two Device

Who is online

Users browsing this forum: No registered users and 157 guests