Tracing...

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

Re: Tracing...

Postby Sillyasskid » Fri Jan 13, 2017 8:10 pm

unfortunately, neither of your scripts actually worked as intended
I was able to write this one one. It seems to do the job,

Code: Select all
 
 
#include <xb1.gph> // for XB1
 
bool DetectShortP1 = FALSE;
 
main {
 
    if (get_actual(XB1_X)) {
 
        if (check_active(XB1_X, 5000)) {
             combo_run(Long);
        } else {
            DetectShortP1 = FALSE;
        }
    }   
 
    if ((event_release(XB1_X) && (!Long))) {
             combo_run(Short);
        }
}
 
combo Short {
    call(Time_Held_Print);
    set_val(XB1_X, 100);
    wait(1000);
    set_val(XB1_X, 0);
    wait(100);
   printf("Short Wait: %d", 1000);
}
 
combo Long {
    call(Time_Held_Print);
    set_val(XB1_X, 100);
    wait(4000);
    set_val(XB1_X, 0);
    wait(100);
   printf("Long Wait: %d", 4000);
}
 
combo Time_Held_Print {    // Thia combo will display the acual amount of time X was held.
    printf("Time Held: %d", (time_active(XB1_X)));
 
}
 
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: Tracing...

Postby J2Kbr » Sat Jan 14, 2017 12:03 am

Awesome you got it to work!! :)
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Tracing...

Postby Chaosrocket » Wed Jan 25, 2017 7:24 am

Awesome will test later... the support here is great...
User avatar
Chaosrocket
Sergeant Major
Sergeant Major
 
Posts: 96
Joined: Mon Jun 13, 2016 9:10 pm

Re: Tracing...

Postby Chaosrocket » Sat Feb 11, 2017 8:22 pm

Sillyasskid wrote:unfortunately, neither of your scripts actually worked as intended
I was able to write this one one. It seems to do the job,

Code: Select all
 
 
#include <xb1.gph> // for XB1
 
bool DetectShortP1 = FALSE;
 
main {
 
    if (get_actual(XB1_X)) {
 
        if (check_active(XB1_X, 5000)) {
             combo_run(Long);
        } else {
            DetectShortP1 = FALSE;
        }
    }   
 
    if ((event_release(XB1_X) && (!Long))) {
             combo_run(Short);
        }
}
 
combo Short {
    call(Time_Held_Print);
    set_val(XB1_X, 100);
    wait(1000);
    set_val(XB1_X, 0);
    wait(100);
   printf("Short Wait: %d", 1000);
}
 
combo Long {
    call(Time_Held_Print);
    set_val(XB1_X, 100);
    wait(4000);
    set_val(XB1_X, 0);
    wait(100);
   printf("Long Wait: %d", 4000);
}
 
combo Time_Held_Print {    // Thia combo will display the acual amount of time X was held.
    printf("Time Held: %d", (time_active(XB1_X)));
 
}
 


Totally awesome will test now, got a bit distracted with playing the game... :oops:

Thanks....
User avatar
Chaosrocket
Sergeant Major
Sergeant Major
 
Posts: 96
Joined: Mon Jun 13, 2016 9:10 pm

Re: Tracing...

Postby Chaosrocket » Tue Feb 14, 2017 5:31 am

Final solution, needed a mechanism for blocking repeat presses until button released...
Code: Select all
 
#pragma METAINFO("Elite Pad Multi-Combos V2.3", 2, 3 ,"[email protected]")
#include <xb1.gph> // for XB1
#define TRUE   !FALSE
 
bool DetectShortP1 = FALSE;
bool DetectShortP2 = FALSE;
bool DetectShortP3 = FALSE;
bool DetectShortP4 = FALSE;
 
bool PressedReleasedP1 = FALSE;
bool PressedReleasedP2 = FALSE;
bool PressedReleasedP3 = FALSE;
bool PressedReleasedP4 = FALSE;
 
main {
    //P1 Detection
    if (get_actual(XB1_P1))
    {
        if (check_active(XB1_P1, 1000) && (!PressedReleasedP1))
        {
            PressedReleasedP1 = TRUE;
            combo_run(LongP1);
        }
        else
        {
            DetectShortP1 = FALSE;
        }
    }
 
    if ((event_release(XB1_P1) && (!LongP1) && (!PressedReleasedP1) ))
    {
        PressedReleasedP1 = TRUE;     
        combo_run(ShortP1);
    }
 
    // Detect Paddle release
    if(is_release(XB1_P1))
    {
        PressedReleasedP1 = FALSE;
    }
 
    //P2 Detection
    if (get_actual(XB1_P2))
    {
        if (check_active(XB1_P2, 1000) && (!PressedReleasedP2))
        {
            PressedReleasedP2 = TRUE;
            combo_run(LongP2);
        }
        else
        {
            DetectShortP2 = FALSE;
        }
    }
 
    if ((event_release(XB1_P2) && (!LongP2) && (!PressedReleasedP2) ))
    {
        PressedReleasedP2 = TRUE;     
        combo_run(ShortP2);
    }
 
    // Detect Paddle release
    if(is_release(XB1_P2))
    {
        PressedReleasedP2 = FALSE;
    }
 
    //P3 Detection
    if (get_actual(XB1_P3))
    {
        if (check_active(XB1_P3, 1000) && (!PressedReleasedP3))
        {
            PressedReleasedP3 = TRUE;
            combo_run(LongP3);
        }
        else
        {
            DetectShortP3 = FALSE;
        }
    }
 
    if ((event_release(XB1_P3) && (!LongP3) && (!PressedReleasedP3) ))
    {
        PressedReleasedP3 = TRUE;     
        combo_run(ShortP3);
    }
 
    // Detect Paddle release
    if(is_release(XB1_P3))
    {
        PressedReleasedP3 = FALSE;
    }
 
    //P4 Detection
    if (get_actual(XB1_P4))
    {
        if (check_active(XB1_P4, 1000) && (!PressedReleasedP4))
        {
            PressedReleasedP4 = TRUE;
            combo_run(LongP4);
        }
        else
        {
            DetectShortP4 = FALSE;
        }
    }
 
    if ((event_release(XB1_P4) && (!LongP4) && (!PressedReleasedP4) ))
    {
        PressedReleasedP4 = TRUE;     
        combo_run(ShortP4);
    }
 
    // Detect Paddle release
    if(is_release(XB1_P4))
    {
        PressedReleasedP4 = FALSE;
    }
}
 
//Begin region combo key presses
 
// 1. Combo for short P1 press
combo ShortP1 {
    call(Time_Held_Print_P1);
    set_val(XB1_Y, 100);
    set_val(XB1_X, 100);
    wait(70);
    set_val(XB1_Y, 0);
    set_val(XB1_X, 0);
    printf("Short Wait P1");
}
 
// 2. Combo for long P1 press
combo LongP1 {
    call(Time_Held_Print_P1);
    set_val(XB1_Y, 100);
    set_val(XB1_B, 100);
    wait(70);
    set_val(XB1_Y, 0);
    set_val(XB1_B, 0);
    printf("Long Wait P1");
}
 
// 3. Combo for short P2 press
combo ShortP2 {
    call(Time_Held_Print_P2);
    set_val(XB1_A, 100);
    set_val(XB1_X, 100);
    wait(70);
    set_val(XB1_A, 0);
    set_val(XB1_X, 0);
    printf("Short Wait P2");
}
 
// 4. Combo for long P2 press
combo LongP2 {
    call(Time_Held_Print_P2);
    set_val(XB1_A, 100);
    set_val(XB1_B, 100);
    wait(70);
    set_val(XB1_A, 0);
    set_val(XB1_B, 0);
    printf("Long Wait P2");
}
 
// 5. Combo for short P3 press
combo ShortP3 {
    call(Time_Held_Print_P3);
    set_val(XB1_Y, 100);
    set_val(XB1_A, 100);
    wait(70);
    set_val(XB1_Y, 0);
    set_val(XB1_A, 0);
    printf("Short Wait P3");
}
 
// 6. Combo for long P3 press
combo LongP3 {
    call(Time_Held_Print_P3);
    set_val(XB1_X, 100);
    set_val(XB1_B, 100);
    wait(70);
    set_val(XB1_X, 0);
    set_val(XB1_B, 0);
    printf("Long Wait P3");
}
 
// 7. Combo for short P4 press
combo ShortP4 {
    call(Time_Held_Print_P4);
    set_val(XB1_LS, 100);
    set_val(XB1_A, 100);
    wait(70);
    set_val(XB1_LS, 0);
    set_val(XB1_A, 0);
    printf("Short Wait P4");
}
 
// 8. Combo for long P4 press
combo LongP4 {
    call(Time_Held_Print_P4);
    set_val(XB1_LS, 100);
    set_val(XB1_B, 100);
    wait(70);
    set_val(XB1_LS, 0);
    set_val(XB1_B, 0);
    printf("Long Wait P4");
}
//End region combo key presses
 
//begin region debug output length of time the paddles are pressed
combo Time_Held_Print_P1 {    // This combo will display the actual amount of time P1 was held.
    printf("P1 Time Held: %d", (time_active(XB1_P1)));
}
 
combo Time_Held_Print_P2 {    // This combo will display the actual amount of time P1 was held.
    printf("P2 Time Held: %d", (time_active(XB1_P2)));
}
combo Time_Held_Print_P3 {    // This combo will display the actual amount of time P1 was held.
    printf("P3 Time Held: %d", (time_active(XB1_P3)));
}
 
combo Time_Held_Print_P4 {    // This combo will display the actual amount of time P1 was held.
    printf("P4 Time Held: %d", (time_active(XB1_P4)));
}
//end region debug
 
 
User avatar
Chaosrocket
Sergeant Major
Sergeant Major
 
Posts: 96
Joined: Mon Jun 13, 2016 9:10 pm

Re: Tracing...

Postby J2Kbr » Tue Feb 21, 2017 10:05 am

Chaosrocket wrote:Final solution, needed a mechanism for blocking repeat presses until button released...

:joia: :joia:
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Previous

Return to Gtuner IV Support

Who is online

Users browsing this forum: monteruntheplay and 125 guests