Help with my error

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

Help with my error

Postby johnsmith1999 » Fri Sep 08, 2017 1:23 am

Hey guys, Wetfish was kind enough to share his Battlefront script with me to use with my Titan2 but I have a problem

I am using GTuner IV and created a new Minimum GPC Script and pasted his code in and added #include <titanone.gph> to the top to get it to work..

But I am getting a error saying
GPC error: wetfish.gpc(153): syntax error, unexpected B_E, expecting C '}'.
GPC: GPC Compile ABORTED with 0 warning(s) and 1 error(s).


Here is the entire section for 153

Code: Select all
//--------- RAPIDFIRE MANAGEMENT -----------------------------------------------------------
 
        // Run Rapid Fire
        if(rapid_onoff) {if(get_val(4)) {
                              set_val(8,0); // stop running if you are doing so
                                 combo_run(RAPID_FIRE);
                         } else if (combo_running(RAPID_FIRE)) {
                                 combo_stop(RAPID_FIRE)
                         }}
 
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Help with my error

Postby johnsmith1999 » Fri Sep 08, 2017 1:26 am

Here is my whole code

Code: Select all
#include <titanone.gph>
//-------------------------------------------------------------------------------------------
//  ORIGINAL SOURCES (RAPID FIRE, ANTI RECOIL)
//-------------------------------------------------------------------------------------------
//  ANTIRECOIL (Vertical + Horizontal) and RAPIDFIRE, both adjustable on the fly, with ON/OFF and SAVE function from LEX LOST
//  GENERIC RAPID FIRE SCRIPT
//
//-------------------------------------------------------------------------------------------
//  STAR WARS BATTLEFRONT (EE-4 SPECIFIC)
//-------------------------------------------------------------------------------------------
//  Version: 1.0
//  Platform: PS4
//  Controller: Multi
//  Game: Star Wars Battlefront
//  Author: WetFish
 
 
//-------------------------------------------------------------------------------------------
// INSTRUCTIONS (BASED ON PS4):
// RAPIDFIRE (ON by default - Start value: 13)
// Double tap SQUARE turn on/off
 
// ANTIRECOIL (ON by default - Start value: vertical = 30; Horizontal = 0;)
// Double tap TRIANGLE turn on/off
// Hold CIRCLE and tap UP to increase Antirecoil (+1 each tap on UP, while holding CIRCLE)
// Hold CIRCLE and tap DOWN to decrease Antirecoil (-1 each tap on DOWN, while holding CIRCLE)
// Hold CIRCLE and tap RIGHT to compensate to the right(+1 each tap on RIGHT , while holding CIRCLE)
// Hold CRICLE and tap LEFT to compensate to the right (-1 each tap on LEFT, while holding CIRCLE)
// Save Antirecoil: Hold CIRCLE and press OPTIONS
//-------------------------------------------------------------------------------------------
 
//DECLARARATIONS - define
 
define AR_Release = 70; // change this value to determine when antirecoil stops working (min: antirecoil value)
define ONLY_WITH_SCOPE = FALSE; // if TRUE Antirecoil IS ON only when scoping
define RECOIL_UP = 13;
define RECOIL_DOWN = 14;
define RECOIL_LEFT  = 15;
define RECOIL_RIGHT = 16;
 
//-------------------------------------------------------------------------------------------
 
//VARIABLES - int
 
int recoil_onoff = TRUE; // if TRUE ANTIRECOIL is ON by default - if FALSE, OFF by default
int rapid_onoff = TRUE; // if TRUE RAPIDFIRE is ON by default - if FALSE, OFF by default
int ANTI_RECOIL = 30;
int ANTI_RECOIL_H = 0;
int anti_recoil;
int anti_recoil_H;
int time_remaining;
int DblClick_Sqr;
int DblClick_Tri;
int timelimit=300; // increase if is to fast
int DblClick_Cir;
int Barrel_Limit=1500;
 
//-------------------------------------------------------------------------------------------
 
//INITIALIZATION - init
 
init {
 
        ANTI_RECOIL = get_pvar(SPVAR_2,0,100,30);
        ANTI_RECOIL_H = get_pvar(SPVAR_3,-100,100,0);
}
 
//-------------------------------------------------------------------------------------------
 
//MAIN BLOCK ROUTINES
 
main {
 
        // Double Tap button Square to turn Rapid Fire On/Off
        if (DblClick_Sqr > 0) DblClick_Sqr = DblClick_Sqr - get_rtime();
 
        if (event_press(20) && DblClick_Sqr <= 0 ) {
                DblClick_Sqr=timelimit;
        }
        else if (event_press(20 ) && DblClick_Sqr > 0 ) {
                rapid_onoff=!rapid_onoff;
        }
 
        // Double Tap button Triangle to turn Recoil Management On/Off
        if (DblClick_Tri > 0) DblClick_Tri = DblClick_Tri - get_rtime();
 
        if (event_press(17) && DblClick_Tri <= 0 ) {
                DblClick_Tri=timelimit;
        }
        else if (event_press(17 ) && DblClick_Tri > 0 ) {
                recoil_onoff=!recoil_onoff;
        }
 
//--------- RECOIL MANAGEMENT ---------------------------------------------------------------
 
        // Manage Recoil Adjustment
        if(get_val(18)) {
 
                // Vertical Adjustment
                if(event_press(RECOIL_UP)) {
                        ANTI_RECOIL = ANTI_RECOIL + 1;
                }
                if(event_press(RECOIL_DOWN)) {
                        ANTI_RECOIL = ANTI_RECOIL - 1;
                }
                if(ANTI_RECOIL > 100) {
                        ANTI_RECOIL = 100;
                }
                set_val(RECOIL_UP,0);
                set_val(RECOIL_DOWN,0);
 
                // Horizontal Adjustment
                if(event_press(RECOIL_LEFT)) {
                        ANTI_RECOIL_H = ANTI_RECOIL_H + 1;
                }
                if(event_press(RECOIL_RIGHT)) {
                        ANTI_RECOIL_H = ANTI_RECOIL_H - 1;
                }
                if(ANTI_RECOIL_H > 100) {
                        ANTI_RECOIL_H = 100;
                }
                if(ANTI_RECOIL_H < -100) {
                        ANTI_RECOIL_H = -100;
                }
                set_val(RECOIL_LEFT,0);
                set_val(RECOIL_RIGHT,0);
        }
 
        // Save auto recoil values
        if(event_press(18) && event_press(2)) {
                set_pvar(SPVAR_2, ANTI_RECOIL);
                set_pvar(SPVAR_3, ANTI_RECOIL_H);
        }
 
        // Run Anti Recoil
        if(!ONLY_WITH_SCOPE || get_val(7) && get_val(4 )) {
                combo_run(AntiRecoil);
        }
 
        // Turn off Recoil if the left thumbstick is moved
        if ((get_val(10) < -AR_Release) || (get_val(10) > AR_Release) || (get_val(9) < -AR_Release) || (get_val(9) > AR_Release)) {
                combo_stop (AntiRecoil);
        }
 
//--------- RAPIDFIRE MANAGEMENT -----------------------------------------------------------
 
        // Run Rapid Fire
        if(rapid_onoff) {if(get_val(4)) {
                              set_val(8,0); // stop running if you are doing so
                                 combo_run(RAPID_FIRE);
                         } else if (combo_running(RAPID_FIRE)) {
                                 combo_stop(RAPID_FIRE)
                         }}
 
//--------- BARREL ROLL ------------------------------------------------------------------
 
        //Barrel Roll if left or right on the thumbstick and roll button is pressed
        if (DblClick_Cir > 0) DblClick_Cir = DblClick_Cir - get_rtime();
 
        if((get_val(11) > 70) && event_press(18) && DblClick_Cir <= 0) {         // when Y axis is > 92 is when it should normally trigger
                combo_run (HOLD_RIGHT); combo_run(ROLL); combo_run(JUMP);
                set_val(18,0);
                DblClick_Cir=Barrel_Limit;
                block(11, 500);
        }
 
        if((get_val(11) < -70) && event_press(18) && DblClick_Cir <= 0) {
                combo_run(HOLD_LEFT); combo_run(ROLL); combo_run(JUMP);
                set_val(18,0);
                DblClick_Cir=Barrel_Limit;
                block(11, 500);
        }
 
//--------- SET LED TO MATCH SETTING STATE ----------------------------------------------------
 
        if (!rapid_onoff && !recoil_onoff) {
                set_led(LED_1,0) ; set_led(LED_2,1); set_led(LED_3,0) ; set_led(LED_4,0) // red, for both off
        } else if (rapid_onoff && !recoil_onoff) {
                set_led(LED_1,1) ; set_led(LED_2,0); set_led(LED_3,0) ; set_led(LED_4,0) // blue, for rapid fire only
        } else if (!rapid_onoff && recoil_onoff) {
                set_led(LED_1,0) ; set_led(LED_2,1); set_led(LED_3,1) ; set_led(LED_4,0) // yellow, for auto recoil only
        } else {
                set_led(LED_1,0) ; set_led(LED_2,0); set_led(LED_3,1) ; set_led(LED_4,0) // green, for all on
        }
 
 
}
//-------------------------------------------------------------------------------------------
 
//COMBO BLOCKS
 
combo RAPID_FIRE {
 
        set_val(4, 100);
        wait(45); //45 for EE-4 apparently but I run 195
        set_val(4,0);
        wait(15); //15 for EE-4 apparently but I run 38/40-50 consistently
        set_val(4,0);
        set_val(4,0);
}
 
combo HOLD_RIGHT {
        if(get_val(12) > 0) { // It can't be much higher than that in a circle with an X value of 90 which is when the roll should be possible
                set_val(12, 0);
                block(12, 500);
        }
        if(get_val(12) < -0) { //Similarly can't be that much lower
                set_val(12, -0);
                block(12, 500);
        }
        set_val(11, 100);
        wait(250);
}
 
combo HOLD_LEFT {
        if(get_val(12) > 0) { // It can't be much higher than that in a circle with an X value of 90 which is when the roll should be possible
                set_val(12, 0);
                block(12, 500);
        }
        if(get_val(12) < -0) { //Similarly can't be that much lower
                set_val(12, -0);
                block(12, 500);
        }
        set_val(11, -100);
        wait(250);
}
 
combo ROLL {
        wait(30);
        set_val(18, 100);
        wait(60);
        set_val(18, 0);
        wait(60);
        set_val(18, 100);
        wait(60);
        set_val(18, 0);
        wait(200);
}
 
combo JUMP {
        wait(680); // 650 and 680 works on everything but Turning Point
        set_val(19, 100);
        wait(40);
        set_val(19, 0);
        wait(60);
        set_val(19, 100);
        wait(40);
        set_val(19, 0);
        wait(200);
}
 
combo AntiRecoil { // This combo must be the last one
        if(recoil_onoff)
                if(get_val(4)) {{
                                        anti_recoil = get_val(10) - ANTI_RECOIL; // Changed the + to a - for Inverted Axis
                                        if(anti_recoil > 100) anti_recoil = 100;
                                        set_val(10, anti_recoil);
                                        anti_recoil_H = get_val(9) + ANTI_RECOIL_H;
                                        if(anti_recoil_H > 100) anti_recoil_H = 100;
                                        if(anti_recoil_H < -100) anti_recoil_H = -100;
                                        set_val(9, anti_recoil_H);
                                }}
} // End
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Help with my error

Postby Scachi » Fri Sep 08, 2017 9:15 am

User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Help with my error

Postby johnsmith1999 » Fri Sep 08, 2017 2:27 pm

Thanks!
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 101 guests