BO3 Script Help

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

Re: BO3 Script Help

Postby Scachi » Sun Sep 25, 2016 9:21 pm

Ah, okay...
If I understand this correctly you are changing the ingame layout and also the controllers layout .. rendering the ingame change non existent.

Maybe you shouldn't use the remapper function then and instead just change your ADS from BUTTON_8 to Button 7 as an example ?

Instead of #define use uint8
Code: Select all

// Flipped / Non Flipped Area
uint8 ADS = BUTTON_8 ;
uint8 TACTICAL =  BUTTON_7;
uint8 SHOOT = BUTTON_5;
uint8 GRENADE = BUTTON_4 ;

// Tactical / Non Tactical Area
uint8 CROUCH  = BUTTON_15;
uint8 MELEE = BUTTON_6;

and for your init function:
Code: Select all

 if(FLIPPED_ON == 1) {
      ColorLED('G');
      ADS = BUTTON_7;
      TACTICAL = BUTTON_8;
      SHOOT = BUTTON_4;
      GRENADE  = BUTTON_5;
   }   

   if(TACTICAL_ON == 1) {
      CROUCH  = BUTTON_6;
      MELEE = BUTTON_15;
   }
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: BO3 Script Help

Postby UK_Wildcats » Sun Sep 25, 2016 9:28 pm

That seems to be working. Thank you so much.

Now that I have everything working, I will do some testing to make sure everything works while using it for hours.

@J2Kbr - Here is the working version that I have. I would appreciate a code review to see if there are any optimizations or enhancements.

Code: Select all
#pragma METAINFO("Black Ops 3 (BO3)", 1, 03, "UK_Wildcats_Fans")

/*
=============================================================================               
COPYRIGHT:
2016 Terry (UK_Wildcats_Fans) from http:
//www.consoletuner.com. This script was developed and intended for http://www.consoletuner.com, Titan 2 ONLY, UNLESS written premission is given by the creator and/or copywritee.

All rights reserved. This material may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. For permission, contact UK_Wildcats_Fans via the http://www.consoletuner.com/forum website   
=============================================================================

<shortdesc> 
This script was developed exclusively for the Titan 2 and Black Ops 3 game 
</shortdesc>

<keywords>
Titan Two, Titan 2, Black Ops 3, BO3, Jitter, Auto Sprint, Easy Sprint, Rapid Fire, Long jump, Anti-Recoil, Recoil Compensation, Quick Scope, Hold Breath, ADS Fire, Akimbo, Drop Shot
</keywords>

<cfgdesc>

<cfgdesc>
[COPYRIGHT]
shortdesc    = This script was developed for the Titan 2 and Black Ops 3 game.<br>=============================================================================<br><font color="red"><b>COPYRIGHT:</b></font><br>2016 Terry (UK_Wildcats_Fans) from http://www.consoletuner.com. This script was developed and intended for http://www.consoletuner.com, Titan 2 ONLY, UNLESS written premission is given by the creator and/or copywritee.<br><br>All rights reserved. This material may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. For permission, contact UK_Wildcats_Fans via the http://www.consoletuner.com/forum website.<br>=============================================================================<br>
control        = info

[TOGGLES]
shortdesc    = These toggles can be used while in the game and script running<br><br><b>ADS</b> = Aim Down Sight button, which is often called the scope button<br><br><b>TOGGLES:</b> You MUST press the <font color="blue"><b>ADS</b></font> or <font color="blue"><b>CROUCH</b></font> button first <font color="red"><b>BEFORE any other button</b></font><br>=============================================================================<br>Press <font color="blue"><b>ADS</b></font> (aim down sights) button in addition with any of the below.<br><br>Press <b>LEFT</b> on the D PAD to enable/disable <b>"RAPID FIRE"</b><br>Press <b>RIGHT</b> on the D PAD to cycle through the 5 <b>"RAPID FIRE PRESETS"</b> (RAPID FIRE MUST BE ENABLED FIRST)<br>Press <b>UP</b>    on the D PAD to TOGGLE between <b>"DISABLED", "JITTER" and "Pump Jitter"</b><br>Press <b>DOWN</b>  on the D PAD to enable/disable <b>"DROP SHOT"</b><br>=============================================================================<br>Press <font color="blue"><b>CROUCH</b></font> in addition with any of the below.<br><br>Press <b>LEFT</b>  on the D PAD to enable/disable <b>"HOLD BREATH"</b><br>Press <b>RIGHT</b> on the D PAD to enable/disable <b>"ADS FIRE"</b><br>Press <b>UP</b>    on the D PAD to enable/disable <b>"QUICK SCOPE"</b><br>Press <b>DOWN</b>  on the D PAD to enable/disable <b>"ANTI-RECOIL"</b><br>=============================================================================
control        = info

[CONFIGURATION]
shortdesc    = The below changes can only be set with the interactive configuration.
control        = info

[ADS/SCOPE AND SHOOT BUTTONS]
shortdesc    = Select the buttons that you are using for ADS/SCOPE and SHOOT buttons
byteoffset    = 0
bitsize        = 8
control        = radiobox
default        = 0
item        = L2 / R2  or  LT / RT
item        = L1 / R1  or  LB / RB

[TACTICAL AND MELEE BUTTONS]
shortdesc    = Select the buttons that you are using for MELEE and Crouch/Prone
byteoffset    = 1
bitsize        = 8
control        = radiobox
default        = 0
item        = DEFAULT: R3 / RS for MELEE and Circle / B for Crouch/Prone
item        = TACTICAL: R3 / RS for Crouch/Prone and Circle / B for MELEE

[AUTO SPRINT]
shortdesc    = Enable or disable the AUTO SPRINT mod
byteoffset    = 2
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Enable Auto Sprint

[LONG JUMP]
shortdesc    = Enable or disable the LONG JUMP mod
byteoffset    = 3
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Enable Long Jump

[DROP SHOT IS DISABLED WITH SCOPE/ADS]
shortdesc    = Checking this box will disable drop shot when aiming down sights
byteoffset    = 4
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Disable Drop Shot when Aiming Down Sights (ADS)

[VIBRATION NOTIFICATION]
shortdesc    = Enable or disable a vibration notifier when start mods are enabled/disabled
byteoffset    = 5
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Enable Vibration Notifier

[RAPID FIRE AUXILLARY TOGGLE]
shortdesc    = Enable or disable the ability to enable/disable rapid fire with ADS + SPRINT
byteoffset    = 6
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 0
item        = Enable Auxillary Rapid Fire Toggle

[ANTI-RECOIL ONLY WITH ADS ]
shortdesc    = Enable Anti-Recoil only with ADS
byteoffset    = 7
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Enable Anti-Recoil only with ADS

[LOOK INVERSION ]
shortdesc    = Check this box IF you have Look Inversion enabled within BO3
byteoffset    = 8
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 0
item        = Look Inversion is Enabled

[LED INTENSITY]
shortdesc    = Set the LED instensity from 0.0 to 100.0 in 0.5 steps
byteoffset    = 20
bitsize        = 32
control        = spinboxf
default        = 50000000
minimum        = 00000000
maximum        = 100000000
step        = 500000

[VERTICAL RECOIL COMPENSATION]
shortdesc    = Set the vertical recoil compensation (o to 50) in steps of 1 (lower value = less compensation)
byteoffset    = 30
bitsize        = 32
control        = spinboxf
default        = 25000000
minimum        = 0000000
maximum        = 50000000
step        = 1000000

[HORIZONTAL RECOIL COMPENSATION]
shortdesc    = Set the horizontal recoil compensation (-25 to 25) in steps of 1 (negative for left; positive for right)
byteoffset    = 40
bitsize        = 32
control        = spinboxf
default        = 0000000
minimum        = -25000000
maximum        = 25000000
step        = 1000000


</cfgdesc>
*/

//DEFINES


// Not normally affected by controller settings within the game
#define SPRINT          BUTTON_9
#define LX              STICK_2_X
#define LY              STICK_2_Y
#define RX              STICK_1_X
#define RY              STICK_1_Y
#define JUMP            BUTTON_16
#define RELOAD          BUTTON_17
#define SWAP_WEAPONS    BUTTON_14
#define UP              BUTTON_10
#define DOWN            BUTTON_11
#define LEFT            BUTTON_12
#define RIGHT           BUTTON_13

#define    NOT_USE            0
#define TRUE            !FALSE

// VARIABLES =============================================================================

// Flipped / Non Flipped Area
uint8 ADS = BUTTON_8 ;
uint8 TACTICAL =  BUTTON_7;
uint8 SHOOT = BUTTON_5;
uint8 GRENADE = BUTTON_4 ;

// Tactical / Non Tactical Area
uint8 CROUCH  = BUTTON_15;
uint8 MELEE = BUTTON_6;

int INSTA_FIRE                    = 195// The % at which it boosts the SHOOT button when pressed - i.e. 95% means when pressed 5%
int INSTA_AIM                     = 195// The % at which it boosts the ADS button when pressed - i.e. 95% means when pressed 5%
int INSTA_OTHER                   = 195;   // The % at which it boosts the other button when pressed - i.e. 95% means when pressed 5%
int DROPSHOT_QUICKNESS            = 195;   // The % at which it boosts the CROUCH button when pressed - i.e. 95% means when pressed 5%     

bool DISABLE_WITH_SCOPE;                 // Set as part of interactive configuration
fix32 ANTI_RECOIL_VERTICAL;                 // Set as part of interactive configuration
fix32 ANTI_RECOIL_HORIZONTAL;             // Set as part of interactive configuration
bool ONLY_WITH_SCOPE;                     // Set as part of interactive configuration
bool VIBRATION_ON;                           // Set as part of interactive configuration
bool LongJumpON;                         // Set as part of interactive configuratio
bool AutoSprintON;                         // Set as part of interactive configuration
bool DropShotON;                         // Set as part of interactive configuration
bool InversionON;                           // Set as part of interactive configuration
bool ExtraRapid;                         // Set as part of interactive configuration   
bool FLIPPED_ON;                         // Set as part of interactive configuration
bool TACTICAL_ON;                         // Set as part of interactive configuration

int QUICK_SCOPE_WAIT              = 500;   // Increase this time for a longer ADS time.  Decrease this time for a shorter ADS time
int RELOAD_WAIT                   = 2000// Wait time after stopping auto sprint to allow reloading.  Adjust as necessary
int SHOOT_WAIT                    = 300;   // Wait time after stopping auto sprint to allow shooting
int DROP_SHOT_WAIT                = 1000// Wait time for drop shot combo (changed from 1200 to 1000)
bool AkimboSingleON               = FALSE; // Akimbo mode for regular single shot mode
bool AkimboRapidON              = FALSE; // Akimbo mode with rapid fire mode
bool RapidFireON                = FALSE
int JitterMode                  = 0;     // 0 = disabled, 1 = normal jitter, 2 = pump jitter
bool AntiRecoilON               = FALSE;
bool QuickScopeON               = FALSE;
int RapidFireCounter            = 1;
fix32 anti_recoil_vertical, anti_recoil_horizontal;
bool ADS_Fire_On                = FALSE;
bool HoldBreathON               = FALSE;
int Counter;
fix32 value, mid, rest;
bool signed;
fix32 LED_Intensity

// Hold Time is the time in mSeconds that the SHOOT button is pressed. It varies depending on the weapon, game and attachments.
// Release time is the time between shooting.  This will vary depending on the game timing that is coded into the game.
int HoldTime                      = 5// #defined in mSeconds for regular Rapid Fire
int RestTime                      = 5// #defined in mSeconds for regular Rapid Fire

init {
    pmem_load(); // Load permanent memory before use any pmem operation
    // Store the values from the permanent memory (the configuration values) into variables.
    FLIPPED_ON = (pmem_read(0));
    TACTICAL_ON = (pmem_read(1));
    AutoSprintON = (pmem_read(2) >> 7) & 0b1;
    LongJumpON = (pmem_read(3) >> 7) & 0b1;
    DISABLE_WITH_SCOPE  = (pmem_read(4) >> 7) & 0b1;
    VIBRATION_ON  = (pmem_read(5) >> 7) & 0b1;
    ExtraRapid    = (pmem_read(6) >> 7) & 0b1;
    ONLY_WITH_SCOPE = (pmem_read(7) >> 7) & 0b1;
    InversionON = (pmem_read(8) >> 7) & 0b1;
    pmem_read(20, &LED_Intensity);
    pmem_read(30, &ANTI_RECOIL_VERTICAL);
    pmem_read(40, &ANTI_RECOIL_HORIZONTAL);
    ColorLED('B');

    if(FLIPPED_ON == 1) {
      ADS = BUTTON_7;
      TACTICAL = BUTTON_8;
      SHOOT = BUTTON_4;
      GRENADE  = BUTTON_5;
   }   

   if(TACTICAL_ON == 1) {
      CROUCH  = BUTTON_6;
      MELEE = BUTTON_15;
   }

}


// MAIN SCRIPT ============================================================================= 

main {   
   
    // Makes the button 100% pressed even if barely pressed - aka more sensitive and quicker reaction
//   if(get_val(CROUCH)){sensitivity(CROUCH, NOT_USE, DROPSHOT_QUICKNESS);}   
//    if(get_val(ADS)){sensitivity(ADS, 10, INSTA_AIM);}     
//    if(get_val(SHOOT)){sensitivity(SHOOT, 10, INSTA_FIRE);}
//    if(get_val(SPRINT)){sensitivity(SPRINT, 10, INSTA_OTHER);}
//    if(get_val(GRENADE)){sensitivity(GRENADE, 10, INSTA_OTHER);} 

   
// TOGGLES =============================================================================

    if(event_active(LEFT) && get_val(ADS)) {  // Turn ON and OFF Rapid Fire
        RapidFireON = !RapidFireON;
        if(RapidFireON) {
             JitterMode = 0;
             ColorLED('G'); // green           
             if(VIBRATION_ON) combo_run(RumbleNotifier);
             AkimboSingleON = FALSE// Turn OFF Akimbo modes
             AkimboRapidON = FALSE;   // Turn OFF Akimbo modes
             QuickScopeON = FALSE;    // Turn OFF QuickScope
        }
        if(!RapidFireON) {ColorLED('B'); /*combo_run(SingleNotifier);*/}
    }

    if(event_active(SPRINT) && get_val(ADS)&& ExtraRapid) {  // Turn ON and OFF Rapid Fire
        RapidFireON = !RapidFireON;
        if(RapidFireON) {
             JitterMode = 0;
             ColorLED('G'); // green
             if(VIBRATION_ON) combo_run(RumbleNotifier);
             AkimboSingleON = FALSE// Turn OFF Akimbo modes
             AkimboRapidON = FALSE;   // Turn OFF Akimbo modes
             QuickScopeON = FALSE;    // Turn OFF QuickScope
        }
        if(!RapidFireON) {ColorLED('B'); /*combo_run(SingleNotifier)*/;}
    }
   
    // Using this to cycle through rapid fire settings for testing.  It can be used for having multiple rapid fire settings
    // You can set these values to whatever you want and adjust how many different values that you want.
    if(event_active(RIGHT) && get_val(ADS) && RapidFireON) {
       RapidFireCounter = RapidFireCounter + 1;
       Counter = 1;
       if(Counter <= RapidFireCounter) {
            if(VIBRATION_ON) combo_run(SingleNotifier);
            Counter = Counter + 1;
       }     
       if(RapidFireCounter > 5) {RapidFireCounter = 1;} // Change the "5" to how many options that you want
       if(RapidFireCounter == 1){HoldTime = 5; RestTime = 5;} // Preset #1
       if(RapidFireCounter == 2){HoldTime = 10; RestTime = 10;} // Preset #2
       if(RapidFireCounter == 3){HoldTime = 20; RestTime = 20;} // Preset #3
       if(RapidFireCounter == 4){HoldTime = 30; RestTime = 30;} // Preset #4
       if(RapidFireCounter == 5){HoldTime = 40; RestTime = 40;} // Preset #5   
    }
   
    if(event_active(DOWN) && get_val(ADS)) {  // Turns ON and OFF Drop Shot
        DropShotON = !DropShotON;
        if(DropShotON) {
            ADS_Fire_On = FALSE;
            ColorLED('Y'); // amber/yellow
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(!DropShotON) {ColorLED('B');}   
      }


    if(event_active(UP) && get_val(ADS)) {  // Toggle between jitters 0=disabled, 1=normal jitter, 2=pump jitter
        JitterMode = JitterMode + 1;
        if(JitterMode > 2){JitterMode = 0;}
        if(JitterMode==0) {ColorLED('B');}   
        if(JitterMode == 1) {
            RapidFireON = FALSE;
            ColorLED('G'); // green
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(JitterMode == 2) {
            RapidFireON = FALSE;
            ColorLED('Y'); // amber/yellow
            if(VIBRATION_ON) combo_run(SingleNotifier);
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }

      }


    if(event_active(UP) && get_val(CROUCH)) {  // Turns ON and OFF Quick Scope
        QuickScopeON = !QuickScopeON;
        if(QuickScopeON) {
           AkimboSingleON = FALSE;            // Turn OFF Akimbo modes
           AkimboRapidON = FALSE;             // Turn OFF Akimbo modes   
           RapidFireON = FALSE;               // Turn OFF Rapid Fire
           AntiRecoilON = FALSE;              // Turn OFF Anti Recoil
        }
    }

    if(event_active(DOWN) && get_val(CROUCH)) { // Turns ON and OFF Anti-Recoil
        AntiRecoilON = !AntiRecoilON;
        if(AntiRecoilON) {
            ColorLED('P'); // pink
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(!AntiRecoilON) {ColorLED('B');}   
    }

    if(event_active(RIGHT) && get_val(CROUCH)) { // Turns ON and OFF ADS Fire
        ADS_Fire_On = !ADS_Fire_On;
        if(ADS_Fire_On) {
            DropShotON = FALSE;
            ColorLED('W'); // white
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(!ADS_Fire_On) {ColorLED('B');}   
    }
    if(event_active(LEFT) && get_val(CROUCH)) { // Turns ON and OFF auto hold breath
        HoldBreathON = !HoldBreathON;
        if(HoldBreathON) {
            ColorLED('C'); // Cyan
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(!HoldBreathON) {ColorLED('B');}   
    }

// END TOGGLES =============================================================================


  // Auto ADS
  if(get_val(SHOOT) && ADS_Fire_On && !DropShotON) {set_val(ADS,100);}

  // Drop Shot
  if(event_active(SHOOT) && DropShotON){
        combo_stop(AutoSprint); 
        combo_run(DropShot);
  }
  if(DISABLE_WITH_SCOPE && get_val(ADS)) {combo_stop(DropShot);}

  // Normal Jitter
  if(get_val(SHOOT) && JitterMode==1) {combo_run(Jitter);}

  // Pump Jitter
  if(get_val(SHOOT) && JitterMode==2) {combo_run(PumpJitter);}

` // Rapid Fire without ADS Fire
  if(get_val(SHOOT) && RapidFireON && !ADS_Fire_On) {combo_run(RapidFire);}
   else if(RapidFire) {combo_stop(RapidFire);}

  // Rapid Fire with ADS Fire
  if(get_val(SHOOT) && RapidFireON && ADS_Fire_On) {combo_run(ADSRapidFire);}
    else if(ADSRapidFire) {combo_stop(ADSRapidFire);}

  // Anti-recoil
  if(!ONLY_WITH_SCOPE || get_val(ADS)) {combo_run(AntiRecoil);}

  // Quick Scope -- CANNOT ADS (aka regular scope) while using Quick Scope -- for regular ADS you must toggle off QuickScopeON  -- see "Toggles" section at the top of this script
  if(QuickScopeON && event_active(ADS) ) {combo_run(QuickScope);}

  // Hold Breath
  if(HoldBreathON && get_val(ADS)) {combo_run(HoldBreath);}

  // AutoSprint -- Try different values (i.e. -90, -95); toggle ON/OFF
  if(get_val(LY) < -99.00 && AutoSprintON && !AllowReloading) { combo_run(AutoSprint); }
  else if((get_val(LY) > -99.00 && AutoSprintON)) {combo_stop(AutoSprint); } // Reload will also stop
  if(get_val(SHOOT)) {combo_stop(AutoSprint); combo_run(AllowShooting);}    // Stop auto sprint to allow shooting
 
  // Long Jump
  if(get_val(JUMP) && LongJumpON) {combo_run(LongJump);}
    else if(LongJump) {combo_stop(LongJump);}
 
 
} // End of MAIN

// FUNCTIONS =============================================================================

/* COLOR LED LIGHTBAR FOR PS4
  2,0,0,0,
//1 B Blue
  0,2,0,0, //2 R Red
  0,0,2,0, //3 G Green
  0,0,0,2, //4 P Pink
  2,0,2,0, //5 C Cyan
  0,2,2,0, //6 Y Yellow
  2,2,2,2  //7 W White
*/
void ColorLED(char Color) {
    // LED_Intensity is set as part of the interactive configuration
    fix32 Color1, Color2, Color3, Color4;
    int Blink;
    Blink = 0; //mS
    if(Color == 'B'){Color1 = LED_Intensity;     Color2 = 0.0;                 Color3 = 0.0;                 Color4 = 0.0;}
    if(Color == 'R'){Color1 = 0.0;                 Color2 = LED_Intensity;     Color3 = 0.0;                 Color4 = 0.0;}
    if(Color == 'G'){Color1 = 0.0;                 Color2 = 0.0;                 Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'P'){Color1 = 0.0;                 Color2 = 0.0;                 Color3 = 0.0;                 Color4 = LED_Intensity;}
    if(Color == 'C'){Color1 = LED_Intensity;     Color2 = 0.0;                 Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'Y'){Color1 = 0.0;                 Color2 = LED_Intensity;     Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'W'){Color1 = LED_Intensity;     Color2 = LED_Intensity;     Color3 = LED_Intensity;     Color4 = LED_Intensity;}
    led_set(LED_1,Color1,Blink);
    led_set(LED_2,Color2,Blink);
    led_set(LED_3,Color3,Blink);
    led_set(LED_4,Color4,Blink);
    return;
}

// Sensitivity function from T1 to make buttons more reactive
void sensitivity(uint8 input, uint8 midpoint, uint8 sens)
{
    uint32 value = (uint32) get_val(input);
    bool signed = (value < 0);
    if (signed) {value = abs(value);}
    if (midpoint != NOT_USE)
    {
        if (value > midpoint) {value = (50 / (100 - midpoint)) * (value - midpoint) + 50;        }
        else {value = (50 / midpoint) * value;        }
    }
    if (sens){value = (sens / 100) * value;}
    if (value > 100) {value = 100;}
    if (signed) {value = -value;}
    set_val(input, value);
    return;
}

// Returns the last button pressed (i.e. "BUTTON_10")
uint8 getLastButtonPressed() {
    uint8 i, last = BUTTON_1;
   
    for(i=BUTTON_2; i<=BUTTON_21; ++i) {
        if(time_release(i) < time_release(last)) {
            last = i;
        }
    }
    return(last);
}

// COMBOS =============================================================================

combo AllowShooting {
    set_val(SPRINT, 0);
    wait(SHOOT_WAIT); // can adjust to ensure enough time for shooting
}

combo AllowReloading {
    set_val(SPRINT, 0);
    wait(RELOAD_WAIT); // can adjust to ensure enough time to reload
}

combo RapidFire {
    set_val(SHOOT, 100);
    wait(HoldTime);
    set_val(SHOOT, 0);
    wait(RestTime);
    set_val(SHOOT, 0);
}

// normal jitter for burst and semi-automatics
combo Jitter {
    set_val(SHOOT, 100);
    wait(20);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 100);
    wait(82);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 100);
    set_val(GRENADE, 100);
    wait(20);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 0);
    set_val(GRENADE, 0);
}

// Pump Jitter for Argus & KRM
combo PumpJitter {
    set_val(SHOOT, 100);
    wait(100);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 100);
    wait(82);
    set_val(SHOOT, 100);
    set_val(GRENADE, 100);
    set_val(TACTICAL, 100);
    wait(40);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 0);
    set_val(GRENADE, 0);
    set_val(RELOAD, 100);
    wait(20);
    set_val(SHOOT, 100);
    set_val(RELOAD, 0);
}

combo ADSRapidFire {
    set_val(SHOOT, 100);
    set_val(ADS, 100);
    wait(HoldTime);
    set_val(SHOOT, 0);
    wait(RestTime);
    set_val(SHOOT, 0);
    set_val(ADS, 0);
}

combo DropShot {
   set_val(SPRINT,0);
   wait(15);
   set_val(CROUCH, 100);
   wait(50);              // 15 is no slide in public but slide in private.  50 is slide in public but no slide in private
   set_val(CROUCH, 100);
   wait(DROP_SHOT_WAIT); 
}


combo LongJump {     
   set_val(JUMP,100);//1 
   wait(100);                 
   set_val(JUMP,  0);     
   wait(80);                 
   set_val(JUMP,100);//2 
   wait(100);                 
   set_val(JUMP,  0);     
   wait(80);                 
   set_val(JUMP,100);//3 
   wait(100);                 
   set_val(JUMP,  0);     
   wait(100);                 
   set_val(JUMP,100);//4 
   wait(50);                 
   set_val(JUMP,  0);     
   wait(80);                 
   set_val(JUMP,100);//5 
   wait(100);                 
   set_val(JUMP,  0);     
   wait( 80);                 
}   

combo QuickScope {
    set_val(ADS, 100);
    wait(QUICK_SCOPE_WAIT);  //Increase this time for a longer ADS time.  Decrease this time for a shorter ADS time.
    set_val(ADS, 0);
    wait(10);
    set_val(SHOOT, 100);
    wait(20);
    set_val(SHOOT, 0);
    wait(60);
    set_val(SHOOT, 0);
}

combo HoldBreath {
    set_val(SPRINT, 100);
    wait(10);
    set_val(SPRINT, 100);
}

combo AutoSprint {
    set_val(SPRINT, 100);
    wait(10);
    set_val(SPRINT, 100);
}

combo AntiRecoil {                                           
// Look Inversion Enabled
    if(get_val(SHOOT) && AntiRecoilON && InversionON) { // Using AntiRecoilON toggle for testing and when using multiple weapons
      anti_recoil_vertical = get_val(RY) - ANTI_RECOIL_VERTICAL;            // SUBTRACT anti_recoil when LOOK INVERSION is ENABLED
      if(anti_recoil_vertical > 100.00) {anti_recoil_vertical = 100.00;}
      set_val(RY, anti_recoil_vertical);
      anti_recoil_horizontal = get_val(RX) + ANTI_RECOIL_HORIZONTAL;
      if(anti_recoil_horizontal < -100.00) {anti_recoil_horizontal = -100.00;}
      if(anti_recoil_horizontal > 100.00) {anti_recoil_horizontal = 100.00;}
      set_val(RX, anti_recoil_horizontal);
    }
// Normal Look Inversion - look inversion disabled
    if(get_val(SHOOT) && AntiRecoilON && !InversionON) { // Using AntiRecoilON toggle for testing and when using multiple weapons
      anti_recoil_vertical = get_val(RY) + ANTI_RECOIL_VERTICAL;            // SUBTRACT anti_recoil when LOOK INVERSION is ENABLED
      if(anti_recoil_vertical > 100.00) {anti_recoil_vertical = 100.00;}
      set_val(RY, anti_recoil_vertical);
      anti_recoil_horizontal = get_val(RX) + ANTI_RECOIL_HORIZONTAL;
      if(anti_recoil_horizontal < -100.00) {anti_recoil_horizontal = -100.00;}
      if(anti_recoil_horizontal > 100.00) {anti_recoil_horizontal = 100.00;}
      set_val(RX, anti_recoil_horizontal);
    }
}
 

combo RumbleNotifier {
    // double rumble
//    ffb_set(FFB_1, 100f, 200);
    call (SingleNotifier);
    wait(200);
    call (SingleNotifier);
//    ffb_set(FFB_1, 100f, 200 );
    wait(200); 
}

combo SingleNotifier {
    ffb_set(FFB_1, 100.00, 100); 
    wait(100);
}

User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby Scachi » Mon Sep 26, 2016 8:37 am

Very cool work, I'll give it a try this evening ;-)

You have <cfgdesc> twice in there (just above your [COPYRIGHT] info control).

Not sure about this one:
The checkbox control.. I think you don't really need the bitoffset 7 there, it was just an example from j2kbr that you may store multiple bits in on byte at different positions.
You may use a bitoffset = 0 there and save / read them with a simple whateverON = (pmem_read(byteoffsetvalue) & 0b1);
..not sure if there is a need for the "& 0b1 " at all.

@J2Kbr: Can you make a complete example how to read and WRITE different bits from/to one byteoffset value please, if this is possible at all ? I couldn't figure it out myself. I never really understood this left/right shift stuff.

like: config:
Code: Select all

[First]
shortdesc   = Enable or disable first
byteoffset   = 0
bitsize      = 1
bitoffset   = 0
control      = checkbox
default      = 1
item      = First item

[Second]
shortdesc   = Enable or disable second
byteoffset   = 0
bitsize      = 1
bitoffset   = 1
control      = checkbox
default      = 1
item      = Second item


read:
Code: Select all

pmem_load();
FIRST = (pmem_read(0)) & 0b1;
SECOND = ((pmem_read(0) >> 1) & 0b1;


write ?
Code: Select all

no idea
pmem_write(0 ?????, FIRST);
pmem_write(0 ?????, SECOND);
pmem_save();
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: BO3 Script Help

Postby J2Kbr » Mon Sep 26, 2016 3:57 pm

Related to the Lightbar color (Titan Two and PS4 controller. Please try this script:

Code: Select all
#pragma METAINFO("ColorLED Test", 1, 0, "J2K")

#define BUTTON_UP        BUTTON_10
#define BUTTON_DOWN        BUTTON_11

const uint8 ColorCounter = 1;

init{
    ColorSwitch();
}

main {
    if(event_active(BUTTON_UP)) {
        if(++ColorCounter > 7) ColorCounter = 1;
        ColorSwitch();
    } else if(event_active(BUTTON_DOWN)) {
        if(--ColorCounter < 1) ColorCounter = 7;
        ColorSwitch();
    }
}

void ColorSwitch() {
    switch(ColorCounter) {
        case 1: ColorLED('B'); break;
        case 2: ColorLED('G'); break;
        case 3: ColorLED('R'); break;
        case 4: ColorLED('C'); break;
        case 5: ColorLED('P'); break;
        case 6: ColorLED('Y'); break;
        case 7: ColorLED('W'); break;
    }
}

void ColorLED(char Color) {
    led_set(LED_1, 0.0, 0);
    led_set(LED_2, 0.0, 0);
    led_set(LED_3, 0.0, 0);
    led_set(LED_4, 0.0, 0);
    if(Color == 'B' || Color == 'P' || Color == 'C' || Color == 'W') {
        led_set(LED_1, 100.0, 0);
    }
    if(Color == 'R' || Color == 'P' || Color == 'Y' || Color == 'W') {
        led_set(LED_2, 100.0, 0);
    }
    if(Color == 'G' || Color == 'C' || Color == 'Y' || Color == 'W') {
        led_set(LED_3, 100.0, 0);
    }
    return;
}


also, make your Lightbar configuration to "Script/Gamepack"
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: BO3 Script Help

Postby Prototype » Mon Sep 26, 2016 5:46 pm

My lightbar configuration is set to "Player indicator or Script/Gamepack", now the red is really pink, the green isn't green and the yellow isn't yellow.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic! :smile0517:
User avatar
Prototype
Major General
Major General
 
Posts: 3251
Joined: Sun Dec 16, 2012 1:43 pm

Re: BO3 Script Help

Postby J2Kbr » Mon Sep 26, 2016 5:56 pm

prototype wrote:My lightbar configuration is set to "Player indicator or Script/Gamepack", now the red is really pink, the green isn't green and the yellow isn't yellow.

on Titan Two or on PS4 controller? or both?
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: BO3 Script Help

Postby Prototype » Mon Sep 26, 2016 6:16 pm

Only on PS4 controller, Titan Two colors are good.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic! :smile0517:
User avatar
Prototype
Major General
Major General
 
Posts: 3251
Joined: Sun Dec 16, 2012 1:43 pm

Re: BO3 Script Help

Postby J2Kbr » Mon Sep 26, 2016 6:35 pm

prototype wrote:Only on PS4 controller, Titan Two colors are good.

okay, that is "good". and this is on PS4 console?, other? or without any console connection?
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: BO3 Script Help

Postby Prototype » Mon Sep 26, 2016 7:01 pm

J2Kbr wrote:
prototype wrote:Only on PS4 controller, Titan Two colors are good.

okay, that is "good". and this is on PS4 console?, other? or without any console connection?

Ok, this is on PS4 so i have try on Xbox 360 and the green and yellow are good. But red is pink light on Xbox 360 and dark pink on PS4.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic! :smile0517:
User avatar
Prototype
Major General
Major General
 
Posts: 3251
Joined: Sun Dec 16, 2012 1:43 pm

Re: BO3 Script Help

Postby J2Kbr » Mon Sep 26, 2016 8:16 pm

got it ... I my test I had the Titan Two not connected on any console. Could be a conflict between the console and the script on setting the controller leds, I will be checking that.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

PreviousNext

Return to GPC2 Script Programming

Who is online

Users browsing this forum: AZOV_ops and 125 guests