combo Error 3 and not what is wrong

GPC2 script programming for Titan Two. Code examples, questions, requests.

combo Error 3 and not what is wrong

Postby Racing » Fri Sep 30, 2016 5:46 pm

Hi I'm adapting some things from this script but it makes me that I have 3 combo errors and not because it is and I'm going crazy.
Thanks in advance
Code: Select all
// Use the Xbox One controller on PS4
// View + Menu should active PS4 Touch click
// View triggers the PS4 Share button if held donw for more than half second
// And "Hair-Trigger" MOD
#include <xb1.gph> // for XB1
#include <ps4.gph> // for PS4
 
#define TRUE           !FALSE
 
bool inhibit_share = FALSE;
 
bool rapid_on = FALSE;
uint8 FIRE_HOLD_RAPID = 20;
uint8 FIRE_WAIT_RAPID = 20;
 
init {
   port_inhibit_ffb(PORT_USB_B);
}
 
main {
    if(get_val(XB1_P4)) {
        set_val(PS4_CIRCLE, 100);
        set_val(XB1_P4, 0);
    }
 
    if(get_val(XB1_P2)) {
        set_val(PS4_CROSS, 100);
        set_val(XB1_P2, 0);
    }
 
    if(get_val(XB1_VIEW)) {
        if(time_active(XB1_VIEW) < 1000 || inhibit_share) {
            set_val(XB1_VIEW, 0);
            if(get_val(XB1_MENU)) {
                inhibit_share = TRUE;
                set_val(XB1_MENU, 0);
                set_val(PS4_TOUCH, 100);
            }
        }
    } else inhibit_share = FALSE;
 
    if(get_val(XB1_LT)) {
        set_val(PS4_L2, 100);
    }
    if(get_val(XB1_RT)) {
        set_val(PS4_R2, 100);
    }
 
    int RAPID_FIRE_ = FALSE;
int RAPID_SLOW_FIRE = FALSE;
int RAPID_MID_FIRE = FALSE;
    define FIRE_BUTTON = PS4_R2;
    if ( get_val(PS4_UP) && get_val(PS4_L2))
    {
        if (RAPID_FIRE)
        {
            RAPID_FIRE = FALSE;
        }
           else
        {
            RAPID_FIRE = TRUE;
            RAPID_SLOW_FIRE = FALSE;
            RAPID_MID_FIRE = FALSE;
        }
          else if (get_val(PS4_LEFT) && get_val(PS4_L2) )
        if (RAPID_SLOW_FIRE)
        {
            RAPID_SLOW_FIRE = FALSE;
        }
          else
        {
            RAPID_SLOW_FIRE = TRUE;
            RAPID_FIRE = FALSE;
            RAPID_MID_FIRE = FALSE;
        }
            else if ( get_val(PS4_RIGHT) && get_val(PS4_L2) )
    {
        if (RAPID_MID_FIRE)
        {
            RAPID_MID_FIRE = FALSE;
            combo_run(SetBlue);
        }
        else
        {
            RAPID_MID_FIRE = TRUE;
            RAPID_FIRE = FALSE;
            RAPID_SLOW_FIRE = FALSE;
        }
    }
    if ( get_val(PS4_R2)>= RAPID_FIRE )
    {
        combo_run(AutoFire);
    }
    else if ( get_val(PS4_R2)>= RAPID_SLOW_FIRE )
    {
        combo_run(SlowAutoFire);
    }
     else if ( get_val(PS4_R2)>= RAPID_MID_FIRE )
    {
        combo_run(RapidMidfire);
    }
    combo RapidMidfire {
    set_val(PS4_R2, 100);
    wait(100);
    set_val(PS4_R2, 0);
    wait(30);
    set_val(FIRE_BUTTON, 0);
}
 
combo SlowAutoFire {
    set_val(PS4_R2, 100);
    wait(150);
    set_val(PS4_R2, 0);
    wait(140);
    set_val(PS4_R2, 0);
}
 
combo AutoFire {
    set_val(PS4_R2, 100);
    wait(60);
    set_val(PS4_R2,0);
    wait(30);
    set_val(PS4_R2,0);
}

PS: if it could be would like all mods (no matter which were activated deactivated hold L2 + below)
User avatar
Racing
Sergeant Major
Sergeant Major
 
Posts: 106
Joined: Thu May 26, 2016 4:18 pm

Re: combo Error 3 and not what is wrong

Postby Scachi » Fri Sep 30, 2016 8:25 pm

Hi,

you should keep track of your code indentation. Your are currently missing two or more of those closings }
Your code looks messy and is hard to read, making it very hard for your own and other who want to help you.
Take a look at the scripts in the Online Resource to get an idea how to structure, comment and indent your code.

My tip: Start small, compile it, test it, add one thing, compile it, test it, ...and so on.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: combo Error 3 and not what is wrong

Postby Racing » Fri Sep 30, 2016 10:36 pm

Thanks Scachi, the problem I think I have as you say, I want to try as many different on Titan 2 things, but as there is no programming or as program something like the problem is that trying to do something then I fails, I jam and blocked me, not like following. That's my problem but as you say I will try to do things slowly and be as it goes.
User avatar
Racing
Sergeant Major
Sergeant Major
 
Posts: 106
Joined: Thu May 26, 2016 4:18 pm

Re: combo Error 3 and not what is wrong

Postby J2Kbr » Tue Oct 04, 2016 4:40 pm

I worked a little bit your code to get it to compile without any error, please note I didn't tested its functionality.

Code: Select all
// Use the Xbox One controller on PS4
// View + Menu should active PS4 Touch click
// View triggers the PS4 Share button if held donw for more than half second
// And "Hair-Trigger" MOD
#include <xb1.gph> // for XB1
#include <ps4.gph> // for PS4
 
#define TRUE           !FALSE
 
bool inhibit_share = FALSE;
 
bool rapid_on = FALSE;
uint8 FIRE_HOLD_RAPID = 20;
uint8 FIRE_WAIT_RAPID = 20;
 
int RAPID_FIRE = FALSE;
int RAPID_SLOW_FIRE = FALSE;
int RAPID_MID_FIRE = FALSE;
int FIRE_BUTTON = PS4_R2;
 
init {
   port_inhibit_ffb(PORT_USB_B);
}
 
main {
    if(get_val(XB1_P4)) {
        set_val(PS4_CIRCLE, 100);
        set_val(XB1_P4, 0);
    }
 
    if(get_val(XB1_P2)) {
        set_val(PS4_CROSS, 100);
        set_val(XB1_P2, 0);
    }
 
    if(get_val(XB1_VIEW)) {
        if(time_active(XB1_VIEW) < 1000 || inhibit_share) {
            set_val(XB1_VIEW, 0);
            if(get_val(XB1_MENU)) {
                inhibit_share = TRUE;
                set_val(XB1_MENU, 0);
                set_val(PS4_TOUCH, 100);
            }
        }
    } else inhibit_share = FALSE;
 
    if(get_val(XB1_LT)) {
        set_val(PS4_L2, 100);
    }
    if(get_val(XB1_RT)) {
        set_val(PS4_R2, 100);
    }
 
    if ( get_val(PS4_UP) && get_val(PS4_L2)) {
        if (RAPID_FIRE)
        {
            RAPID_FIRE = FALSE;
        }
        else
        {
            RAPID_FIRE = TRUE;
            RAPID_SLOW_FIRE = FALSE;
            RAPID_MID_FIRE = FALSE;
        }
    } else if (get_val(PS4_LEFT) && get_val(PS4_L2) ) {
        if (RAPID_SLOW_FIRE)
        {
            RAPID_SLOW_FIRE = FALSE;
        }
        else
        {
            RAPID_SLOW_FIRE = TRUE;
            RAPID_FIRE = FALSE;
            RAPID_MID_FIRE = FALSE;
        }
    } else if ( get_val(PS4_RIGHT) && get_val(PS4_L2) ) {
        if (RAPID_MID_FIRE)
        {
            RAPID_MID_FIRE = FALSE;
            //combo_run(SetBlue);
        }
        else
        {
            RAPID_MID_FIRE = TRUE;
            RAPID_FIRE = FALSE;
            RAPID_SLOW_FIRE = FALSE;
        }
    }
 
    if ( RAPID_FIRE && get_val(PS4_R2) )
    {
        combo_run(AutoFire);
    }
    else if ( RAPID_SLOW_FIRE && get_val(PS4_R2) )
    {
        combo_run(SlowAutoFire);
    }
    else if ( RAPID_MID_FIRE && get_val(PS4_R2) )
    {
        combo_run(RapidMidfire);
    }
}
 
combo RapidMidfire {
    set_val(PS4_R2, 100);
    wait(100);
    set_val(PS4_R2, 0);
    wait(30);
    set_val(FIRE_BUTTON, 0);
}
 
combo SlowAutoFire {
    set_val(PS4_R2, 100);
    wait(150);
    set_val(PS4_R2, 0);
    wait(140);
    set_val(PS4_R2, 0);
}
 
combo AutoFire {
    set_val(PS4_R2, 100);
    wait(60);
    set_val(PS4_R2,0);
    wait(30);
    set_val(PS4_R2,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


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 80 guests