Syntax Error

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

Syntax Error

Postby Odyssey_nova » Sun Mar 04, 2018 7:32 am

Im trying to convert this code from a device Plus gamepack and I copied it all and pasted the code into the GPC Complier and it keeps telling me '' ------ GPC: Build started ------
> 7: GOOB.gpc* : C:\Users\Keaton\Desktop\GTuner\GOOB.gpc
> ERROR line 19: sntax error near unexpected token 'int'.
Build failed with 1 errors ...''
Code: Select all
define LY                 = XB1_LY;
define LX                 = XB1_LX;
define RY                 = XB1_RY;
define RX                 = XB1_RX;
int LED_OFF     = 0;
    int Blue    = 1;
    int Red     = 2;
    int Green   = 3;
    int Pink    = 4;
    int Skyblue = 5;
    int Yellow  = 6;
    int White   = 7;
int sens
int ANTI_RECOIL  = 0;
int Invert
int ANTI_RECOIL_H  = 0;
int recoil_onoff  = FALSE;
int anti_recoil_H = 0;
int anti_recoil = 0;
main {
 const byte DEVICE_LED_COLORS[][] = {   
      {0,0,0,0},   
      {2,0,0,0},
      {0,2,0,0},
      {0,0,2,0},
      {0,0,0,2},
      {2,0,2,0},
      {0,2,2,0},
      {2,2,2,2}
      }
 
init{                                                                                 
 
     ANTI_RECOIL   = get_pvar(SPVAR_4, -100,+100, 0);   
    ANTI_RECOIL_H = get_pvar(SPVAR_3, -100,+100, 0);   
    sens = get_pvar (SPVAR_2, 0, 100, 10);
    }
main {
       if(get_val(XB1_LEFT))
       {
            combo_run(Norecoil)
       }
       if(get_val(XB1_RT)) {           
 
        combo_run(RapidFire);     
 
    } else {                   
 
        combo_stop(RapidFire);   
 
    } 
  { combo_run(LED); }
 
 
 
 
        if(get_val(XB1_LT))
        combo_run(Aimbot);
    }
 
combo LED
 { colorLED(Red);
   wait (500);
   colorLED(White);
   wait (500);
   colorLED(Blue);
   wait (500);
 } 
combo Aimbot
  {
     set_val(XB1_LT, 75);
    wait(80);
    set_val(XB1_LT, 0);
    wait(80);
    set_val(XB1_LT, 0);
}
combo RapidFire
  {
     set_val(XB1_RT, 100);
    wait(40);
    set_val(XB1_RT, 0);
    wait(40);
    set_val(XB1_RT, 0);
 
}
function colorLED(Color_Name) {
        set_led(LED_1,DEVICE_LED_COLORS [Color_Name][0]);
        set_led(LED_2,DEVICE_LED_COLORS [Color_Name][1]);
        set_led(LED_3,DEVICE_LED_COLORS [Color_Name][2]);
        set_led(LED_4,DEVICE_LED_COLORS [Color_Name][3]);
    }
combo Norecoil
  {
    if(recoil_onoff)                   
        anti_recoil = get_val(RY) + (ANTI_RECOIL * Invert);
        if(anti_recoil > 100) anti_recoil = 100;
        set_val(10, anti_recoil);               
        anti_recoil_H = get_val(RX) + ANTI_RECOIL_H;
        if(anti_recoil_H > 100) anti_recoil_H = 100;
        set_val(9, anti_recoil_H);
}
}
User avatar
Odyssey_nova
Private
Private
 
Posts: 1
Joined: Sun Mar 04, 2018 7:24 am

Re: Syntax Error

Postby J2Kbr » Mon Mar 05, 2018 12:23 pm

Errors fixed, but have not tested if it actually works.
Code: Select all
define LY                 = XB1_LY;
define LX                 = XB1_LX;
define RY                 = XB1_RY;
define RX                 = XB1_RX;
 
data(   
    0, 0, 0, 0,   
    2, 0, 0, 0,
    0, 2, 0, 0,
    0, 0, 2, 0,
    0, 0, 0, 2,
    2, 0, 2, 0,
    0, 2, 2, 0,
    2, 2, 2, 2
);
 
int LED_OFF     = 0;
int Blue    = 1;
int Red     = 2;
int Green   = 3;
int Pink    = 4;
int Skyblue = 5;
int Yellow  = 6;
int White   = 7;
int sens;
int ANTI_RECOIL  = 0;
int Invert;
int ANTI_RECOIL_H  = 0;
int recoil_onoff  = FALSE;
int anti_recoil_H = 0;
int anti_recoil = 0;
 
init{                                                                                 
    ANTI_RECOIL   = get_pvar(SPVAR_4, -100,+100, 0);   
    ANTI_RECOIL_H = get_pvar(SPVAR_3, -100,+100, 0);   
    sens = get_pvar (SPVAR_2, 0, 100, 10);
}
 
main {
    if(get_val(XB1_LEFT)) {
        combo_run(Norecoil)
    }
    if(get_val(XB1_RT)) {           
        combo_run(RapidFire);     
    } else {                   
        combo_stop(RapidFire);   
    } 
    combo_run(LED);
    if(get_val(XB1_LT)) combo_run(Aimbot);
}
 
combo LED {
    colorLED(Red);
    wait (500);
    colorLED(White);
    wait (500);
    colorLED(Blue);
    wait (500);
}
 
combo Aimbot {
    set_val(XB1_LT, 75);
    wait(80);
    set_val(XB1_LT, 0);
    wait(80);
    set_val(XB1_LT, 0);
}
 
combo RapidFire {
    set_val(XB1_RT, 100);
    wait(40);
    set_val(XB1_RT, 0);
    wait(40);
    set_val(XB1_RT, 0);
}
 
combo Norecoil {
    if(recoil_onoff) anti_recoil = get_val(RY) + (ANTI_RECOIL * Invert);
    if(anti_recoil > 100) anti_recoil = 100;
    set_val(10, anti_recoil);               
    anti_recoil_H = get_val(RX) + ANTI_RECOIL_H;
    if(anti_recoil_H > 100) anti_recoil_H = 100;
    set_val(9, anti_recoil_H);
}
 
function colorLED(Color_Name) {
    set_led(LED_1,dbyte(Color_Name*4+0));
    set_led(LED_2,dbyte(Color_Name*4+1));
    set_led(LED_3,dbyte(Color_Name*4+2));
    set_led(LED_4,dbyte(Color_Name*4+3));
}
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 GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 86 guests