Need help with this script

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

Need help with this script

Postby lucian84 » Thu Nov 16, 2017 5:21 pm

I copy paste in gtuner pro. i get an error on define i put ; after the number where its missing then press compile it jumps lower to data and says syntax error near unexpected token 'data' i remove everything with data then it jumps lower to BUTTON LAYOUT (DEFAULT) with this error syntax error near unexpected token 'rumble_if_true' if i remove everything that has with button layout i get this last errror value '6000' is out of range [10 ~ 4000] change that to 4000 and no more error after that.
but i dont whant to remove anything as i need those stuff could somene have a look and help me thanks

Code: Select all
/*SUPPORT FOR ALL BUTTON LAYOUTS
 
1 BUTTON SUPER
 
ADS SENSITIVITY CHANGE
 
ANTI-RECOIL (ADJUSTABLE)
 
ANTI-RECOIL (PRE-SETS)
 
AUTO CROUCH ON SHOT
 
AUTO REVIVE/PLANT/DEFUSE
 
AUTO SPRINT
 
AUTO STRAFE/SIDESTEP
 
HAIR TRIGGERS
 
RAPID FIRE (ADJUSTABLE)
 
RAPID FIRE ADS ONLY
 
RAPID FIRE EZ WEAPON SWITCH/ONE WEAPON
 
RAPID MELEE
 
RAPID TEABAG
 
 
 
-----------------------------------------
 
  ---INSTRUCTIONS (ALL CONTROLLERS):---
 
-----------------------------------------
 
BUTTON LAYOUTS (must toggle on activation of script)=   (PS/XBOX & UP = Bumper Jumper // PS/XBOX & DOWN = Default // PS/XBOX & LEFT = Puppeteer // PS/XBOX & RIGHT = Puppeteer & Trigger Swap)
 
 
ADS SENSITIVITY                                     =    (double tap RIGHT to toggle on/off) (rumble notification)
 
                                                        (hold SWITCH & LEFT to toggle Primary Anti-Recoil on/off - hold SWITCH & RIGHT to toggle Secondary Anti-Recoil on/off - hold SWITCH & DOWN for both Primary & Secondary Anti-Recoil on) (rumble notification)
ANTI-RECOIL (ADJUSTABLE)                            =   (hold CROUCH and adjust recoil with DPAD UP, DOWN, LEFT, or RIGHT) (rumble to notify value has changed)
                                                        (save by pressing START for Primary or SELECT for Secondary while still holding CROUCH) (rumble to notify of values saved)
 
ANTI-RECOIL (PRE-SETS)                              =   (for PRIMARY  --  hold BOTH LEFT SHOULDER BUTTONS & press Y/Triangle to load Pre-Set #1 - X/Square to load Pre-Set #2 - B/Circle to load Pre-Set #3 - A/Cross to load Pre-Set #4)
                                                        (for SECONDARY - hold BOTH RIGHT SHOULDER BUTTONS & press Y/Triangle to load Pre-Set #1 - X/Square to load Pre-Set #2 - B/Circle to load Pre-Set #3 - A/Cross to load Pre-Set #4)
 
ADJUSTABLE RAPID-FIRE                               =    (hold RELOAD and adjust rapidfire speed with DPAD UP & DOWN) (rumble to notify value has changed)
                                                        (save by pressing MELEE while still holding RELOAD) (rumble to notify of values saved) (saves automatically by default now, but this can still be toggled on if wanted)
 
AUTO CROUCH ON SHOT                                 =   (double tap DOWN to toggle on/off) (rumble notification)
 
 
AUTO REVIVE                                         =   (double tap RELOAD)
 
 
AUTO SRINT                                          =   (hold forward)
 
 
AUTO STRAFE/SIDESTEP                                =   (double tap LEFT to toggle on/off) (rumble notification)
 
 
RAPID FIRE                                          =   (hold ADS & UP) (rumble notification)
 
 
RAPID FIRE ADS ONLY                                 =   (hold FIRE & UP for Rapidfire when ADS only) (rumble notification)
 
 
RAPID FIRE (ONE WEAPON/EZ WEAPON SWITCH)            =   (hold SWITCH WEAPON & UP) (rumble notification) (press UP when active to change which weapon has rapid fire - cyan/light blue LED will show when active)
 
 
RAPID MELEE                                         =   (hold MELEE)
 
 
RAPID TEABAG                                        =   (hold CROUCH)
 
 
SLIDE SHOOT SHOULDER CHARGE                         =   (hold SPRINT and press MELEE)
 
 
TURN OFF ALL RAPIDFIRE SHOOTING SCRIPTS             =   (hold ADS & DOWN) (double rumble notification)
 
 
 
-----------------------------------------
  ----(XBOX CONTROLLER ON PS4 ONLY)----
-----------------------------------------
 
PS4 TOUCHPAD BUTTON                                 =   (VIEW button)
 
PS4 SHARE BUTTON                                    =   (ADS & VIEW button)
 
 
 
-----------------------------------------
-----------------------------------------
---------------------------------------*/

 
 
 
//BUTTON DEFINITIONS (Change the buttons here if needed to avoid breaking anything)
// define FIRE            = 4             // PS4_R2;       // XB1_RT;               =   4    //
// define ADS             = 7             // PS4_L2;       // XB1_LT;               =   7    //
define SPRINT             = 8             // PS4_L3;       // XB1_LS;               =   8    //
// define JUMP            = 6             // PS4_L1;       // XB1_LB;               =   6    //
define A_X                = 19            // PS4_CROSS;    // XB1_A;                =   19   //
// define CROUCH          = 18            // PS4_CIRCLE;   // XB1_B;                =   18   //
define SWITCH             = 17            // PS4_TRIANGLE; // XB1_Y;                =   17   //
define RELOAD             = 20            // PS4_SQUARE;   // XB1_X;                =   20   //
// define MELEE           = 5             // PS4_R3;       // XB1_RS;               =   5    //
// define GRENADE         = 3             // PS4_R1;       // XB1_RB;               =   3    //
define UP                 = 13            // PS4_UP;       // XB1_UP;               =   13   //
define RIGHT              = 16            // PS4_RIGHT;    // XB1_RIGHT;            =   16   //       DO NOT UNCOMMENT THE DEFINES IN THIS SECTION
define DOWN               = 14            // PS4_DOWN;     // XB1_DOWN;             =   14   //     THEY HAVE BEEN REPLACED BY VARIABLES TO HAVE ONE
define LEFT               = 15            // PS4_LEFT;     // XB1_LEFT;             =   15   //         SCRIPT AVAILABLE FOR ALL BUTTON LAYOUTS
define R_X                = 9             // PS4_RX;       // XB1_RX;  // RS H AXIS =   9    //
define R_Y                = 10            // PS4_RY;       // XB1_RY;  // RS V AXIS =   10   //
define L_X                = 11            // PS4_LX;       // XB1_LX;  // LS H AXIS =   11   //
define L_Y                = 12            // PS4_LY;       // XB1_LY;  // LS V AXIS =   12   //
define CONSOLE            = 0             // PS4_PS;       // XB1_XBOX;             =   0    //
define START              = 2             // PS4_OPTIONS;  // XB1_MENU;             =   2    //
define SELECT             = 1             // PS4_SHARE;    // XB1_VIEW;             =   1    //
define TOUCH              = 27            // PS4_TOUCH;    // XB1_PL2;              =   27   //
define RELOAD_PDL         = 26            // PS4_GYROZ;    // XB1_PL1; // TOP LEFT  =   26   //
define CROUCH_PDL         = 27            // PS4_TOUCH;    // XB1_PL2; // BTM LEFT  =   27   //
define MELEE_PDL          = 24            // PS4_GYROX;    // XB1_PR1; // TOP RIGHT =   24   //
define OTHER_PDL          = 25            // PS4_GYROY;    // XB1_PR2; // BTM RIGHT =   25   //
define UNDEFINED          = 35
 
 
//COLOUR DEFINITIONS
define Off                = 0;
define Dim_Blue           = 1;
define Dim_Red            = 2;
define Dim_Green          = 3;
define Dim_Pink           = 4;
define Dim_Cyan           = 5;
define Dim_Yellow         = 6;
define Dim_White          = 7;
define Blue               = 8;
define Red                = 9;
define Green              = 10;
define Pink               = 11;
define Cyan               = 12;
define Yellow             = 13;
define White              = 14;
define Bright_Blue        = 15;
define Bright_Red         = 16;
define Bright_Green       = 17;
define Bright_Pink        = 18;
define Bright_Cyan        = 19;
define Bright_Yellow      = 20;
define Bright_White       = 21;
 
// OTHER  DEFINITIONS
//  Hair Trigger
define trigger            = TRUE;                         // Set to TRUE for HAIR TRIGGERS = ON // Set to FALSE for HAIR TRIGGERS = OFF
                                                          //
                                                          //
//  Auto Revive/Defuse Time                               //
define revive_time        = 6000;                         // 6000ms = 6 seconds - Revives are less important in D2 than they were in D1, therefore changed Auto-Revive time to also work as an Auto-Defuse
                                                          // Taking damage also resets revive time, so 6 seconds will help counter that too.
                                                          //
//  Auto Strafe/Sidestep                                  //
define sidestep_time      = 300;                          // 500ms = 0.5 seconds - Decrease for a faster or increase for a slower side to side strafe/Sidestep
                                                          //
                                                          //
//  ADS Sensitivity                                       //
define ADS_sensitivity    = 18;                           // Change this to determine how slow ADS Sensitivity is when ADS Sensitivity is active
define ADS_delay          = 0;                            // 300ms = 0.3 seconds - Timer delay for ADS Sensitivity change to kick in once ADS
                                                          //
                                                          //
//  Anti-Recoil                                           //
define ADSRec_only        = TRUE;                         // Set to TRUE if anti-recoil is ADS only // Set to FALSE for anti-recoil ALWAYS
define recoil_up          = UP;                           //
define recoil_down        = DOWN;                         //           Change these definitions           
define recoil_left        = LEFT;                         // For different buttons to control Anti-Recoil
define recoil_right       = RIGHT;                        //                  direction                 
 
 
// INT
//  1 Button Super
int onebttnsuper_onoff    = FALSE;                        // Set to TRUE for 1 BUTTON SUPER = ON // Set to FALSE for 1 BUTTON SUPER = OFF
                                                          //
                                                          //
//    Auto Sprint                                           //
int sprint_onoff          = FALSE;                        // Set to TRUE for AUTO SPRINT = ON // Set to FALSE for AUTO SPRINT = OFF
                                                          //
                                                          //
//  Auto Revive                                           //
int revive_onoff          = FALSE;                        // Set to TRUE for AUTO REVIVE = ON // Set to FALSE for AUTO REVIVE = OFF
                                                          //
                                                          //
//  Auto Strafe/Sidestep                                  //
int sidestep_onoff        = FALSE;                        // Set to TRUE for AUTO-STRAFE/SIDESTEP = ON by default // Set to FALSE for AUTO-STRAFE/SIDESTEP = OFF by default
int strafe_positive       = 70;                           //
int strafe_minus          =-70;                           //
                                                          //
                                                          //
//  Auto Crouch Shot                                      //
int crouchshot_onoff      = FALSE;                        // Set to TRUE for AUTO CROUCH SHOT = ON by default // Set to FALSE for AUTO CROUCH SHOT = OFF by default
int crouchshot_time       = 300;                          // Change this to determine how long CROUCH SHOT will wait between activating the B button - Too low of a time and class abilities may be accidentally activated
                                                          //
                                                          //
//  ADS Sensitivity                                       //
int ADS_onoff             = FALSE;                        // Set to TRUE for ADS SENSITIVITY = ON by default // Set to FALSE for ADS SENSITIVITY = OFF by default
                                                          //
                                                          //                                               
//  Anti Recoil                                           //
int primary_anti_recoil   = FALSE;                        // Set to TRUE for PRIMARY ANTI-RECOIL = ON by default // Set to FALSE for PRIMARY ANTI-RECOIL = OFF by default
int pri_recoil_onoff      = TRUE;                         //
int ANTI_RECOIL_V, ANTI_RECOIL_H;                         //
int anti_recoil_V         = 0;                            //
int anti_recoil_H         = 0;                            //
int secondary_anti_recoil = FALSE;                        // Set to TRUE for SECONDARY ANTI-RECOIL = ON by default // Set to FALSE for SECONDARY ANTI-RECOIL = OFF by default
int sec_recoil_onoff      = FALSE;                        //
int ANTI_RECOIL_V_S, ANTI_RECOIL_H_S;                     //
int anti_recoil_V_S       = 0;                            //
int anti_recoil_H_S       = 0;                            //
int inverted              = FALSE;                        // Set to TRUE if using INVERTED aim // Set to FALSE if using DEFAULT aim
                                                          //
                                                          //
//  Block Buttons                                         //
int block_buttons         = 0;                            //
                                                          //
                                                          //
//  Button Layout                                         //
int default               = FALSE;                        // Set to TRUE if you use DEFAULT controller layout           // otherwise set to FALSE // You can change to this layout in-game by pressing PS/XBOX and DPAD DOWN  //
int bumper                = FALSE;                        // Set to TRUE if you use BUMPER JUMPER controller layout     // otherwise set to FALSE // You can change to this layout in-game by pressing PS/XBOX and DPAD UP    //  THE TRUE/FALSE OPTIONS AREN'T CURRENTLY WORKING   
int puppet                = FALSE;                        // Set to TRUE if you use PUPPETEER layout                    // otherwise set to FALSE // You can change to this layout in-game by pressing PS/XBOX and DPAD LEFT  //     PLEASE SET BUTTON LAYOUT BY BUTTON PRESS
int puppetswap            = FALSE;                        // Set to TRUE if you use PUPPETEER with TRIGGER SWAP layout  // otherwise set to FALSE // You can change to this layout in-game by pressing PS/XBOX and DPAD RIGHT //
int FIRE, ADS, MELEE, GRENADE, JUMP, CROUCH, SUPER, ONE;  //
                                                          //
                                                          //
//  Double Click                                          //
int tap;                                                  //
                                                          //
                                                          //
//  Rapid Fire                                            //
int ADSrapid_onoff        = FALSE;                        // Set to TRUE for ADS RAPIDFIRE = ON by default // Set to FALSE for ADS RAPIDFIRE = OFF by default //   DON'T HAVE BOTH OF THESE
int rapid_onoff           = FALSE;                        // Set to TRUE for ALL RAPIDFIRE = ON by default // Set to FALSE for ALL RAPIDFIRE = OFF by default //  SET TO TRUE SIMULTANEOUSLY
int ADSrapidtoggle_onoff  = TRUE;                         //
int rapidtoggle_onoff     = TRUE;                         //
int super_interference    = FALSE;                        // Set to TRUE if RAPIDFIRE interferes w/ SUPER  // Set to FALSE if RAPIDFIRE doesn't interfere w/ SUPER
int hold_time             = 25;                           //
int rest_time             = 15;                           //
int rounds_per_second     = 13;                           // Range: 1 to 25 RPS (rounds per second)
                                                          //
                                                          //
//  Rapid Fire EZ                                         //
int ezrapid_onoff         = TRUE;                         //
int master_ez             = FALSE;                        // Set to TRUE for EZ RAPIDFIRE = ON by default // Set to FALSE for EZ RAPIDFIRE = OFF by default
                                                          //
                                                          //
//  Rapid Fire Reset                                      //
int reset                 = TRUE;                         //
                                                          //
                                                          //
//  Timer                                                 //
int timer;                                                //
                                                          //
                                                          //
//  PS4 Led Colour                                        //
int Col_ind;                                              //
int Colour                = 1;                            //
int ledtimer              = 10;                           //
int OnOff                 = 0;                            //
                                                          //
                                                          //
//    Rumble                                                //
int rumble_type           = RUMBLE_A;                     //
int rumble_time           = 200;                          //
 
 
// UNMAP
unmap PS4_GYROX, PS4_GYROY, PS4_GYROZ, PS4_ACCX, PS4_ACCY, PS4_ACCZ, XB1_PL1, XB1_PR1, XB1_PR2;
 
 
// DATA
data (1,
//0,0,0,0, // Off
1,0,0,0, // 1.  Dim Blue
0,1,0,0, // 2.  Dim Red
0,0,1,0, // 3.  Dim Green
0,0,0,1, // 4.  Dim Pink
1,0,1,0, // 5.  Dim SkyBlue
0,1,1,0, // 6.  Dim Yellow
1,1,1,1, // 7.  Dim White
2,0,0,0, // 8.  Blue
0,2,0,0, // 9.  Red
0,0,2,0, // 10. Green
0,0,0,2, // 11. Pink
2,0,2,0, // 12. SkyBlue
0,2,2,0, // 13. Yellow
2,2,2,2, // 14. White
3,0,0,0, // 15. Bright Blue
0,3,0,0, // 16. Bright Red
0,0,3,0, // 17. Bright Green
0,0,0,3, // 18. Bright Pink
3,0,3,0, // 19. Bright SkyBlue
0,3,3,0, // 20. Bright Yellow
3,3,3,3  // 21. Bright white
 
);
 
 
init{
 
 
    ANTI_RECOIL_V       = get_pvar(SPVAR_1,-100,+100,0);
    ANTI_RECOIL_H       = get_pvar(SPVAR_2,-100,+100,0);
//    rounds_per_second   = get_pvar(SPVAR_7, 1, 25, 13);       
    ANTI_RECOIL_V_S     = get_pvar(SPVAR_3,-100,+100,0);
    ANTI_RECOIL_H_S     = get_pvar(SPVAR_4,-100,+100,0);
 
 
}
 
 
main{
// DOUBLE TAP FUNCTION
        if(tap) tap = tap - get_rtime();
 
 
// LED TOGGLE INDICATORS
    if(rapid_onoff) {                                                                                                             //
        if(rapidtoggle_onoff) {                                                                                                   //
            colourled(Green);                                          // Green  =                Rapidfire                = ON   //
            if(primary_anti_recoil && pri_recoil_onoff)                                                                           //
                colourled(Red);                                        // Red    =    Rapidfire and Primary Anti-Recoil    = ON*  //
            else if(secondary_anti_recoil && sec_recoil_onoff )                                                                   //     Change colour here if you want different
                colourled(Blue);}                                      // Blue   =   Rapidfire and Secondary Anti-Recoil   = ON*  //  colours to show which mods are active/inactive
        else if(!rapidtoggle_onoff)                                                                                               //
            set_ledx(-1, 3);}                                          // Off    =          Heavy Weapon Equipped          = OFF  //   
    if(!rapid_onoff) {//                                                                              &                           //
        set_ledx(-1, 3);                                               // Off    =        Rapidfire and Anti-Recoil        = OFF  //
        if(primary_anti_recoil && pri_recoil_onoff)                                                                               //
            colourled(Pink);                                           // Pink   =           Primary Anti-Recoil           = ON*  //
        else if(secondary_anti_recoil && sec_recoil_onoff )                                                                       //
            colourled(Yellow);}                                        // Yellow =          Secondary Anti-Recoil          = ON*  //  *Only when active on currently equipped weapon
    if(master_ez) { if(ezrapid_onoff)                                                                                             //
        colourled(Cyan);}                                              // Cyan   =         EZ/One Weapon Rapidfire         = ON*  //
    if(master_ez && secondary_anti_recoil && ezrapid_onoff && sec_recoil_onoff)                                                   //
        colourled(White);                                              // White  = 1 Weapon Rapid and 1 Weapon Anti-Recoil = ON*  //
    if(master_ez && primary_anti_recoil && ezrapid_onoff && pri_recoil_onoff)
        colourled(White);
 
 
// CONSOLE/CONTROLLER SCRIPTS
//  PS4/XBOX ONE // (XBOX VIEW BUTTON = TOUCHPAD PRESS // LT & VIEW BUTTON = SHARE)
    if(get_console() == PIO_PS4 && get_controller() != PIO_PS4){
        if(get_val(PS4_SHARE)) {
            if(!get_val(PS4_L2)) {
                set_val(PS4_TOUCH, 100);
                set_val(PS4_SHARE, 0);
            }
            set_val(PS4_L2, 0);
        }
    }
 
 
// BUTTON LAYOUT
//  DEFAULT
        if(get_val(0)) {
            if (event_press(DOWN)){
                button_layout ( TRUE , 0 , 0 , 0 );
                    { FIRE =4; ADS =7; MELEE =3; GRENADE =6; JUMP =19; CROUCH =18; ONE =16; }            // If you've tweaked your button layout using PS4 Button Assignments or
                rumble_if_true(default);                                                                 // Xbox Accessories app then you'll need to set correct definitions here
    }                                                                                                    //            ONLY TWEAK BUTTON LAYOUTS HERE IF USING DEFAULT           
 
//  BUMPER JUMPER
            if (event_press(UP)){
                button_layout ( 0 , TRUE , 0 , 0 );
                    { FIRE =4; ADS =7; MELEE =5; GRENADE =3; JUMP =6; CROUCH =18; SUPER =19; ONE =16; }  // If you've tweaked your button layout using PS4 Button Assignments or
                rumble_if_true(bumper);                                                                  // Xbox Accessories app then you'll need to set correct definitions here
    }                                                                                                    //         ONLY TWEAK BUTTON LAYOUTS HERE IF USING BUMPER JUMPER         
 
 
//  PUPPETEER
            if (event_press(LEFT)){
                button_layout ( 0 , 0 , TRUE , 0 );
                    { FIRE =4; ADS =7; MELEE =3; GRENADE =6; JUMP =19; CROUCH =5; ONE =18; }             // If you've tweaked your button layout using PS4 Button Assignments or
                rumble_if_true(puppet);                                                                  // Xbox Accessories app then you'll need to set correct definitions here
    }                                                                                                    //           ONLY TWEAK BUTTON LAYOUTS HERE IF USING PUPPETEER         
 
 
//  PUPPETEER & TRIGGER SWAP
            if (event_press(RIGHT)){
                button_layout ( 0 , 0 , 0 , TRUE );
                    { FIRE =3; ADS =6; MELEE =4; GRENADE =7; JUMP =19; CROUCH =5; ONE =18; }             // If you've tweaked your button layout using PS4 Button Assignments or
                rumble_if_true(puppetswap);                                                              // Xbox Accessories app then you'll need to set correct definitions here
    }                                                                                                    //   ONLY TWEAK BUTTON LAYOUTS HERE IF USING PUPPETEER & TRIGGER SWAP
}
 
 
// GAME SCRIPTS
//  1 BUTTON SUPER (when active press RIGHT)
     if(onebttnsuper_onoff)         
         if(get_val(ONE) && get_ptime(ONE) > 120) {  // 300ms = 0.3 seconds - Set to 0ms if you're not bothered about sing the dance emote, otherwise have a value above
             combo_run(ONEBUTTONSUPER);                   //                      120ms to stop yourself from activating your super accidentally while activate 1 button super
        }
 
 
//  AUTO DEFUSE/REVIVE (double tap RELOAD)
    if(revive_onoff) {
        if(event_press(RELOAD) && tap <= 0) {
            tap = 150;                                       // 300ms = 0.3 seconds - 120ms is my personal sweet spot for not accidetnally activating everything while sending messages
            }
            else if(event_press(RELOAD) && tap > 0) {
                combo_run(REVIVE);
        }
    }
 
 
//    AUTO SPRINT
    if(sprint_onoff) {
        if(get_val(L_Y) < -99) {set_val(SPRINT,100)}       // 99 by default - Left stick position before AUTO-SPRINT enables
}
 
 
//  AUTO STRAFE/SIDESTEP (double click LEFT to toggle on/off AUTO STRAFE)
        if(event_press(LEFT) && tap <= 0) {
            tap = 120;                                       // 300ms = 0.3 seconds - 120ms is my personal sweet spot for not accidetnally activating everything while sending messages
            }
            else if(event_press(LEFT) && tap > 0) {
                sidestep_onoff = !sidestep_onoff; 
                    rumble_if_true(sidestep_onoff);
        }
 
        if(sidestep_onoff && get_val(ADS) >1) {
            combo_run(STRAFE);     
    }
        if ((get_val(L_Y) <strafe_minus) || (get_val(L_Y) > strafe_positive) || (get_val(L_X) <strafe_minus) || (get_val(L_X) > strafe_positive)) {
             combo_stop(STRAFE);
    }
 
 
//  CROUCH SHOT/TEABAG SHOT (double click DOWN to toggle on/off CROUCH SHOT)
        if(event_press(DOWN) && tap <= 0) {
            tap = 120;                                       // 300ms = 0.3 seconds - 120ms is my personal sweet spot for not accidetnally activating everything while sending messages
            }
            else if(event_press(DOWN) && tap > 0) {
                crouchshot_onoff = !crouchshot_onoff;
                    rumble_if_true(crouchshot_onoff);
            }
        if(crouchshot_onoff && get_val(FIRE) >1) {
            combo_run(CROUCHSHOT);
    }
 
 
//  HAIR TRIGGERS (always active)
    if (trigger)
        if (get_val(ADS))
            set_val(ADS, 100);
        if (get_val(FIRE))
            set_val(FIRE, 100);
 
 
//  RAPID MELEE (hold MELEE for RAPID MELEE)
    if(get_val(MELEE) && get_ptime(MELEE) > 300) {
        combo_run(PUNCH);
    }
 
 
//  RAPID TEABAG (hold CROUCH for RAPID TEABAG/CROUCH SHOT)
    if(get_val(CROUCH) && get_ptime(CROUCH) > 300) { // (Change "CROUCH" here to another BUTTON DEFINITION if needed/wanted)
        combo_run(TEABAG);
    }
 
 
//  WARDCLIFF COIL GLITCH (hold LEFT STICK & CROUCH for infinite Warcliff Coil ammo)
    if((get_val(SPRINT) && get_ptime(SPRINT) > 300 && get_val(CROUCH) && get_ptime(CROUCH) > 300)){
        combo_run(WARDCLIFF);
    }
 
 
 
 
 
 
 
// WEAPON ADS SENSITIVITY & ANTI-RECOIL MODS
//  ADS SENSITIVITY (double click RIGHT to toggle on/off ADS SENSITIVITY)
        if(event_press(RIGHT) && tap <= 0) {
            tap = 120;                                       // 300ms = 0.3 seconds - 120ms is my personal sweet spot for not accidetnally activating everything while sending messages
            }
            else if(event_press(RIGHT) && tap > 0) {
                ADS_onoff = !ADS_onoff;
                    rumble_if_true(ADS_onoff);
        }
 
 
        if(ADS_onoff && get_val(ADS) >1) {
                    timer = timer + get_rtime();
                    if( timer >= ADS_delay ){
                            sensitivity(R_X, NOT_USE, 100 - ADS_sensitivity);       
                            sensitivity(R_Y, NOT_USE, 100 - ADS_sensitivity);       
                        }
                }else{
                        timer = 0;
    }
 
 
/*  BOTH WEAPONS ANTI-RECOIL TOGGLE (press SWITCH WEAPON & DOWN to activate anti-recoil for both primary & secondary weapons)
                                                (while active press DOWN to change which weapon has which anti-recoil settings (pink = primary / yellow = secondary) - helpful if you die and spawn with wrong weapon or wrong weapon gets anti-recoil upon activation)*/

    if(get_val(SWITCH)) {
        if(event_press(DOWN)){
            anti_recoil ( TRUE , TRUE );
                rumble_if_true(primary_anti_recoil);
                rumble_if_true(secondary_anti_recoil);
    }
 
 
 
/*  PRIMARY WEAPON ANTI-RECOIL TOGGLE (press SWITCH WEAPON & LEFT to activate anti-recoil for only primary weapon)
                                                (while active press DOWN to change which weapon has anti-recoil - helpful if you die and spawn with wrong weapon or wrong weapon gets anti-recoil upon activation)*/

        if(event_press(LEFT)){
            primary_anti_recoil = !primary_anti_recoil;
                rumble_if_true(primary_anti_recoil);
    }
 
/*  SECONDARY WEAPON ANTI-RECOIL TOGGLE (press SWITCH WEAPON & RIGHT to activate anti-recoil for only secondary weapon)
                                                (while active press DOWN to change which weapon has anti-recoil - helpful if you die and spawn with wrong weapon or wrong weapon gets anti-recoil upon activation)*/

        if(event_press(RIGHT)){
            secondary_anti_recoil = !secondary_anti_recoil;
                rumble_if_true(secondary_anti_recoil);
    }
}
 
 
// WEAPON SCRIPTS - RAPIDFIRE & WEAPON SPECIFIC MODS
/*  EASY SWAP/ONE WEAPON RAPIDFIRE TOGGLE (press SWITCH WEAPON & UP to activate rapid fire for only currently equipped weapon)
                                          (while active press UP to change which weapon has rapid fire - helpful if you die and spawn with wrong weapon or wrong weapon gets rapid fire upon activation)*/

    if(get_val(SWITCH)) {
        if (event_press(UP)){
            weapon_options ( 0 , 0 , 0 , TRUE );
 
            rumble_if_true(master_ez);
    }
}
 
 
//  ADS RAPIDFIRE TOGGLE (press FIRE & UP to activate rapid fire for ALL weapons)
    if(get_val(FIRE)) {
        if(event_press(UP)) {
            weapon_options ( 0 , TRUE , 0 , 0 );
 
            rumble_if_true(ADSrapid_onoff);
    }
} 
 
//  RAPIDFIRE TOGGLE (press ADS & UP to activate rapid fire for ALL weapons)
    if(get_val(ADS)) {
        if(event_press(UP)) {
            weapon_options ( 0 , 0 , TRUE , 0 );
 
            rumble_if_true(rapid_onoff);
    }
 
 
//  RAPIDFIRE RESET (press ADS & DOWN to deactivate all shooting scripts)
           if(event_press(DOWN)) {
            weapon_options( TRUE , 0 , 0 , 0 );
 
            rumble_if_true(rapid_onoff);
 
    }
}
 
 
/*    RAPIDFIRE (ADS)
    if(ADSrapid_onoff) {
        if(ADSrapidtoggle_onoff) {   
            if(get_val(ADS) && get_val(FIRE)) {
                combo_run(RAPIDFIRE);
            }else if(combo_running(RAPIDFIRE)){
                combo_stop(RAPIDFIRE);
            }
            if(get_val(SWITCH) && get_ptime(SWITCH) > 250) {
                ADSrapidtoggle_onoff = FALSE
                }
            if(super_interference) {
                if(event_press(SUPER)) {
                    ADSrapidtoggle_onoff = FALSE
                    }
                if(get_val(GRENADE) && get_val(MELEE)) {
                    ADSrapidtoggle_onoff = FALSE
                    }
                }
            }
        if(!ADSrapidtoggle_onoff) {
            if(get_val(SWITCH) && get_ptime(SWITCH) < 250) {
                ADSrapidtoggle_onoff = TRUE
                }
            if(get_val(UP)) {
                ADSrapidtoggle_onoff = TRUE
                }
            }
        }
*/

 
//    RAPIDFIRE (FULL)
    if(rapid_onoff) {
        if(rapidtoggle_onoff) {   
            if(get_val(FIRE)) {
                combo_run(RAPIDFIRE);
            }else if(combo_running(RAPIDFIRE)){
                combo_stop(RAPIDFIRE);
            }
            if(get_val(SWITCH) && get_ptime(SWITCH) > 250) {
                rapidtoggle_onoff = FALSE
                }
            if(super_interference) {
                if(event_press(SUPER)) {
                    rapidtoggle_onoff = FALSE
                    }
                if(get_val(GRENADE) && get_val(MELEE)) {
                    rapidtoggle_onoff = FALSE
                    }
                }
            }
        if(!rapidtoggle_onoff) {
            if(get_val(SWITCH) && get_ptime(SWITCH) < 250) {
                rapidtoggle_onoff = TRUE
                }
            if(get_val(UP)) {
                rapidtoggle_onoff = TRUE
                }
            }
        }
 
 
//  RAPIDFIRE (EASY SWAP/ONE WEAPON)
    if(event_press(SWITCH)) {
        ezrapid_onoff = !ezrapid_onoff;
        }
        if(master_ez){                                         
            if(ezrapid_onoff){
                if(get_val(FIRE)>0 ) {     
                    combo_run(RAPIDFIRE);
              }else if(combo_running(RAPIDFIRE)) {             
                   combo_stop(RAPIDFIRE);                       
            }                                               
        }
    }
    if(event_press(UP)) {
        ezrapid_onoff = !ezrapid_onoff;
    }
    if(get_val(SWITCH) && get_ptime(SWITCH) > 250) {
        ezrapid_onoff = FALSE
    } 
 
 
//  RAPIDFIRE (SUPER INTERFERENCE) (press START & UP if Subclass Super is interfering with Rapidfire)
    if(get_val(START)) {
        if(event_press(UP)) {
            super_options ( TRUE );
                rumble_if_true(super_interference);
        }
 
 
//  RAPIDFIRE (SUPER INTERFERENCE RESET) (press START & DOWN if Subclass Super doesn't interfere with Rapidfire)
           if(event_press(DOWN)) {
            super_options( 0 );
                rumble_if_true(super_interference);
 
        }
    }
 
/*  ADJUSTABLE ANTI-RECOIL (hold CROUCH and adjust recoil with DPAD UP, DOWN, LEFT, or RIGHT)
                           (save by pressing START for Primary or SELECT for Secondary while still holding CROUCH)*/

    if(get_val(CROUCH)) {
        if(event_press(recoil_up))   
            { ANTI_RECOIL_H = ANTI_RECOIL_H - 1;
                rumble_if_true(ANTI_RECOIL_H);     // Single vibrate on value change // Double vibrate when value is on 0 (no anti-recoil on axis)
    }
        if(event_press(recoil_down))
            { ANTI_RECOIL_H = ANTI_RECOIL_H + 1;
                rumble_if_true(ANTI_RECOIL_H);
    }
            if(anti_recoil_H > 100)  anti_recoil_H = 100;
            if(anti_recoil_H < -100) anti_recoil_H = -100;
            set_val(recoil_up,0);   
            set_val(recoil_down,0);
 
        if(event_press(recoil_left)) 
            { ANTI_RECOIL_V = ANTI_RECOIL_V - 1;
                rumble_if_true(ANTI_RECOIL_V);
    } 
        if(event_press(recoil_right))
            { ANTI_RECOIL_V = ANTI_RECOIL_V + 1;
                rumble_if_true(ANTI_RECOIL_V);     // Single vibrate on value change // Double vibrate when value is on 0 (no anti-recoil on axis)
    }
            if(anti_recoil_V > 100)  anti_recoil_V = 100;
            if(anti_recoil_V < -100) anti_recoil_V = -100;
            set_val(recoil_left,0)
            set_val(recoil_right,0);
 
            set_val (TRACE_5, ANTI_RECOIL_V);      //                                                         
            set_val (TRACE_6, ANTI_RECOIL_H);      //   
 
        if(event_press(SELECT)){                   //  Change BUTTON DEFINITION here if you want a different button to save the anti-recoil settings for your Primary Weapon
            set_pvar(SPVAR_1, ANTI_RECOIL_V);      //                                                SELECT = SHARE on PS4               
            set_val (TRACE_1, ANTI_RECOIL_V);      //                                                SELECT = VIEW on XBOX           
            set_pvar(SPVAR_2, ANTI_RECOIL_H);     
            set_val (TRACE_2, ANTI_RECOIL_H);                                                               
                rumble_if_true(SPVAR_1);
 
 
    }                                             
        if(event_press(START)){                    // Change BUTTON DEFINITION here if you want a different button to save the anti-recoil settings for your Secondary Weapon
            set_pvar(SPVAR_3, ANTI_RECOIL_V);      //                                                START = OPTIONS on PS4               
            set_val (TRACE_3, ANTI_RECOIL_V);      //                                                 START = MENU on XBOX           
            set_pvar(SPVAR_4, ANTI_RECOIL_H);     
            set_val (TRACE_4, ANTI_RECOIL_H);     
                rumble_if_true(SPVAR_3);
 
    }                                             
}                                               
 
     if(primary_anti_recoil)
         if(pri_recoil_onoff)
            if(!ADSRec_only || get_val(ADS) && get_val(FIRE)) {
                AntiRecoil(ANTI_RECOIL_V, ANTI_RECOIL_H)
    }
    if(secondary_anti_recoil)
        if(sec_recoil_onoff)
            if(!ADSRec_only || get_val(ADS) && get_val(FIRE)) {
                AntiRecoil(ANTI_RECOIL_V_S, ANTI_RECOIL_H_S)
        }
    if(event_press(SWITCH)) {
        pri_recoil_onoff = !pri_recoil_onoff;
        sec_recoil_onoff = !sec_recoil_onoff;
    }
    if(event_press(DOWN)) {
        pri_recoil_onoff = !pri_recoil_onoff;
        sec_recoil_onoff = !sec_recoil_onoff;
    }   
 
 
//  ANTI-RECOIL (PRE-SET WEAPONS)
// PRE-SET PRIMARY WEAPON ANTI-RECOIL
    if((get_val(6)) && (get_val(7))) {/*    L1/L2 or LB/LT by default    */
        block_buttons = 100;
            set_val(6,0);
            set_val(7,0);
            set_pvar(SPVAR_1, ANTI_RECOIL_V);
            set_val (TRACE_1, ANTI_RECOIL_V);
            set_pvar(SPVAR_2, ANTI_RECOIL_H);
            set_val (TRACE_2, ANTI_RECOIL_H);
 
//      Pre-Set Primary Weapon Recoil #1 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(17)) { // Y/Triangle
            ANTI_RECOIL_H = +30; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V =  0// Horizontal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Primary Weapon Recoil #2 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(20)) { // X/Square
            ANTI_RECOIL_H = +35; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V = +35; // Horizontal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Primary Weapon Recoil #3 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(18)) { // B/Circle
            ANTI_RECOIL_H = +45; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V = +45; // Horizontal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Primary Weapon Recoil #4 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
//        if(event_press(19)) { // A/Cross
//            ANTI_RECOIL_H = +55; // Vertical Recoil   // Positive = Down  // Negative = Up
//            ANTI_RECOIL_V = +55; // Horizontal Recoil // Positive = Right // Negative = Left
//            }
        }
 
 
// PRE-SET SECONDARY WEAPON ANTI-RECOIL
    if((get_val(3)) && (get_val(4))) {/*    R1/R2 or RB/RT by default    */
        block_buttons = 100;
            set_val(3,0);
            set_val(4,0);
            set_pvar(SPVAR_3, ANTI_RECOIL_V_S);
            set_val (TRACE_3, ANTI_RECOIL_V_S);
            set_pvar(SPVAR_4, ANTI_RECOIL_H_S);
            set_val (TRACE_4, ANTI_RECOIL_H_S);
 
//      Pre-Set Secondary Weapon Recoil #1 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(17)) { // Y/Triangle
            ANTI_RECOIL_H_S = +30; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V_S =  0// Horizontal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Secondary Weapon Recoil #2 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(20)) { // X/Square
            ANTI_RECOIL_H_S = +35; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V_S = +35; // Horiztonal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Secondary Weapon Recoil #3 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(18)) { // B/Circle
            ANTI_RECOIL_H_S = +45; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V_S = +45; // Horiztonal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Secondary Weapon Recoil #4 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
//        if(event_press(19)) { // A/Cross
//            ANTI_RECOIL_H_S = +55; // Vertical Recoil   // Positive = Down  // Negative = Up
//            ANTI_RECOIL_V_S = +55; // Horizontal Recoil // Positive = Right // Negative = Left
//            }           
        }
 
 
 
} // main block end
 
 
 
 
 
// COMBO SECTION
//  One Button Super
combo ONEBUTTONSUPER {
    set_val(GRENADE, 100);
    set_val(MELEE, 100);
}
 
 
//    Auto-Strafe/Sidestep
combo STRAFE {
    wait(100);
    set_val(L_X, 85);
    wait(sidestep_time);
    wait(100);
    set_val(L_X, -85);
    wait(sidestep_time);
}
 
 
//    Auto-Melee
combo PUNCH {
    set_val(MELEE, 100);
    wait(40);
    set_val(MELEE, 0);
    wait(40);
    set_val(MELEE, 0);
}
 
 
//    Auto-Revive
combo REVIVE {
    set_val(RELOAD, 100);
    wait(revive_time);
    set_val(RELOAD, 0);
}
 
 
//  Crouch Shot
combo CROUCHSHOT {
    set_val(CROUCH, 100);
    wait(50);
    set_val(CROUCH, 0);
    wait(crouchshot_time);
}
 
 
//    Notification (Rumble Once = Actived - Rumble Twice = Deactivated)
combo NOTIFY {
    set_rumble(rumble_type,100);
    wait(rumble_time);
    reset_rumble();
    wait(100);
    if(rumble_type) set_rumble(rumble_type,100);
    wait(rumble_time);
    reset_rumble();
}
 
 
//    Rapidfire
combo RAPIDFIRE {
    set_val(FIRE, 100);
    wait(hold_time);
    set_val(FIRE, 0);
    wait(rest_time);
    set_val(FIRE, 0);
    wait(rest_time);
}
 
 
//    Rapid Crouch/Teabag
combo TEABAG {
    set_val(CROUCH, 100);
    wait(25);
    set_val(CROUCH, 0);
    wait(25);
    set_val(CROUCH, 0);
}
 
 
//  Wardcliff Glitch
combo WARDCLIFF {
    set_val(CROUCH, 100);
    set_val(FIRE, 100);
    wait(35);
    set_val(CROUCH, 0);
    set_val(FIRE, 0);
    wait(35);
}
 
 
 
 
 
// FUNCTION
//    Button Layouts
function button_layout( default , bumper , puppet , puppetswap ) {
 
    default               = default;
    bumper             = bumper;
    puppet             = puppet;
    puppetswap         = puppetswap;
 
}
 
//  Anti-Recoil
function anti_recoil( pri , sec ) {
 
    primary_anti_recoil   = pri;
    secondary_anti_recoil = sec;
 
}
 
//  Super Interference
function super_options( super ) {
 
    super_interference = super;
 
}
 
//    Weapon Options
function weapon_options( reset , ADSRF , RF , EZ ) {
 
    reset             = reset;
    ADSrapid_onoff   = ADSRF;
    rapid_onoff      = RF;
    master_ez        = EZ;
 
}
 
 
//    Rumble Notification
function rumble_if_true(var){
    if(var) {
        rumble_type = RUMBLE_A;
        rumble_time= 200;
    }
    else{
        rumble_type = RUMBLE_B;
        rumble_time = 200;
    }
    combo_run(NOTIFY);
}
 
 
//  Button Functions
//function FIRE(){set_val(FIRE, 100);}
//function NOFIRE(){set_val(FIRE, 0);}
//function JUMP(){set_val(JUMP, 100);}
//function NOJUMP(){set_val(JUMP, 0);}
//function RELOAD(){set_val(RELOAD, 100);}
//function NORELOAD(){set_val(RELOAD, 0);}
//function CROUCH(){set_val(CROUCH, 100);}
//function NOCROUCH(){set_val(CROUCH, 0);}
//function MELEE(){set_val(MELEE, 100);}
//function NOMELEE(){set_val(MELEE, 0);}
//function NLY(){set_val(L_Y, -100);}
 
 
//  Smarter Anti-Recoil
function AntiRecoil (AntiRecoil_H, AntiRecoil_V)
{
    //  Anti-recoil parameters
    if (get_val(FIRE) && isqrt(pow(get_val(R_X), 2) + pow(get_val(R_Y), 2)) <= abs(AntiRecoil_V))
    {
        if (abs(R_Y) <= abs(AntiRecoil_V))
        {
            // Horizontal anti-recoil
            anti_recoil_H = (get_val(R_X) + (AntiRecoil_H*(100-abs(get_val(R_X))))/100);
            set_val(R_X, anti_recoil_H);
 
            // Vertical anti-recoil
            if (inverted)
                 { anti_recoil_V = (get_val(R_Y) - (AntiRecoil_V*(100-abs(get_val(R_Y))))/100); } // Y-axis invert
            else { anti_recoil_V = (get_val(R_Y) + (AntiRecoil_V*(100-abs(get_val(R_Y))))/100); }
            if (anti_recoil_V >  (AntiRecoil_V)) {anti_recoil_V = (AntiRecoil_V) ;}
            set_val(R_Y, anti_recoil_V);
        }
    }
}
 
 
//  Smarter Anti-Recoil Secondary
//function AntiRecoilS (AntiRecoil_H_S, AntiRecoil_V_S)
//{
//    //  Anti-recoil parameters
//    if (get_val(FIRE) && isqrt(pow(get_val(R_X), 2) + pow(get_val(R_Y), 2)) <= abs(AntiRecoil_V_S))
//    {
//        if (abs(R_Y) <= abs(AntiRecoil_V_S))
//        {
//            // Horizontal anti-recoil
//            anti_recoil_H_S = (get_val(R_X) + (AntiRecoil_H_S*(100-abs(get_val(R_X))))/100);
//            set_val(R_X, anti_recoil_H_S);
//
//            // Vertical anti-recoil
//            if (inverted)
//                 { anti_recoil_V_S = (get_val(R_Y) - (AntiRecoil_V_S*(100-abs(get_val(R_Y))))/100); } // Y-axis invert
//            else { anti_recoil_V_S = (get_val(R_Y) + (AntiRecoil_V_S*(100-abs(get_val(R_Y))))/100); }
//            if (anti_recoil_V_S >  (AntiRecoil_V_S)) {anti_recoil_V_S = (AntiRecoil_V_S) ;}
//            set_val(R_Y, anti_recoil_V_S);
//        }
//    }
//}
 
 
//  Colour LED Function for PS4
function colourled(Colour) {
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
lucian84
Command Sergeant Major
Command Sergeant Major
 
Posts: 140
Joined: Wed Nov 08, 2017 1:04 pm

Re: Need help with this script

Postby J2Kbr » Fri Nov 17, 2017 9:11 am

Fixed the code, now it compiles without error, I have not tested its functionality though.
Code: Select all
/*SUPPORT FOR ALL BUTTON LAYOUTS
 
1 BUTTON SUPER
 
ADS SENSITIVITY CHANGE
 
ANTI-RECOIL (ADJUSTABLE)
 
ANTI-RECOIL (PRE-SETS)
 
AUTO CROUCH ON SHOT
 
AUTO REVIVE/PLANT/DEFUSE
 
AUTO SPRINT
 
AUTO STRAFE/SIDESTEP
 
HAIR TRIGGERS
 
RAPID FIRE (ADJUSTABLE)
 
RAPID FIRE ADS ONLY
 
RAPID FIRE EZ WEAPON SWITCH/ONE WEAPON
 
RAPID MELEE
 
RAPID TEABAG
 
 
 
-----------------------------------------
 
  ---INSTRUCTIONS (ALL CONTROLLERS):---
 
-----------------------------------------
 
BUTTON LAYOUTS (must toggle on activation of script)=   (PS/XBOX & UP = Bumper Jumper // PS/XBOX & DOWN = Default // PS/XBOX & LEFT = Puppeteer // PS/XBOX & RIGHT = Puppeteer & Trigger Swap)
 
 
ADS SENSITIVITY                                     =    (double tap RIGHT to toggle on/off) (rumble notification)
 
                                                        (hold SWITCH & LEFT to toggle Primary Anti-Recoil on/off - hold SWITCH & RIGHT to toggle Secondary Anti-Recoil on/off - hold SWITCH & DOWN for both Primary & Secondary Anti-Recoil on) (rumble notification)
ANTI-RECOIL (ADJUSTABLE)                            =   (hold CROUCH and adjust recoil with DPAD UP, DOWN, LEFT, or RIGHT) (rumble to notify value has changed)
                                                        (save by pressing START for Primary or SELECT for Secondary while still holding CROUCH) (rumble to notify of values saved)
 
ANTI-RECOIL (PRE-SETS)                              =   (for PRIMARY  --  hold BOTH LEFT SHOULDER BUTTONS & press Y/Triangle to load Pre-Set #1 - X/Square to load Pre-Set #2 - B/Circle to load Pre-Set #3 - A/Cross to load Pre-Set #4)
                                                        (for SECONDARY - hold BOTH RIGHT SHOULDER BUTTONS & press Y/Triangle to load Pre-Set #1 - X/Square to load Pre-Set #2 - B/Circle to load Pre-Set #3 - A/Cross to load Pre-Set #4)
 
ADJUSTABLE RAPID-FIRE                               =    (hold RELOAD and adjust rapidfire speed with DPAD UP & DOWN) (rumble to notify value has changed)
                                                        (save by pressing MELEE while still holding RELOAD) (rumble to notify of values saved) (saves automatically by default now, but this can still be toggled on if wanted)
 
AUTO CROUCH ON SHOT                                 =   (double tap DOWN to toggle on/off) (rumble notification)
 
 
AUTO REVIVE                                         =   (double tap RELOAD)
 
 
AUTO SRINT                                          =   (hold forward)
 
 
AUTO STRAFE/SIDESTEP                                =   (double tap LEFT to toggle on/off) (rumble notification)
 
 
RAPID FIRE                                          =   (hold ADS & UP) (rumble notification)
 
 
RAPID FIRE ADS ONLY                                 =   (hold FIRE & UP for Rapidfire when ADS only) (rumble notification)
 
 
RAPID FIRE (ONE WEAPON/EZ WEAPON SWITCH)            =   (hold SWITCH WEAPON & UP) (rumble notification) (press UP when active to change which weapon has rapid fire - cyan/light blue LED will show when active)
 
 
RAPID MELEE                                         =   (hold MELEE)
 
 
RAPID TEABAG                                        =   (hold CROUCH)
 
 
SLIDE SHOOT SHOULDER CHARGE                         =   (hold SPRINT and press MELEE)
 
 
TURN OFF ALL RAPIDFIRE SHOOTING SCRIPTS             =   (hold ADS & DOWN) (double rumble notification)
 
 
 
-----------------------------------------
  ----(XBOX CONTROLLER ON PS4 ONLY)----
-----------------------------------------
 
PS4 TOUCHPAD BUTTON                                 =   (VIEW button)
 
PS4 SHARE BUTTON                                    =   (ADS & VIEW button)
 
 
 
-----------------------------------------
-----------------------------------------
---------------------------------------*/

 
 
 
//BUTTON DEFINITIONS (Change the buttons here if needed to avoid breaking anything)
// define FIRE            = 4;             // PS4_R2;       // XB1_RT;               =   4    //
// define ADS             = 7;             // PS4_L2;       // XB1_LT;               =   7    //
define SPRINT             = 8;             // PS4_L3;       // XB1_LS;               =   8    //
// define JUMP            = 6;             // PS4_L1;       // XB1_LB;               =   6    //
define A_X                = 19;            // PS4_CROSS;    // XB1_A;                =   19   //
// define CROUCH          = 18;            // PS4_CIRCLE;   // XB1_B;                =   18   //
define SWITCH             = 17;            // PS4_TRIANGLE; // XB1_Y;                =   17   //
define RELOAD             = 20;            // PS4_SQUARE;   // XB1_X;                =   20   //
// define MELEE           = 5;             // PS4_R3;       // XB1_RS;               =   5    //
// define GRENADE         = 3;             // PS4_R1;       // XB1_RB;               =   3    //
define UP                 = 13;            // PS4_UP;       // XB1_UP;               =   13   //
define RIGHT              = 16;            // PS4_RIGHT;    // XB1_RIGHT;            =   16   //       DO NOT UNCOMMENT THE DEFINES IN THIS SECTION
define DOWN               = 14;            // PS4_DOWN;     // XB1_DOWN;             =   14   //     THEY HAVE BEEN REPLACED BY VARIABLES TO HAVE ONE
define LEFT               = 15;            // PS4_LEFT;     // XB1_LEFT;             =   15   //         SCRIPT AVAILABLE FOR ALL BUTTON LAYOUTS
define R_X                = 9;             // PS4_RX;       // XB1_RX;  // RS H AXIS =   9    //
define R_Y                = 10;            // PS4_RY;       // XB1_RY;  // RS V AXIS =   10   //
define L_X                = 11;            // PS4_LX;       // XB1_LX;  // LS H AXIS =   11   //
define L_Y                = 12;            // PS4_LY;       // XB1_LY;  // LS V AXIS =   12   //
define CONSOLE            = 0;             // PS4_PS;       // XB1_XBOX;             =   0    //
define START              = 2;             // PS4_OPTIONS;  // XB1_MENU;             =   2    //
define SELECT             = 1;             // PS4_SHARE;    // XB1_VIEW;             =   1    //
define TOUCH              = 27;            // PS4_TOUCH;    // XB1_PL2;              =   27   //
define RELOAD_PDL         = 26;            // PS4_GYROZ;    // XB1_PL1; // TOP LEFT  =   26   //
define CROUCH_PDL         = 27;            // PS4_TOUCH;    // XB1_PL2; // BTM LEFT  =   27   //
define MELEE_PDL          = 24;            // PS4_GYROX;    // XB1_PR1; // TOP RIGHT =   24   //
define OTHER_PDL          = 25;            // PS4_GYROY;    // XB1_PR2; // BTM RIGHT =   25   //
define UNDEFINED          = 35;
 
 
//COLOUR DEFINITIONS
define Off                = 0;
define Dim_Blue           = 1;
define Dim_Red            = 2;
define Dim_Green          = 3;
define Dim_Pink           = 4;
define Dim_Cyan           = 5;
define Dim_Yellow         = 6;
define Dim_White          = 7;
define Blue               = 8;
define Red                = 9;
define Green              = 10;
define Pink               = 11;
define Cyan               = 12;
define Yellow             = 13;
define White              = 14;
define Bright_Blue        = 15;
define Bright_Red         = 16;
define Bright_Green       = 17;
define Bright_Pink        = 18;
define Bright_Cyan        = 19;
define Bright_Yellow      = 20;
define Bright_White       = 21;
 
// OTHER  DEFINITIONS
//  Hair Trigger
define trigger            = TRUE;                         // Set to TRUE for HAIR TRIGGERS = ON // Set to FALSE for HAIR TRIGGERS = OFF
                                                          //
                                                          //
//  Auto Revive/Defuse Time                               //
define revive_time        = 4000;                         // 6000ms = 6 seconds - Revives are less important in D2 than they were in D1, therefore changed Auto-Revive time to also work as an Auto-Defuse
                                                          // Taking damage also resets revive time, so 6 seconds will help counter that too.
                                                          //
//  Auto Strafe/Sidestep                                  //
define sidestep_time      = 300;                          // 500ms = 0.5 seconds - Decrease for a faster or increase for a slower side to side strafe/Sidestep
                                                          //
                                                          //
//  ADS Sensitivity                                       //
define ADS_sensitivity    = 18;                           // Change this to determine how slow ADS Sensitivity is when ADS Sensitivity is active
define ADS_delay          = 0;                            // 300ms = 0.3 seconds - Timer delay for ADS Sensitivity change to kick in once ADS
                                                          //
                                                          //
//  Anti-Recoil                                           //
define ADSRec_only        = TRUE;                         // Set to TRUE if anti-recoil is ADS only // Set to FALSE for anti-recoil ALWAYS
define recoil_up          = UP;                           //
define recoil_down        = DOWN;                         //           Change these definitions           
define recoil_left        = LEFT;                         // For different buttons to control Anti-Recoil
define recoil_right       = RIGHT;                        //                  direction                 
 
// DATA
data (1,
//0,0,0,0, // Off
1,0,0,0, // 1.  Dim Blue
0,1,0,0, // 2.  Dim Red
0,0,1,0, // 3.  Dim Green
0,0,0,1, // 4.  Dim Pink
1,0,1,0, // 5.  Dim SkyBlue
0,1,1,0, // 6.  Dim Yellow
1,1,1,1, // 7.  Dim White
2,0,0,0, // 8.  Blue
0,2,0,0, // 9.  Red
0,0,2,0, // 10. Green
0,0,0,2, // 11. Pink
2,0,2,0, // 12. SkyBlue
0,2,2,0, // 13. Yellow
2,2,2,2, // 14. White
3,0,0,0, // 15. Bright Blue
0,3,0,0, // 16. Bright Red
0,0,3,0, // 17. Bright Green
0,0,0,3, // 18. Bright Pink
3,0,3,0, // 19. Bright SkyBlue
0,3,3,0, // 20. Bright Yellow
3,3,3,3  // 21. Bright white
 
);
 
// INT
//  1 Button Super
int onebttnsuper_onoff    = FALSE;                        // Set to TRUE for 1 BUTTON SUPER = ON // Set to FALSE for 1 BUTTON SUPER = OFF
                                                          //
                                                          //
//    Auto Sprint                                           //
int sprint_onoff          = FALSE;                        // Set to TRUE for AUTO SPRINT = ON // Set to FALSE for AUTO SPRINT = OFF
                                                          //
                                                          //
//  Auto Revive                                           //
int revive_onoff          = FALSE;                        // Set to TRUE for AUTO REVIVE = ON // Set to FALSE for AUTO REVIVE = OFF
                                                          //
                                                          //
//  Auto Strafe/Sidestep                                  //
int sidestep_onoff        = FALSE;                        // Set to TRUE for AUTO-STRAFE/SIDESTEP = ON by default // Set to FALSE for AUTO-STRAFE/SIDESTEP = OFF by default
int strafe_positive       = 70;                           //
int strafe_minus          =-70;                           //
                                                          //
                                                          //
//  Auto Crouch Shot                                      //
int crouchshot_onoff      = FALSE;                        // Set to TRUE for AUTO CROUCH SHOT = ON by default // Set to FALSE for AUTO CROUCH SHOT = OFF by default
int crouchshot_time       = 300;                          // Change this to determine how long CROUCH SHOT will wait between activating the B button - Too low of a time and class abilities may be accidentally activated
                                                          //
                                                          //
//  ADS Sensitivity                                       //
int ADS_onoff             = FALSE;                        // Set to TRUE for ADS SENSITIVITY = ON by default // Set to FALSE for ADS SENSITIVITY = OFF by default
                                                          //
                                                          //                                               
//  Anti Recoil                                           //
int primary_anti_recoil   = FALSE;                        // Set to TRUE for PRIMARY ANTI-RECOIL = ON by default // Set to FALSE for PRIMARY ANTI-RECOIL = OFF by default
int pri_recoil_onoff      = TRUE;                         //
int ANTI_RECOIL_V, ANTI_RECOIL_H;                         //
int anti_recoil_V         = 0;                            //
int anti_recoil_H         = 0;                            //
int secondary_anti_recoil = FALSE;                        // Set to TRUE for SECONDARY ANTI-RECOIL = ON by default // Set to FALSE for SECONDARY ANTI-RECOIL = OFF by default
int sec_recoil_onoff      = FALSE;                        //
int ANTI_RECOIL_V_S, ANTI_RECOIL_H_S;                     //
int anti_recoil_V_S       = 0;                            //
int anti_recoil_H_S       = 0;                            //
int inverted              = FALSE;                        // Set to TRUE if using INVERTED aim // Set to FALSE if using DEFAULT aim
                                                          //
                                                          //
//  Block Buttons                                         //
int block_buttons         = 0;                            //
                                                          //
                                                          //
//  Button Layout                                         //
int default               = FALSE;                        // Set to TRUE if you use DEFAULT controller layout           // otherwise set to FALSE // You can change to this layout in-game by pressing PS/XBOX and DPAD DOWN  //
int bumper                = FALSE;                        // Set to TRUE if you use BUMPER JUMPER controller layout     // otherwise set to FALSE // You can change to this layout in-game by pressing PS/XBOX and DPAD UP    //  THE TRUE/FALSE OPTIONS AREN'T CURRENTLY WORKING   
int puppet                = FALSE;                        // Set to TRUE if you use PUPPETEER layout                    // otherwise set to FALSE // You can change to this layout in-game by pressing PS/XBOX and DPAD LEFT  //     PLEASE SET BUTTON LAYOUT BY BUTTON PRESS
int puppetswap            = FALSE;                        // Set to TRUE if you use PUPPETEER with TRIGGER SWAP layout  // otherwise set to FALSE // You can change to this layout in-game by pressing PS/XBOX and DPAD RIGHT //
int FIRE, ADS, MELEE, GRENADE, JUMP, CROUCH, SUPER, ONE;  //
                                                          //
                                                          //
//  Double Click                                          //
int tap;                                                  //
                                                          //
                                                          //
//  Rapid Fire                                            //
int ADSrapid_onoff        = FALSE;                        // Set to TRUE for ADS RAPIDFIRE = ON by default // Set to FALSE for ADS RAPIDFIRE = OFF by default //   DON'T HAVE BOTH OF THESE
int rapid_onoff           = FALSE;                        // Set to TRUE for ALL RAPIDFIRE = ON by default // Set to FALSE for ALL RAPIDFIRE = OFF by default //  SET TO TRUE SIMULTANEOUSLY
int ADSrapidtoggle_onoff  = TRUE;                         //
int rapidtoggle_onoff     = TRUE;                         //
int super_interference    = FALSE;                        // Set to TRUE if RAPIDFIRE interferes w/ SUPER  // Set to FALSE if RAPIDFIRE doesn't interfere w/ SUPER
int hold_time             = 25;                           //
int rest_time             = 15;                           //
int rounds_per_second     = 13;                           // Range: 1 to 25 RPS (rounds per second)
                                                          //
                                                          //
//  Rapid Fire EZ                                         //
int ezrapid_onoff         = TRUE;                         //
int master_ez             = FALSE;                        // Set to TRUE for EZ RAPIDFIRE = ON by default // Set to FALSE for EZ RAPIDFIRE = OFF by default
                                                          //
                                                          //
//  Rapid Fire Reset                                      //
int reset                 = TRUE;                         //
                                                          //
                                                          //
//  Timer                                                 //
int timer;                                                //
                                                          //
                                                          //
//  PS4 Led Colour                                        //
int Col_ind;                                              //
int Colour                = 1;                            //
int ledtimer              = 10;                           //
int OnOff                 = 0;                            //
                                                          //
                                                          //
//    Rumble                                              //
int rumble_type           = RUMBLE_A;                     //
int rumble_time           = 200;                          //
 
 
// UNMAP
unmap PS4_GYROX, PS4_GYROY, PS4_GYROZ, PS4_ACCX, PS4_ACCY, PS4_ACCZ, XB1_P1, XB1_P2, XB1_P3;
 
init{
    ANTI_RECOIL_V       = get_pvar(SPVAR_1,-100,+100,0);
    ANTI_RECOIL_H       = get_pvar(SPVAR_2,-100,+100,0);
//    rounds_per_second   = get_pvar(SPVAR_7, 1, 25, 13);       
    ANTI_RECOIL_V_S     = get_pvar(SPVAR_3,-100,+100,0);
    ANTI_RECOIL_H_S     = get_pvar(SPVAR_4,-100,+100,0);
}
 
main {
// DOUBLE TAP FUNCTION
        if(tap) tap = tap - get_rtime();
 
 
// LED TOGGLE INDICATORS
    if(rapid_onoff) {                                                                                                             //
        if(rapidtoggle_onoff) {                                                                                                   //
            colourled(Green);                                          // Green  =                Rapidfire                = ON   //
            if(primary_anti_recoil && pri_recoil_onoff)                                                                           //
                colourled(Red);                                        // Red    =    Rapidfire and Primary Anti-Recoil    = ON*  //
            else if(secondary_anti_recoil && sec_recoil_onoff )                                                                   //     Change colour here if you want different
                colourled(Blue);}                                      // Blue   =   Rapidfire and Secondary Anti-Recoil   = ON*  //  colours to show which mods are active/inactive
        else if(!rapidtoggle_onoff)                                                                                               //
            set_ledx(-1, 3);}                                          // Off    =          Heavy Weapon Equipped          = OFF  //   
    if(!rapid_onoff) {//                                                                              &                           //
        set_ledx(-1, 3);                                               // Off    =        Rapidfire and Anti-Recoil        = OFF  //
        if(primary_anti_recoil && pri_recoil_onoff)                                                                               //
            colourled(Pink);                                           // Pink   =           Primary Anti-Recoil           = ON*  //
        else if(secondary_anti_recoil && sec_recoil_onoff )                                                                       //
            colourled(Yellow);}                                        // Yellow =          Secondary Anti-Recoil          = ON*  //  *Only when active on currently equipped weapon
    if(master_ez) { if(ezrapid_onoff)                                                                                             //
        colourled(Cyan);}                                              // Cyan   =         EZ/One Weapon Rapidfire         = ON*  //
    if(master_ez && secondary_anti_recoil && ezrapid_onoff && sec_recoil_onoff)                                                   //
        colourled(White);                                              // White  = 1 Weapon Rapid and 1 Weapon Anti-Recoil = ON*  //
    if(master_ez && primary_anti_recoil && ezrapid_onoff && pri_recoil_onoff)
        colourled(White);
 
 
// CONSOLE/CONTROLLER SCRIPTS
//  PS4/XBOX ONE // (XBOX VIEW BUTTON = TOUCHPAD PRESS // LT & VIEW BUTTON = SHARE)
    if(get_console() == PIO_PS4 && get_controller() != PIO_PS4){
        if(get_val(PS4_SHARE)) {
            if(!get_val(PS4_L2)) {
                set_val(PS4_TOUCH, 100);
                set_val(PS4_SHARE, 0);
            }
            set_val(PS4_L2, 0);
        }
    }
 
 
// BUTTON LAYOUT
//  DEFAULT
        if(get_val(0)) {
            if (event_press(DOWN)){
                button_layout ( TRUE , 0 , 0 , 0 );
                FIRE =4; ADS =7; MELEE =3; GRENADE =6; JUMP =19; CROUCH =18; ONE =16;             // If you've tweaked your button layout using PS4 Button Assignments or
                //rumble_if_true(default);                                                                 // Xbox Accessories app then you'll need to set correct definitions here
    }                                                                                                    //            ONLY TWEAK BUTTON LAYOUTS HERE IF USING DEFAULT           
 
//  BUMPER JUMPER
            if (event_press(UP)){
                button_layout ( 0 , TRUE , 0 , 0 );
                FIRE =4; ADS =7; MELEE =5; GRENADE =3; JUMP =6; CROUCH =18; SUPER =19; ONE =16;   // If you've tweaked your button layout using PS4 Button Assignments or
                //rumble_if_true(bumper);                                                                  // Xbox Accessories app then you'll need to set correct definitions here
    }                                                                                                    //         ONLY TWEAK BUTTON LAYOUTS HERE IF USING BUMPER JUMPER         
 
 
//  PUPPETEER
            if (event_press(LEFT)){
                button_layout ( 0 , 0 , TRUE , 0 );
                FIRE =4; ADS =7; MELEE =3; GRENADE =6; JUMP =19; CROUCH =5; ONE =18;              // If you've tweaked your button layout using PS4 Button Assignments or
                //rumble_if_true(puppet);                                                                  // Xbox Accessories app then you'll need to set correct definitions here
    }                                                                                                    //           ONLY TWEAK BUTTON LAYOUTS HERE IF USING PUPPETEER         
 
 
//  PUPPETEER & TRIGGER SWAP
            if (event_press(RIGHT)){
                button_layout ( 0 , 0 , 0 , TRUE );
                FIRE =3; ADS =6; MELEE =4; GRENADE =7; JUMP =19; CROUCH =5; ONE =18;              // If you've tweaked your button layout using PS4 Button Assignments or
                //rumble_if_true(puppetswap);                                                              // Xbox Accessories app then you'll need to set correct definitions here
    }                                                                                                    //   ONLY TWEAK BUTTON LAYOUTS HERE IF USING PUPPETEER & TRIGGER SWAP
}
 
 
// GAME SCRIPTS
//  1 BUTTON SUPER (when active press RIGHT)
     if(onebttnsuper_onoff)         
         if(get_val(ONE) && get_ptime(ONE) > 120) {  // 300ms = 0.3 seconds - Set to 0ms if you're not bothered about sing the dance emote, otherwise have a value above
             combo_run(ONEBUTTONSUPER);                   //                      120ms to stop yourself from activating your super accidentally while activate 1 button super
        }
 
 
//  AUTO DEFUSE/REVIVE (double tap RELOAD)
    if(revive_onoff) {
        if(event_press(RELOAD) && tap <= 0) {
            tap = 150;                                       // 300ms = 0.3 seconds - 120ms is my personal sweet spot for not accidetnally activating everything while sending messages
            }
            else if(event_press(RELOAD) && tap > 0) {
                combo_run(REVIVE);
        }
    }
 
 
//    AUTO SPRINT
    if(sprint_onoff) {
        if(get_val(L_Y) < -99) {set_val(SPRINT,100)}       // 99 by default - Left stick position before AUTO-SPRINT enables
}
 
 
//  AUTO STRAFE/SIDESTEP (double click LEFT to toggle on/off AUTO STRAFE)
        if(event_press(LEFT) && tap <= 0) {
            tap = 120;                                       // 300ms = 0.3 seconds - 120ms is my personal sweet spot for not accidetnally activating everything while sending messages
            }
            else if(event_press(LEFT) && tap > 0) {
                sidestep_onoff = !sidestep_onoff; 
                    //rumble_if_true(sidestep_onoff);
        }
 
        if(sidestep_onoff && get_val(ADS) >1) {
            combo_run(STRAFE);     
    }
        if ((get_val(L_Y) <strafe_minus) || (get_val(L_Y) > strafe_positive) || (get_val(L_X) <strafe_minus) || (get_val(L_X) > strafe_positive)) {
             combo_stop(STRAFE);
    }
 
 
//  CROUCH SHOT/TEABAG SHOT (double click DOWN to toggle on/off CROUCH SHOT)
        if(event_press(DOWN) && tap <= 0) {
            tap = 120;                                       // 300ms = 0.3 seconds - 120ms is my personal sweet spot for not accidetnally activating everything while sending messages
            }
            else if(event_press(DOWN) && tap > 0) {
                crouchshot_onoff = !crouchshot_onoff;
                    //rumble_if_true(crouchshot_onoff);
            }
        if(crouchshot_onoff && get_val(FIRE) >1) {
            combo_run(CROUCHSHOT);
    }
 
 
//  HAIR TRIGGERS (always active)
    if (trigger)
        if (get_val(ADS))
            set_val(ADS, 100);
        if (get_val(FIRE))
            set_val(FIRE, 100);
 
 
//  RAPID MELEE (hold MELEE for RAPID MELEE)
    if(get_val(MELEE) && get_ptime(MELEE) > 300) {
        combo_run(PUNCH);
    }
 
 
//  RAPID TEABAG (hold CROUCH for RAPID TEABAG/CROUCH SHOT)
    if(get_val(CROUCH) && get_ptime(CROUCH) > 300) { // (Change "CROUCH" here to another BUTTON DEFINITION if needed/wanted)
        combo_run(TEABAG);
    }
 
 
//  WARDCLIFF COIL GLITCH (hold LEFT STICK & CROUCH for infinite Warcliff Coil ammo)
    if((get_val(SPRINT) && get_ptime(SPRINT) > 300 && get_val(CROUCH) && get_ptime(CROUCH) > 300)){
        combo_run(WARDCLIFF);
    }
 
 
 
 
 
 
 
// WEAPON ADS SENSITIVITY & ANTI-RECOIL MODS
//  ADS SENSITIVITY (double click RIGHT to toggle on/off ADS SENSITIVITY)
        if(event_press(RIGHT) && tap <= 0) {
            tap = 120;                                       // 300ms = 0.3 seconds - 120ms is my personal sweet spot for not accidetnally activating everything while sending messages
            }
            else if(event_press(RIGHT) && tap > 0) {
                ADS_onoff = !ADS_onoff;
                    //rumble_if_true(ADS_onoff);
        }
 
 
        if(ADS_onoff && get_val(ADS) >1) {
                    timer = timer + get_rtime();
                    if( timer >= ADS_delay ){
                            sensitivity(R_X, NOT_USE, 100 - ADS_sensitivity);       
                            sensitivity(R_Y, NOT_USE, 100 - ADS_sensitivity);       
                        }
                }else{
                        timer = 0;
    }
 
 
/*  BOTH WEAPONS ANTI-RECOIL TOGGLE (press SWITCH WEAPON & DOWN to activate anti-recoil for both primary & secondary weapons)
                                                (while active press DOWN to change which weapon has which anti-recoil settings (pink = primary / yellow = secondary) - helpful if you die and spawn with wrong weapon or wrong weapon gets anti-recoil upon activation)*/

    if(get_val(SWITCH)) {
        if(event_press(DOWN)){
            anti_recoil ( TRUE , TRUE );
                //rumble_if_true(primary_anti_recoil);
                //rumble_if_true(secondary_anti_recoil);
    }
 
 
 
/*  PRIMARY WEAPON ANTI-RECOIL TOGGLE (press SWITCH WEAPON & LEFT to activate anti-recoil for only primary weapon)
                                                (while active press DOWN to change which weapon has anti-recoil - helpful if you die and spawn with wrong weapon or wrong weapon gets anti-recoil upon activation)*/

        if(event_press(LEFT)){
            primary_anti_recoil = !primary_anti_recoil;
                //rumble_if_true(primary_anti_recoil);
    }
 
/*  SECONDARY WEAPON ANTI-RECOIL TOGGLE (press SWITCH WEAPON & RIGHT to activate anti-recoil for only secondary weapon)
                                                (while active press DOWN to change which weapon has anti-recoil - helpful if you die and spawn with wrong weapon or wrong weapon gets anti-recoil upon activation)*/

        if(event_press(RIGHT)){
            secondary_anti_recoil = !secondary_anti_recoil;
                //rumble_if_true(secondary_anti_recoil);
    }
}
 
 
// WEAPON SCRIPTS - RAPIDFIRE & WEAPON SPECIFIC MODS
/*  EASY SWAP/ONE WEAPON RAPIDFIRE TOGGLE (press SWITCH WEAPON & UP to activate rapid fire for only currently equipped weapon)
                                          (while active press UP to change which weapon has rapid fire - helpful if you die and spawn with wrong weapon or wrong weapon gets rapid fire upon activation)*/

    if(get_val(SWITCH)) {
        if (event_press(UP)){
            weapon_options ( 0 , 0 , 0 , TRUE );
 
            //rumble_if_true(master_ez);
    }
}
 
 
//  ADS RAPIDFIRE TOGGLE (press FIRE & UP to activate rapid fire for ALL weapons)
    if(get_val(FIRE)) {
        if(event_press(UP)) {
            weapon_options ( 0 , TRUE , 0 , 0 );
 
            //rumble_if_true(ADSrapid_onoff);
    }
} 
 
//  RAPIDFIRE TOGGLE (press ADS & UP to activate rapid fire for ALL weapons)
    if(get_val(ADS)) {
        if(event_press(UP)) {
            weapon_options ( 0 , 0 , TRUE , 0 );
 
            //rumble_if_true(rapid_onoff);
    }
 
 
//  RAPIDFIRE RESET (press ADS & DOWN to deactivate all shooting scripts)
           if(event_press(DOWN)) {
            weapon_options( TRUE , 0 , 0 , 0 );
 
            //rumble_if_true(rapid_onoff);
 
    }
}
 
 
/*    RAPIDFIRE (ADS)
    if(ADSrapid_onoff) {
        if(ADSrapidtoggle_onoff) {   
            if(get_val(ADS) && get_val(FIRE)) {
                combo_run(RAPIDFIRE);
            }else if(combo_running(RAPIDFIRE)){
                combo_stop(RAPIDFIRE);
            }
            if(get_val(SWITCH) && get_ptime(SWITCH) > 250) {
                ADSrapidtoggle_onoff = FALSE
                }
            if(super_interference) {
                if(event_press(SUPER)) {
                    ADSrapidtoggle_onoff = FALSE
                    }
                if(get_val(GRENADE) && get_val(MELEE)) {
                    ADSrapidtoggle_onoff = FALSE
                    }
                }
            }
        if(!ADSrapidtoggle_onoff) {
            if(get_val(SWITCH) && get_ptime(SWITCH) < 250) {
                ADSrapidtoggle_onoff = TRUE
                }
            if(get_val(UP)) {
                ADSrapidtoggle_onoff = TRUE
                }
            }
        }
*/

 
//    RAPIDFIRE (FULL)
    if(rapid_onoff) {
        if(rapidtoggle_onoff) {   
            if(get_val(FIRE)) {
                combo_run(RAPIDFIRE);
            }else if(combo_running(RAPIDFIRE)){
                combo_stop(RAPIDFIRE);
            }
            if(get_val(SWITCH) && get_ptime(SWITCH) > 250) {
                rapidtoggle_onoff = FALSE
                }
            if(super_interference) {
                if(event_press(SUPER)) {
                    rapidtoggle_onoff = FALSE
                    }
                if(get_val(GRENADE) && get_val(MELEE)) {
                    rapidtoggle_onoff = FALSE
                    }
                }
            }
        if(!rapidtoggle_onoff) {
            if(get_val(SWITCH) && get_ptime(SWITCH) < 250) {
                rapidtoggle_onoff = TRUE
                }
            if(get_val(UP)) {
                rapidtoggle_onoff = TRUE
                }
            }
        }
 
 
//  RAPIDFIRE (EASY SWAP/ONE WEAPON)
    if(event_press(SWITCH)) {
        ezrapid_onoff = !ezrapid_onoff;
        }
        if(master_ez){                                         
            if(ezrapid_onoff){
                if(get_val(FIRE)>0 ) {     
                    combo_run(RAPIDFIRE);
              }else if(combo_running(RAPIDFIRE)) {             
                   combo_stop(RAPIDFIRE);                       
            }                                               
        }
    }
    if(event_press(UP)) {
        ezrapid_onoff = !ezrapid_onoff;
    }
    if(get_val(SWITCH) && get_ptime(SWITCH) > 250) {
        ezrapid_onoff = FALSE
    } 
 
 
//  RAPIDFIRE (SUPER INTERFERENCE) (press START & UP if Subclass Super is interfering with Rapidfire)
    if(get_val(START)) {
        if(event_press(UP)) {
            super_options ( TRUE );
                //rumble_if_true(super_interference);
        }
 
 
//  RAPIDFIRE (SUPER INTERFERENCE RESET) (press START & DOWN if Subclass Super doesn't interfere with Rapidfire)
           if(event_press(DOWN)) {
            super_options( 0 );
                //rumble_if_true(super_interference);
 
        }
    }
 
/*  ADJUSTABLE ANTI-RECOIL (hold CROUCH and adjust recoil with DPAD UP, DOWN, LEFT, or RIGHT)
                           (save by pressing START for Primary or SELECT for Secondary while still holding CROUCH)*/

    if(get_val(CROUCH)) {
        if(event_press(recoil_up))   
            { ANTI_RECOIL_H = ANTI_RECOIL_H - 1;
                //rumble_if_true(ANTI_RECOIL_H);     // Single vibrate on value change // Double vibrate when value is on 0 (no anti-recoil on axis)
    }
        if(event_press(recoil_down))
            { ANTI_RECOIL_H = ANTI_RECOIL_H + 1;
                //rumble_if_true(ANTI_RECOIL_H);
    }
            if(anti_recoil_H > 100)  anti_recoil_H = 100;
            if(anti_recoil_H < -100) anti_recoil_H = -100;
            set_val(recoil_up,0);   
            set_val(recoil_down,0);
 
        if(event_press(recoil_left)) 
            { ANTI_RECOIL_V = ANTI_RECOIL_V - 1;
                //rumble_if_true(ANTI_RECOIL_V);
    } 
        if(event_press(recoil_right))
            { ANTI_RECOIL_V = ANTI_RECOIL_V + 1;
                //rumble_if_true(ANTI_RECOIL_V);     // Single vibrate on value change // Double vibrate when value is on 0 (no anti-recoil on axis)
    }
            if(anti_recoil_V > 100)  anti_recoil_V = 100;
            if(anti_recoil_V < -100) anti_recoil_V = -100;
            set_val(recoil_left,0)
            set_val(recoil_right,0);
 
            set_val (TRACE_5, ANTI_RECOIL_V);      //                                                         
            set_val (TRACE_6, ANTI_RECOIL_H);      //   
 
        if(event_press(SELECT)){                   //  Change BUTTON DEFINITION here if you want a different button to save the anti-recoil settings for your Primary Weapon
            set_pvar(SPVAR_1, ANTI_RECOIL_V);      //                                                SELECT = SHARE on PS4               
            set_val (TRACE_1, ANTI_RECOIL_V);      //                                                SELECT = VIEW on XBOX           
            set_pvar(SPVAR_2, ANTI_RECOIL_H);     
            set_val (TRACE_2, ANTI_RECOIL_H);                                                               
                //rumble_if_true(SPVAR_1);
 
 
    }                                             
        if(event_press(START)){                    // Change BUTTON DEFINITION here if you want a different button to save the anti-recoil settings for your Secondary Weapon
            set_pvar(SPVAR_3, ANTI_RECOIL_V);      //                                                START = OPTIONS on PS4               
            set_val (TRACE_3, ANTI_RECOIL_V);      //                                                 START = MENU on XBOX           
            set_pvar(SPVAR_4, ANTI_RECOIL_H);     
            set_val (TRACE_4, ANTI_RECOIL_H);     
                //rumble_if_true(SPVAR_3);
 
    }                                             
}                                               
 
     if(primary_anti_recoil)
         if(pri_recoil_onoff)
            if(!ADSRec_only || get_val(ADS) && get_val(FIRE)) {
                AntiRecoil(ANTI_RECOIL_V, ANTI_RECOIL_H)
    }
    if(secondary_anti_recoil)
        if(sec_recoil_onoff)
            if(!ADSRec_only || get_val(ADS) && get_val(FIRE)) {
                AntiRecoil(ANTI_RECOIL_V_S, ANTI_RECOIL_H_S)
        }
    if(event_press(SWITCH)) {
        pri_recoil_onoff = !pri_recoil_onoff;
        sec_recoil_onoff = !sec_recoil_onoff;
    }
    if(event_press(DOWN)) {
        pri_recoil_onoff = !pri_recoil_onoff;
        sec_recoil_onoff = !sec_recoil_onoff;
    }   
 
 
//  ANTI-RECOIL (PRE-SET WEAPONS)
// PRE-SET PRIMARY WEAPON ANTI-RECOIL
    if((get_val(6)) && (get_val(7))) {/*    L1/L2 or LB/LT by default    */
        block_buttons = 100;
            set_val(6,0);
            set_val(7,0);
            set_pvar(SPVAR_1, ANTI_RECOIL_V);
            set_val (TRACE_1, ANTI_RECOIL_V);
            set_pvar(SPVAR_2, ANTI_RECOIL_H);
            set_val (TRACE_2, ANTI_RECOIL_H);
 
//      Pre-Set Primary Weapon Recoil #1 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(17)) { // Y/Triangle
            ANTI_RECOIL_H = +30; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V =  0// Horizontal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Primary Weapon Recoil #2 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(20)) { // X/Square
            ANTI_RECOIL_H = +35; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V = +35; // Horizontal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Primary Weapon Recoil #3 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(18)) { // B/Circle
            ANTI_RECOIL_H = +45; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V = +45; // Horizontal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Primary Weapon Recoil #4 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
//        if(event_press(19)) { // A/Cross
//            ANTI_RECOIL_H = +55; // Vertical Recoil   // Positive = Down  // Negative = Up
//            ANTI_RECOIL_V = +55; // Horizontal Recoil // Positive = Right // Negative = Left
//            }
        }
 
 
// PRE-SET SECONDARY WEAPON ANTI-RECOIL
    if((get_val(3)) && (get_val(4))) {/*    R1/R2 or RB/RT by default    */
        block_buttons = 100;
            set_val(3,0);
            set_val(4,0);
            set_pvar(SPVAR_3, ANTI_RECOIL_V_S);
            set_val (TRACE_3, ANTI_RECOIL_V_S);
            set_pvar(SPVAR_4, ANTI_RECOIL_H_S);
            set_val (TRACE_4, ANTI_RECOIL_H_S);
 
//      Pre-Set Secondary Weapon Recoil #1 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(17)) { // Y/Triangle
            ANTI_RECOIL_H_S = +30; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V_S =  0// Horizontal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Secondary Weapon Recoil #2 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(20)) { // X/Square
            ANTI_RECOIL_H_S = +35; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V_S = +35; // Horiztonal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Secondary Weapon Recoil #3 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
        if(event_press(18)) { // B/Circle
            ANTI_RECOIL_H_S = +45; // Vertical Recoil   // Positive = Down  // Negative = Up
            ANTI_RECOIL_V_S = +45; // Horiztonal Recoil // Positive = Right // Negative = Left
            }
 
//      Pre-Set Secondary Weapon Recoil #4 - (FEEL FREE TO ADD WEAPON NAME HERE TO REMEMBER)
//        if(event_press(19)) { // A/Cross
//            ANTI_RECOIL_H_S = +55; // Vertical Recoil   // Positive = Down  // Negative = Up
//            ANTI_RECOIL_V_S = +55; // Horizontal Recoil // Positive = Right // Negative = Left
//            }           
        }
 
 
 
} // main block end
 
 
 
 
 
// COMBO SECTION
//  One Button Super
combo ONEBUTTONSUPER {
    set_val(GRENADE, 100);
    set_val(MELEE, 100);
}
 
 
//    Auto-Strafe/Sidestep
combo STRAFE {
    wait(100);
    set_val(L_X, 85);
    wait(sidestep_time);
    wait(100);
    set_val(L_X, -85);
    wait(sidestep_time);
}
 
 
//    Auto-Melee
combo PUNCH {
    set_val(MELEE, 100);
    wait(40);
    set_val(MELEE, 0);
    wait(40);
    set_val(MELEE, 0);
}
 
 
//    Auto-Revive
combo REVIVE {
    set_val(RELOAD, 100);
    wait(revive_time);
    set_val(RELOAD, 0);
}
 
 
//  Crouch Shot
combo CROUCHSHOT {
    set_val(CROUCH, 100);
    wait(50);
    set_val(CROUCH, 0);
    wait(crouchshot_time);
}
 
 
//    Notification (Rumble Once = Actived - Rumble Twice = Deactivated)
//combo NOTIFY {
//    set_rumble(rumble_type,100);
//    wait(rumble_time);
//    reset_rumble();
//    wait(100);
//    if(rumble_type) set_rumble(rumble_type,100);
//    wait(rumble_time);
//    reset_rumble();
//}
 
 
//    Rapidfire
combo RAPIDFIRE {
    set_val(FIRE, 100);
    wait(hold_time);
    set_val(FIRE, 0);
    wait(rest_time);
    set_val(FIRE, 0);
    wait(rest_time);
}
 
 
//    Rapid Crouch/Teabag
combo TEABAG {
    set_val(CROUCH, 100);
    wait(25);
    set_val(CROUCH, 0);
    wait(25);
    set_val(CROUCH, 0);
}
 
 
//  Wardcliff Glitch
combo WARDCLIFF {
    set_val(CROUCH, 100);
    set_val(FIRE, 100);
    wait(35);
    set_val(CROUCH, 0);
    set_val(FIRE, 0);
    wait(35);
}
 
 
 
 
 
// FUNCTION
//    Button Layouts
function button_layout( default , bumper , puppet , puppetswap ) {
 
    default               = default;
    bumper             = bumper;
    puppet             = puppet;
    puppetswap         = puppetswap;
 
}
 
//  Anti-Recoil
function anti_recoil( pri , sec ) {
 
    primary_anti_recoil   = pri;
    secondary_anti_recoil = sec;
 
}
 
//  Super Interference
function super_options( super ) {
 
    super_interference = super;
 
}
 
//    Weapon Options
function weapon_options( reset , ADSRF , RF , EZ ) {
 
    reset             = reset;
    ADSrapid_onoff   = ADSRF;
    rapid_onoff      = RF;
    master_ez        = EZ;
 
}
 
 
//    Rumble Notification
//function rumble_if_true(var){
//    if(var) {
//        rumble_type = RUMBLE_A;
//        rumble_time= 200;
//    }
//    else{
//        rumble_type = RUMBLE_B;
//        rumble_time = 200;
//    }
//    combo_run(NOTIFY);
//}
 
 
//  Button Functions
//function FIRE(){set_val(FIRE, 100);}
//function NOFIRE(){set_val(FIRE, 0);}
//function JUMP(){set_val(JUMP, 100);}
//function NOJUMP(){set_val(JUMP, 0);}
//function RELOAD(){set_val(RELOAD, 100);}
//function NORELOAD(){set_val(RELOAD, 0);}
//function CROUCH(){set_val(CROUCH, 100);}
//function NOCROUCH(){set_val(CROUCH, 0);}
//function MELEE(){set_val(MELEE, 100);}
//function NOMELEE(){set_val(MELEE, 0);}
//function NLY(){set_val(L_Y, -100);}
 
 
//  Smarter Anti-Recoil
function AntiRecoil (AntiRecoil_H, AntiRecoil_V)
{
    //  Anti-recoil parameters
    if (get_val(FIRE) && isqrt(pow(get_val(R_X), 2) + pow(get_val(R_Y), 2)) <= abs(AntiRecoil_V))
    {
        if (abs(R_Y) <= abs(AntiRecoil_V))
        {
            // Horizontal anti-recoil
            anti_recoil_H = (get_val(R_X) + (AntiRecoil_H*(100-abs(get_val(R_X))))/100);
            set_val(R_X, anti_recoil_H);
 
            // Vertical anti-recoil
            if (inverted)
                 { anti_recoil_V = (get_val(R_Y) - (AntiRecoil_V*(100-abs(get_val(R_Y))))/100); } // Y-axis invert
            else { anti_recoil_V = (get_val(R_Y) + (AntiRecoil_V*(100-abs(get_val(R_Y))))/100); }
            if (anti_recoil_V >  (AntiRecoil_V)) {anti_recoil_V = (AntiRecoil_V) ;}
            set_val(R_Y, anti_recoil_V);
        }
    }
}
 
 
//  Smarter Anti-Recoil Secondary
//function AntiRecoilS (AntiRecoil_H_S, AntiRecoil_V_S)
//{
//    //  Anti-recoil parameters
//    if (get_val(FIRE) && isqrt(pow(get_val(R_X), 2) + pow(get_val(R_Y), 2)) <= abs(AntiRecoil_V_S))
//    {
//        if (abs(R_Y) <= abs(AntiRecoil_V_S))
//        {
//            // Horizontal anti-recoil
//            anti_recoil_H_S = (get_val(R_X) + (AntiRecoil_H_S*(100-abs(get_val(R_X))))/100);
//            set_val(R_X, anti_recoil_H_S);
//
//            // Vertical anti-recoil
//            if (inverted)
//                 { anti_recoil_V_S = (get_val(R_Y) - (AntiRecoil_V_S*(100-abs(get_val(R_Y))))/100); } // Y-axis invert
//            else { anti_recoil_V_S = (get_val(R_Y) + (AntiRecoil_V_S*(100-abs(get_val(R_Y))))/100); }
//            if (anti_recoil_V_S >  (AntiRecoil_V_S)) {anti_recoil_V_S = (AntiRecoil_V_S) ;}
//            set_val(R_Y, anti_recoil_V_S);
//        }
//    }
//}
 
 
//  Colour LED Function for PS4
function colourled(Colour) {
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: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Need help with this script

Postby lucian84 » Fri Nov 17, 2017 10:41 am

you removed the unmap part

what have you done in the data part?

and for the rumble you just deactivate rumble whenever you found in the code? But then how will i no when i have activated mods if in that cod you removed all rumble?
User avatar
lucian84
Command Sergeant Major
Command Sergeant Major
 
Posts: 140
Joined: Wed Nov 08, 2017 1:04 pm

Re: Need help with this script

Postby J2Kbr » Fri Nov 17, 2017 10:53 am

the unmap still there (before init block).

The data segment must be defined before the variable declaration, that is why I moved it up.

The rumble was commented because the bytecode size was over the allowed 4092 bytes, it does work, you can uncomment and try reduce the bytecode size by removing some other non-used feature.
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: Need help with this script

Postby lucian84 » Fri Nov 17, 2017 11:28 am

ok so you mean that the error for rumble i got it was because it was over 4092 bytes not because its something wrong with the code?
you mean i will have rumble even if you uncomment them?

i will be home soon and test thanks
User avatar
lucian84
Command Sergeant Major
Command Sergeant Major
 
Posts: 140
Joined: Wed Nov 08, 2017 1:04 pm

Re: Need help with this script

Postby lucian84 » Fri Nov 17, 2017 6:42 pm

J2Kbr wrote:the unmap still there (before init block).

The data segment must be defined before the variable declaration, that is why I moved it up.

The rumble was commented because the bytecode size was over the allowed 4092 bytes, it does work, you can uncomment and try reduce the bytecode size by removing some other non-used feature.


Could you help me enable rumble so i know when its working please.

All off this i dont need:

button layots can be removed keep only Default

auto revive can be removed

anti-recoil (pre-sets) can be removed

slide shoot shoulder charge can be removed

and the turn off all rapidfire shooting script can be removed aswell.
User avatar
lucian84
Command Sergeant Major
Command Sergeant Major
 
Posts: 140
Joined: Wed Nov 08, 2017 1:04 pm

Re: Need help with this script

Postby Sillyasskid » Fri Nov 17, 2017 8:46 pm

lucian84 wrote:ok so you mean that the error for rumble i got it was because it was over 4092 bytes not because its something wrong with the code?
you mean i will have rumble even if you uncomment them?

Well no, Your code had a quite a few non terminated variables,
As well, I noticed there was a wait() time of 6,000 that you had declared, that would have also given you an error. The max a wait time can be, is 4,000. To achieve a 6,000 wait time. You would be required to make an additional wait().
Like so:
wait(4000);
wait(2000);


lucian84 wrote:you mean i will have rumble even if you uncomment them?

No, because the Code wont compile.

Your code was to large to fit in a Titan 1 memory slot, The byte code exceeded 4092 bytes. The Rumble was only commented out for the code to compile.

You have to either remove some parts of your code that you deem non-essential
or try and see if you can make your code a bit more efficient.

The goal is to reduce the size your script, So it can compile when you remove the comments from he rumble functions,
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: Need help with this script

Postby lucian84 » Fri Nov 17, 2017 10:10 pm

The script J2Kbr change works fine :)

And the rumble i fixed it i get the rumbel no problem

I did what J2Kbr sad remove mods that i dont need to use

J2Kbr dont mind my last post i fix it :)

Im starting to learn

still long way to go :)

thanks for the help
User avatar
lucian84
Command Sergeant Major
Command Sergeant Major
 
Posts: 140
Joined: Wed Nov 08, 2017 1:04 pm

Re: Need help with this script

Postby lucian84 » Sat Nov 18, 2017 1:07 am

Some updates and new questions:p

Anti-recoil in this script works very good the best i found until now.

Problem is with rapid fire. I have rapid on primary and normal on secundary but it acts strange sometimes my gun jams sometimes it shoots 1 bullet stop the 1 bullet more sometimes dont ahoot at all.

Anyone has a working scriot were you can choose were to have rapid fire primary or secundary or both if you want?

Will also need an drop shot and strafe shoot because those from the script dosent work :(
User avatar
lucian84
Command Sergeant Major
Command Sergeant Major
 
Posts: 140
Joined: Wed Nov 08, 2017 1:04 pm

Re: Need help with this script

Postby Sillyasskid » Sat Nov 18, 2017 2:31 am

The Rapid Fire hold time is set really low, 25ms.
The console wont always register an input held at that time. Bumping it up to 35-60 should be enough time for the console to register the controller input.

It also depends on the game you are playing, as many developers hardcore countermeasures against exploits like rapid fire. Such as simply having the game simply ignore the controllers input in conditions where rapid fire is clearly being used.

look for this part in your code
Code: Select all
 
int hold_time             = 25;                           
int rest_time             = 15;


adjust the hold_time to something a bit higher. You should also adjust the rest_time as well, just a tad tad bit higher.

The rest time is the amount of time the trigger is not being held. If its set too low the console will have the same issue, not being able to detect the controller input.
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Next

Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 112 guests