How to activate combo if stick held in direction for X secs?

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

How to activate combo if stick held in direction for X secs?

Postby pablosscripts » Tue Feb 07, 2017 5:53 am

I can get it working fine for button presses but not the sticks.

What have I done wrong?

Code: Select all
if(event_release(MOV_Y_AXIS) > -50 && time_active(MOV_Y_AXIS) < 300) {
 
}
 
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: How to activate combo if stick held in direction for X s

Postby bonefisher » Tue Feb 07, 2017 10:03 am

Code: Select all
 
main {
 
    if(check_active(STICK_2_Y, 300)) {
        combo_run(A);
    }
}
combo A {
    set_val(BUTTON_16, 100.0);
    wait(1000);
}
 

Something is defiantly wrong in different combinations. Needs lookin into but I'm off to work. Take a look tonight unless someone else finds it.
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: How to activate combo if stick held in direction for X s

Postby Sillyasskid » Tue Feb 07, 2017 10:45 am

Code: Select all
#pragma METAINFO("Auto_Sprint", 1, 0, "Sillyasskid")
int y_timer = 0;
 
main {
    if(get_actual(STICK_2_Y) < -50.0){
        y_timer += elapsed_time();
        if (y_timer == 300) {
            combo_run(SPRINT);
        }
    } else {
        y_timer = 0;
    }
}
combo SPRINT {
    set_val(BUTTON_9, 100);
    wait(300);   
}


This is not very clean, but its all I could come up with in this dark hour. I''ll give it a shot again later today and try to get it trimmed down a bit.
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: How to activate combo if stick held in direction for X s

Postby Sillyasskid » Tue Feb 07, 2017 11:19 am

bonefisher wrote:
Code: Select all
 
main {
 
    if(check_active(STICK_2_Y, 300)) {
        combo_run(A);
    }
}
combo A {
    set_val(BUTTON_16, 100.0);
    wait(1000);
}
 

Something is defiantly wrong in different combinations. Needs lookin into but I'm off to work. Take a look tonight unless someone else finds it.


Code: Select all
main {
 if(check_active(STICK_2_Y, 300)) {
        if (get_actual(STICK_2_Y) > 0.0) {
            combo_run(A); // Combo A Runs if STICK_2_Y is postive
        } else {
            combo_run(B); // Combo B Runs if STICK_2_Y is negative
        }
}
}
combo A {
    combo_stop(B);
    set_val(BUTTON_16, 100);
    wait(1000);
}
combo B {
    combo_stop(A);
    set_val(BUTTON_9, 100);
    wait(1000);
}


This also works. The combos will trigger, However I''m not a fan of making combos running indefinitely. I assumed because of of the "event_released" function added initially with pablogroup code, I take it as, he only wanted the combo to activate once, if the condition was true.
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: How to activate combo if stick held in direction for X s

Postby pablosscripts » Tue Feb 07, 2017 11:30 am

Hum, I want it to simulate pressing a button once as you said. Which one would be the best for that?
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: How to activate combo if stick held in direction for X s

Postby Sillyasskid » Tue Feb 07, 2017 11:44 am

pablogroup wrote:Hum, I want it to simulate pressing a button once as you said. Which one would be the best for that?


Then you will want to go with the first script I posted.

Code: Select all
#pragma METAINFO("Auto_Sprint", 1, 0, "Sillyasskid")
int y_timer = 0;
 
main {
    if(get_actual(STICK_2_Y) < -50.0){
        y_timer += elapsed_time();
        if (y_timer == 300) {
            combo_run(SPRINT);
        }
    } else {
        y_timer = 0;
    }
}
combo SPRINT {
    set_val(BUTTON_9, 100);
    wait(300);   
}


Just change what BUTTON_9 to what ever your script is using. You can rename the combo name as well, it was just placeholder/example.
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: How to activate combo if stick held in direction for X s

Postby pablosscripts » Tue Feb 07, 2017 12:22 pm

Thanks to both of you! I think I'll end up needing both approaches as I'm experimenting like mad with my For Honor script:)
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: How to activate combo if stick held in direction for X s

Postby bonefisher » Tue Feb 07, 2017 2:05 pm

There are different ways of doing this also but there not working. Looking into this after work. Might be a bug.
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am


Return to Gtuner IV Support

Who is online

Users browsing this forum: No registered users and 101 guests

cron