Trying to get left stick to move left and then right

GPC1 script programming for Titan One. Code examples, questions, requests.

Trying to get left stick to move left and then right

Postby Rejectz » Fri May 17, 2019 2:56 pm

I was hoping someone could help please, all im trying to get is my left analog stick move left and then right when i press A and not stop until i press A again, but at the moment it's moving right and then forwards and activates as soon as i load the profile on the titan stick.. Any help would be appreciated

This is what ive got so far

Code: Select all
//
// Anti afk script
//----------------------------------------
 
main {
    if(get_ptime(XB1_A)) {
        combo_run(AntiAFK);
    }
}
 
combo AntiAFK {
    set_val(XB1_LY, 100);
    wait(100);
    set_val(XB1_LY, 0);
    wait(4000);
    set_val(XB1_LY, 0);
    wait (1000);
    set_val(XB1_LY, -100);
    wait(100);
    set_val(XB1_LY, -0);
    wait(4000);
    set_val(XB1_LY, -0);
    wait (1000);
}
 
Rejectz
Sergeant First Class
Sergeant First Class
 
Posts: 23
Joined: Fri Feb 20, 2015 10:17 am

Re: Trying to get left stick to move left and then right

Postby alanmcgregor » Fri May 17, 2019 4:18 pm

Try this:

Code: Select all
 
//
// Anti afk script
//----------------------------------------
 
int toggleAntiAFK = 0; //this flag will manage the AFK combo execution
 
main {
    if(event_press(XB1_A)) {
        toogleAntiAFK = !toogleAntiAFK; // this ON/OFF the flag
    }
 
    if(toogleAntiAFK){ // when flag is ON/TRUE run the combo
        combo_run(AntiAFK);
    }
    else
        if(combo_running(AntiAFK)){ //if flag is FALSE/OFF and the combo is running, stop it
            combo_stop(AntiAFK);
        }
}
 
combo AntiAFK {
    set_val(XB1_LY, 100);
    wait(100);
    set_val(XB1_LY, 0);
    wait(4000);
    set_val(XB1_LY, 0);
    wait (1000);
    set_val(XB1_LY, -100);
    wait(100);
    set_val(XB1_LY, -0);
    wait(4000);
    set_val(XB1_LY, -0);
    wait (1000);
}
 
User avatar
alanmcgregor
Major
Major
 
Posts: 988
Joined: Tue Mar 27, 2018 8:38 am


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 71 guests