Noob needs help again

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

Noob needs help again

Postby asilver » Wed Jul 24, 2019 3:48 pm

still new to this , so im trying to make a if else statement but I cant get it to work so my combo is right trigger then right bumper but if I press b I want b to replace right bumper for one rotation, I know I cant use wait in the if statement as I have it in my cone is there anyway to to make that work to any help would be great

Code: Select all
int combo_toggle = FALSE;
 
main {
    if(event_press(XB1_RS)) {
        combo_toggle = !combo_toggle;
    }
 
    if(combo_toggle) {
        combo_run(sorkdps);
    }   
 }   
combo sorkdps {
 
   // press RT
     set_val(XB1_RT, 100);
    wait(10);
 
    wait(500);
 
if(event_press(XB1_B)) {    //frag
// press B
     set_val(XB1_B, 100);
      wait(10);
 
      wait(500);
 
}else {
    //press RB
     set_val(XB1_RB, 100);
    }
    wait(10);
 
    wait(500);
 
}
 
User avatar
asilver
Sergeant
Sergeant
 
Posts: 6
Joined: Wed Jul 10, 2019 10:13 am

Re: Noob needs help again

Postby J2Kbr » Wed Jul 24, 2019 8:22 pm

Inside combos is not possible to have branches with wait() inside, try the following:

Code: Select all
int combo_toggle = FALSE;
 
main {
    if(event_press(XB1_RS)) {
        combo_toggle = !combo_toggle;
    }
    if(combo_toggle) {
        combo_run(sorkdps);
    }   
}
 
combo sorkdps {
    set_val(XB1_RT, 100);       // press RT
    set_val(XB1_B, 0);
    wait(10);
 
    set_val(XB1_B, 0);
    wait(500);
 
    if(get_val(XB1_B)) {        // frag
        set_val(XB1_B, 100);    // press B
    } else {
        set_val(XB1_RB, 100);   // press RB
        set_val(XB1_B, 0);
    }
    wait(10);
 
    set_val(XB1_B, 0);
    wait(500);
 
    set_val(XB1_B, 0);
}
 
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: Noob needs help again

Postby asilver » Thu Jul 25, 2019 1:38 pm

thankyou for your help works fine now
User avatar
asilver
Sergeant
Sergeant
 
Posts: 6
Joined: Wed Jul 10, 2019 10:13 am


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 45 guests