I need it working on T2

GPC script programming for Titan Two device. Code examples, how to, questions, requests.

Moderators: The_Rabid_Taco, pablosscripts, bonefisher

I need it working on T2

Postby doiz » Sun Mar 17, 2019 2:31 am

I need it working on t2


thank you in advance


This error comes
GPC error: TOP Anti-Recoil.gpc (32): Illegal operation '='.

Code: Select all
#include <titanone.gph> 
 
define XIM4_MIN_VAL = 20;
 
// The force needed is different when ADS or hip firing
define ANTIRECOIL_FORCE = 6.5;
 
int tmp, rsf, xcmp;
 
 
main {
        if(get_val(PS4_R2)) {
        // Rescale XIM4 aim Y axis
        if(get_val(PS4_RY) >= XIM4_MIN_VAL) {
            set_val(PS4_RY, get_val(PS4_RY)-XIM4_MIN_VAL);
            sensitivity(PS4_RY, NOT_USE, rsf);
        } else if(get_val(PS4_RY) <= -XIM4_MIN_VAL) {
            set_val(PS4_RY, get_val(PS4_RY)+XIM4_MIN_VAL);
            sensitivity(PS4_RY, NOT_USE, rsf);
        } else set_val(PS4_RY, 0);
 
        // Rescale XIM4 aim X axis
        if(get_val(PS4_RX) >= XIM4_MIN_VAL) {
            set_val(PS4_RX, get_val(PS4_RX)-XIM4_MIN_VAL);
            sensitivity(PS4_RX, NOT_USE, rsf);
        } else if(get_val(PS4_RX) <= -XIM4_MIN_VAL) {
            set_val(PS4_RX, get_val(PS4_RX)+XIM4_MIN_VAL);
            sensitivity(PS4_RX, NOT_USE, rsf);
        } else set_val(PS4_RX, 0);
 
        // X movements compensation
        tmp = ANTIRECOIL_FORCE - 3 * abs(get_val(PS4_RX));
 
        // Apply the anti-recoil
        if(tmp <= 0) tmp = 1;
        tmp = get_val(PS4_RY) + tmp;
        if(tmp > 100) tmp = 100;
        else if(tmp < -100) tmp = -100;
        set_val(PS4_RY, tmp);
 
        // Re-apply deadzone;
        deadzone(PS4_RX, PS4_RY, XIM4_MIN_VAL, XIM4_MIN_VAL);
    }
 
 
User avatar
doiz
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Sat May 05, 2018 5:21 am

Re: I need it working on T2

Postby bonefisher » Sun Mar 17, 2019 2:43 am

Code: Select all
 
#include <titanone.gph>
 
 
#define XIM4_MIN_VAL  20
 
// The force needed is different when ADS or hip firing
#define ANTIRECOIL_FORCE  6
 
int tmp, rsf, xcmp;
 
 
main {
        if(get_val(PS4_R2)) {
        // Rescale XIM4 aim Y axis
        if(get_val(PS4_RY) >= XIM4_MIN_VAL) {
            set_val(PS4_RY, get_val(PS4_RY)-XIM4_MIN_VAL);
            sensitivity(PS4_RY, NOT_USE, rsf);
        } else if(get_val(PS4_RY) <= -XIM4_MIN_VAL) {
            set_val(PS4_RY, get_val(PS4_RY)+XIM4_MIN_VAL);
            sensitivity(PS4_RY, NOT_USE, rsf);
        } else set_val(PS4_RY, 0);
 
        // Rescale XIM4 aim X axis
        if(get_val(PS4_RX) >= XIM4_MIN_VAL) {
            set_val(PS4_RX, get_val(PS4_RX)-XIM4_MIN_VAL);
            sensitivity(PS4_RX, NOT_USE, rsf);
        } else if(get_val(PS4_RX) <= -XIM4_MIN_VAL) {
            set_val(PS4_RX, get_val(PS4_RX)+XIM4_MIN_VAL);
            sensitivity(PS4_RX, NOT_USE, rsf);
        } else set_val(PS4_RX, 0);
 
        // X movements compensation
        tmp = ANTIRECOIL_FORCE - 3 * abs(get_val(PS4_RX));
 
        // Apply the anti-recoil
        if(tmp <= 0) tmp = 1;
        tmp = get_val(PS4_RY) + tmp;
        if(tmp > 100) tmp = 100;
        else if(tmp < -100) tmp = -100;
        set_val(PS4_RY, tmp);
 
        // Re-apply deadzone;
        deadzone(PS4_RX, PS4_RY, XIM4_MIN_VAL, XIM4_MIN_VAL);
    }
}   
 
bonefisher
Major General
Major General
 
Posts: 5056
Joined: Thu Jan 29, 2015 10:49 am

Re: I need it working on T2

Postby doiz » Sun Mar 17, 2019 11:34 am

Thank you so much
You can convert this too




Code: Select all
define RAPIDFIRE_BUTTON = PS4_R2 
 
 
define RATE_OF_FIRE = 30: //Rangr: 1 to 25 RPS (Round/a)
    // Values higher than 25 would be so fast that the
    // game probably wi11 not detect 100% or the events.
 
define Blue      = 1;
define Red       = 2;
define Green     = 3;
define Pink      = 4;
define SkyBlue   = 5;
define Yellow    = 6;
define White     = 7;
 
data(1,
  2,0,0,0, //1. Blue
  0,2,0,0, //2. Red
  0,0,2,0, //3. Lime/Green
  0,0,0,2, //4. Fuchsia/Pink
  2,0,2,0, //5. SkyBlue
  0,2,2,0, //6. Yellow
  2,2,2,2  //7. White
);
 
 
int Col_ind;
 
int hold_time;
int rest_time;
int on_off;
 
 
init {
    hold_time = 500 / RATE_OF_FIRE;
    rest_time = hold_time - 5;
    if (rest_time < 0) rest_time = 0;
}
 
 
 
 
main {
 
 
    if (event_press(PS4_TRIANGLE)) {
        on_off = !on_off
    }
    if (on_off) {
        if (get_val(RAPIDFIRE_BUTTON)) {
            combo_run(RapidFire);
        } else if (combo_running(RapidFire)) {
            combo_stop(RapidFire);
        }
    }
 
  // COLOR INDICATION
     if(on_off) colourled(Green);
     else colourled(Blue);
}
 
 
combo RapidFire {
    set_val(RAPIDFIRE_BUTTON, 500);
    wait(hold_time);
    set_val(RAPIDFIRE_BUTTON, 0);
    wait(rest_time);
    set_val(RAPIDFIRE_BUTTON, 0);
}
 
function colourled(Colour) {  // COLOR LED function
    Col_ind=(Colour*4) - 3;
    set_led(LED_1,dbyte(Col_ind));
    set_led(LED_2,dbyte(Col_ind + 1));
    set_led(LED_3,dbyte(Col_ind + 2));
    set_led(LED_4,dbyte(Col_ind + 3));
}
User avatar
doiz
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Sat May 05, 2018 5:21 am

Re: I need it working on T2

Postby J2Kbr » Sun Mar 17, 2019 2:54 pm

Converted:
Code: Select all
#include <titanone.gph>
 
define RAPIDFIRE_BUTTON = PS4_R2
 
define RATE_OF_FIRE = 30; //Rangr: 1 to 25 RPS (Round/a)
    // Values higher than 25 would be so fast that the
    // game probably wi11 not detect 100% or the events.
 
define Blue      = 1;
define Red       = 2;
define Green     = 3;
define Pink      = 4;
define SkyBlue   = 5;
define Yellow    = 6;
define White     = 7;
 
data(1,
  2,0,0,0, //1. Blue
  0,2,0,0, //2. Red
  0,0,2,0, //3. Lime/Green
  0,0,0,2, //4. Fuchsia/Pink
  2,0,2,0, //5. SkyBlue
  0,2,2,0, //6. Yellow
  2,2,2,2  //7. White
);
 
int Col_ind;
 
int hold_time;
int rest_time;
int on_off;
 
init {
    hold_time = 500 / RATE_OF_FIRE;
    rest_time = hold_time - 5;
    if (rest_time < 0) rest_time = 0;
}
 
main {
    if (event_press(PS4_TRIANGLE)) {
        on_off = !on_off;
    }
    if (on_off) {
        if (get_val(RAPIDFIRE_BUTTON)) {
            combo_run(RapidFire);
        } else if (combo_running(RapidFire)) {
            combo_stop(RapidFire);
        }
    }
  // COLOR INDICATION
     if(on_off) colourled(Green);
     else colourled(Blue);
}
 
 
combo RapidFire {
    set_val(RAPIDFIRE_BUTTON, 500);
    wait(hold_time);
    set_val(RAPIDFIRE_BUTTON, 0);
    wait(rest_time);
    set_val(RAPIDFIRE_BUTTON, 0);
}
 
function colourled(Colour) {  // COLOR LED function
    Col_ind=(Colour*4) - 3;
    set_led(LED_1,dbyte(Col_ind));
    set_led(LED_2,dbyte(Col_ind + 1));
    set_led(LED_3,dbyte(Col_ind + 2));
    set_led(LED_4,dbyte(Col_ind + 3));
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 17121
Joined: Tue Mar 18, 2014 1:39 pm

Re: I need it working on T2

Postby doiz » Sun Mar 17, 2019 6:45 pm

Thank you J2Kbr and bonefisher


GPC error: as.gpc(43): syntax error, unexpected ASSIGN '='.

J2Kbr Can you do a similar script?
User avatar
doiz
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Sat May 05, 2018 5:21 am

Re: I need it working on T2

Postby UK_Wildcats_Fans » Sun Mar 17, 2019 8:02 pm

I just copied J2Kbr's script posted above and it compiles without any errors. You may want to copy it again.
User avatar
UK_Wildcats_Fans
Brigadier General
Brigadier General
 
Posts: 2067
Joined: Thu Jan 08, 2015 6:53 pm
Location: San Diego, California USA


Return to GPC Script Programming (Titan Two)

Who is online

Users browsing this forum: No registered users and 16 guests