Combining Two Scripts for Destiny 2. Please Help!

Gtuner IV general support. Operation, questions, updates, feature request.

Combining Two Scripts for Destiny 2. Please Help!

Postby TaricNida » Fri Dec 03, 2021 8:35 pm

Hello friends,

I'm a long time lurker but I ran into a situation where I can't figure it out. I've been trying to add a Destiny Aim Assist script into Scachi's destiny pack and I keep getting errors. I have uploaded both scripts. I'm trying to utilize Scachi's anti recoil with the aim assist if possible. Ideally, I would like to be able to insert the aim assist script within Scachi's pack so I'll still be able to adjust the anti recoil on the fly. Please help! If its not possible, I completely understand. Thank you for your time!
Attachments
Destiny 2 Scachi.gpc
(43.89 KiB) Downloaded 109 times
Destiny 2 Aim Assist 35 Speed Original.gpc
(2.66 KiB) Downloaded 112 times
User avatar
TaricNida
Corporal
Corporal
 
Posts: 5
Joined: Thu Dec 02, 2021 11:26 pm

Re: Combining Two Scripts for Destiny 2. Please Help!

Postby Mad » Fri Dec 03, 2021 9:44 pm

Copy and paste the entire second script at the very bottom of the first script.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: Combining Two Scripts for Destiny 2. Please Help!

Postby TaricNida » Fri Dec 03, 2021 10:00 pm

Here it is
Code: Select all
// ADJUST AIM ASSIST WHERE IT DOESN'T SHAKE SCREEN BUT STILL WORKS /////////////
#define CIRCLE_RADIUS_R       32.0
#define CIRCLE_RADIUS_L       32.0
#define CIRCLE_STEP_R         0.10
#define CIRCLE_STEP_L         0.10
#define CIRCLE_SPEED_R        1
#define CIRCLE_SPEED_L        1
////////////////////////////////////////////////////////////////////////////////
bool assist_on = 1;
bool aim_on = 1;
bool ON_OFF_R;
bool ON_OFF_L;
////////////////////////////////////////////////////////////////////////////////
fix32 angle_R;
fix32 angle_L;
////////////////////////////////////////////////////////////////////////////////
 
main {
    // AIM ASSIST
    if(assist_on == 1) {
    if(aim_on == 0) {
    if(ON_OFF_R == 1) {
         set_val(STICK_1_X, CIRCLE_RADIUS_R * cos(angle_R));
         set_val(STICK_1_Y, CIRCLE_RADIUS_R * sin(angle_R));
            combo_run(AutoCircle_R);
    }
 
      if(get_actual(STICK_1_Y) < -35.0 || get_actual(STICK_1_Y) > 35.0 ||
       get_actual(STICK_1_X) < -35.0 || get_actual(STICK_1_X) > 35.0) {
        combo_stop(AutoCircle_R);
        ON_OFF_R = 0;
    }else {
        ON_OFF_R = 1;
    }
    if(ON_OFF_L == 1) {
         set_val(STICK_2_X, CIRCLE_RADIUS_L * cos(angle_L));
         set_val(STICK_2_Y, CIRCLE_RADIUS_L * sin(angle_L));
            combo_run(AutoCircle_L);
    }
 
      if(get_actual(STICK_2_Y) < -35.0 || get_actual(STICK_2_Y) > 35.0 ||
       get_actual(STICK_2_X) < -35.0 || get_actual(STICK_2_X) > 35.0) {
        combo_stop(AutoCircle_L);
        ON_OFF_L = 0;
    }else {
        ON_OFF_L = 1;
    }
    }
    if(aim_on == 1) {
    if(get_actual(BUTTON_8)) {
    if(ON_OFF_R == 1) {
         set_val(STICK_1_X, CIRCLE_RADIUS_R * cos(angle_R));
         set_val(STICK_1_Y, CIRCLE_RADIUS_R * sin(angle_R));
            combo_run(AutoCircle_R);
    }
 
      if(get_actual(STICK_1_Y) < -35.0 || get_actual(STICK_1_Y) > 35.0 ||
       get_actual(STICK_1_X) < -35.0 || get_actual(STICK_1_X) > 35.0) {
        combo_stop(AutoCircle_R);
        ON_OFF_R = 0;
    }else {
        ON_OFF_R = 1;
    }
    if(ON_OFF_L == 1) {
         set_val(STICK_2_X, CIRCLE_RADIUS_L * cos(angle_L));
         set_val(STICK_2_Y, CIRCLE_RADIUS_L * sin(angle_L));
            combo_run(AutoCircle_L);
    }
 
      if(get_actual(STICK_2_Y) < -35.0 || get_actual(STICK_2_Y) > 35.0 ||
       get_actual(STICK_2_X) < -35.0 || get_actual(STICK_2_X) > 35.0) {
        combo_stop(AutoCircle_L);
        ON_OFF_L = 0;
    }else {
        ON_OFF_L = 1;
    }
    }
    }
    }
}
 
combo AutoCircle_R
{
    wait(CIRCLE_SPEED_R);
    angle_R = mod(angle_R + CIRCLE_STEP_R, 2.0 * PI);
}
 
combo AutoCircle_L
{
    wait(CIRCLE_SPEED_L);
    angle_L = mod(angle_L - CIRCLE_STEP_L, 2.0 * PI);
}
User avatar
TaricNida
Corporal
Corporal
 
Posts: 5
Joined: Thu Dec 02, 2021 11:26 pm

Re: Combining Two Scripts for Destiny 2. Please Help!

Postby Mad » Fri Dec 03, 2021 10:06 pm

Paste it at the very bottom of destiny2_scachi.gpc
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: Combining Two Scripts for Destiny 2. Please Help!

Postby TaricNida » Fri Dec 03, 2021 10:39 pm

Code: Select all
[code=gpc2]#pragma METAINFO("Destiny 2 - Scachi", 1, 34, "Scachi")
 
#include <display.gph>
#include "destiny2_scachi_or.gph" // Online Resource information
#include "destiny2_scachi_ic.gph" // Interactive Configuration
#include "ICPM_Update.gph"
#include "ColorLED.gph"
 
#define XKEYS_MONITOR_MAX 9
#define XKEYS_NOTIME
#include "xkeys.gph" // extra keyboard keys event monitoring
 
 
#define PRIMARY     0
#define SECONDARY   1
#define POWER         2
 
#define HIP    0
#define ADS 3
 
#define RFM_DISABLED  0
#define RFM_ENABLED     1
#define RFM_PRESSURE    2
 
#define RFAR_DISABLED  0
#define RFAR_ONHOLD      1
#define RFAR_ONRELEASE 2
uint8 cBlink[]={CR,CG,CA,CP}; // led color blink for ar/rf mode/state
 
#define EDIT_RECOIL    0
#define EDIT_RAPID    1
uint8 cedit[]={CW,CA}; // led color EDIT_RECOIL,EDIT_RAPID
uint8 dedit[]={_a_,_r_}; // display overlay EDIT_RECOIL,EDIT_RAPID
 
 
// extra button combobox item ids
#define X_OFF                      0
#define X_FIXSLOT                1   // item = Fix Weapon Slot
#define X_DBLTAB_CIRCLE      2   // item = Double-Tap: CIRCLE
#define X_RAPID_TOGGLE      3   // item = Rapid Fire Toggle
#define X_AFK_TOGGLE          4   // item = AFK Mode Toggle - auto rotate and ads every few seconds
#define X_RUN_SLIDE            5   // item = Run->Slide combo
#define X_RUN_SLIDE_M        6   // item = Run->Slide->Melee combo
#define X_RUN_SLIDE_J        7   // item = Run->Slide->Jump combo
#define X_RUN_DBL_JUMP      8   // item = Double Jump combo
#define X_RUN_TPL_JUMP      9   // item = Triple Jump combo
#define X_HOLD_SQUARE        10  // item = Hold down Square button (revive / activate)
#define X_EASYRUN_TOGGLE  11  // item = Easy Run Toggle
#define X_EASYRUN_P_HOLD  12  // item = Easy Run Pause during key hold
#define X_EASYRUN_A_HOLD  13  // item = Easy Run Active during key hold
 
// for Segment display usage
uint8 Overlay[] = { _0_, _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_,};
 
bool     Menu      = TRUE;//TRUE  // menu mode : disables gun swapping/DPadb blocking and more
uint8 Menu_Enter;         // which button was used to enter menu mode
bool     Edit          ; //FALSE // edit mode disables gun swapping and firemode / anti recoil selection for weapon slot
bool    EditBlock ;      // block edit toggle until R3 or L3 was released again
uint8 EditItem  ;             // what item to edit : anti recoil , rapid fire
bool    AFK         ;         // when afk the player - auto rotate and ads every few seconds
bool  DisableAFK ;     // completely disable afk mode to avoid running it on accident
bool  DisableToggles; // completely disable all in-game toggles (execpt weapon slot fix)
bool  DisableFixSlotDblDLeft; // weapon slot fix
bool  EasyRevive;      // hold down SQUARE for 10 seconds on double-tap SQUARE
fix32 StickNoise;      // sticknoise deadzone
 
bool  AimAssist;
bool  AimAssistShootY;
bool  AimAssistShootX;
uint8 AA_VALUE;    // aim assist
uint8 AA_DELAY;    // aim assist
 
uint8 WeaponActive;      // 0 = Primary, 1 = Secondary, 2 = Power
uint8 WeaponActivate;     // 0 = Primary, 1 = Secondary, 2 = Power
 
// states
 
 
// extra buttons / special functions - use for checking for set combobox item - action
uint8 keys_to_monitor[XKEYS_MONITOR_MAX];
uint8 xtraKeyAction[XKEYS_MONITOR_MAX] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, };
uint8 xtraR3;
//uint8 xtraDP_LR = 0; // for xim users ? T2:kbm users with Input Translator ?
//uint8 xtraDP_UD = 0; // for xim users ? T2:kbm users with Input Translator ?
uint8 xtrakeytranslate[] = { /*^*/
  0                           ,
  KEY_A                       ,
  KEY_B                       ,
  KEY_C                       ,
  KEY_D                       ,
  KEY_E                       ,
  KEY_F                       ,
  KEY_G                       ,
  KEY_H                       ,
  KEY_I                       ,
  KEY_J                       ,
  KEY_K                       ,
  KEY_L                       ,
  KEY_M                       ,
  KEY_N                       ,
  KEY_O                       ,
  KEY_P                       ,
  KEY_Q                       ,
  KEY_R                       ,
  KEY_S                       ,
  KEY_T                       ,
  KEY_U                       ,
  KEY_V                       ,
  KEY_W                       ,
  KEY_X                       ,
  KEY_Y                       ,
  KEY_Z                       ,
  KEY_1                       ,
  KEY_2                       ,
  KEY_3                       ,
  KEY_4                       ,
  KEY_5                       ,
  KEY_6                       ,
  KEY_7                       ,
  KEY_8                       ,
  KEY_9                       ,
  KEY_0                       ,
  KEY_RETURNORENTER           ,
  KEY_ESCAPE                  ,
  KEY_DELETEORBACKSPACE       ,
  KEY_TAB                     ,
  KEY_SPACEBAR                ,
  KEY_HYPHEN                  ,
  KEY_EQUALSIGN               ,
  KEY_OPENBRACKET             ,
  KEY_CLOSEBRACKET            ,
  KEY_BACKSLASH               ,
  KEY_NONUSPOUND              ,
  KEY_SEMICOLON               ,
  KEY_QUOTE                   ,
  KEY_GRAVEACCENTANDTILDE     ,
  KEY_COMMA                   ,
  KEY_PERIOD                  ,
  KEY_SLASH                   ,
  KEY_CAPSLOCK                ,
  KEY_F1                      ,
  KEY_F2                      ,
  KEY_F3                      ,
  KEY_F4                      ,
  KEY_F5                      ,
  KEY_F6                      ,
  KEY_F7                      ,
  KEY_F8                      ,
  KEY_F9                      ,
  KEY_F10                     ,
  KEY_F11                     ,
  KEY_F12                     ,
  KEY_PRINTSCREEN             ,
  KEY_SCROLLLOCK              ,
  KEY_PAUSE                   ,
  KEY_INSERT                  ,
  KEY_HOME                    ,
  KEY_PAGEUP                  ,
  KEY_DELETEFORWARD           ,
  KEY_END                     ,
  KEY_PAGEDOWN                ,
  KEY_RIGHTARROW              ,
  KEY_LEFTARROW               ,
  KEY_DOWNARROW               ,
  KEY_UPARROW                 ,
  KEY_PADNUMLOCK              ,
  KEY_PADSLASH                ,
  KEY_PADASTERISK             ,
  KEY_PADHYPHEN               ,
  KEY_PADPLUS                 ,
  KEY_PADENTER                ,
  KEY_PAD1                    ,
  KEY_PAD2                    ,
  KEY_PAD3                    ,
  KEY_PAD4                    ,
  KEY_PAD5                    ,
  KEY_PAD6                    ,
  KEY_PAD7                    ,
  KEY_PAD8                    ,
  KEY_PAD9                    ,
  KEY_PAD0                    ,
  KEY_PADPERIOD               ,
  KEY_NONUSBACKSLASH          ,
  KEY_APPLICATION             ,
  KEY_POWER                   ,
  KEY_PADEQUALSIGN            ,
  KEY_F13                     ,
  KEY_F14                     ,
  KEY_F15                     ,
  KEY_F16                     ,
  KEY_F17                     ,
  KEY_F18                     ,
  KEY_F19                     ,
  KEY_F20                     ,
  KEY_F21                     ,
  KEY_F22                     ,
  KEY_F23                     ,
  KEY_F24                     ,
  KEY_EXECUTE                 ,
  KEY_HELP                    ,
  KEY_MENU                    ,
  KEY_SELECT                  ,
  KEY_STOP                    ,
  KEY_AGAIN                   ,
  KEY_UNDO                    ,
  KEY_CUT                     ,
  KEY_COPY                    ,
  KEY_PASTE                   ,
  KEY_FIND                    ,
  KEY_MUTE                    ,
  KEY_VOLUMEUP                ,
  KEY_VOLUMEDOWN              ,
  KEY_LOCKINGCAPSLOCK         ,
  KEY_LOCKINGNUMLOCK          ,
  KEY_LOCKINGSCROLLLOCK       ,
  KEY_PADCOMMA                ,
  KEY_PADEQUALSIGNAS400       ,
  KEY_INTERNATIONAL1          ,
  KEY_INTERNATIONAL2          ,
  KEY_INTERNATIONAL3          ,
  KEY_INTERNATIONAL4          ,
  KEY_INTERNATIONAL5          ,
  KEY_INTERNATIONAL6          ,
  KEY_INTERNATIONAL7          ,
  KEY_INTERNATIONAL8          ,
  KEY_INTERNATIONAL9          ,
  KEY_LANG1                   ,
  KEY_LANG2                   ,
  KEY_LANG3                   ,
  KEY_LANG4                   ,
  KEY_LANG5                   ,
  KEY_LANG6                   ,
  KEY_LANG7                   ,
  KEY_LANG8                   ,
  KEY_LANG9                   ,
  KEY_ALTERNATEERASE          ,
  KEY_SYSREQORATTENTION       ,
  KEY_CANCEL                  ,
  KEY_CLEAR                   ,
  KEY_PRIOR                   ,
  KEY_RETURN                  ,
  KEY_SEPARATOR               ,
  KEY_OUT                     ,
  KEY_OPER                    ,
  KEY_CLEARORAGAIN            ,
  KEY_CRSELORPROPS            ,
  KEY_EXSEL                   ,
  KEY_LEFTCONTROL             ,
  KEY_LEFTSHIFT               ,
  KEY_LEFTALT                 ,
  KEY_LEFTGUI                 ,
  KEY_RIGHTCONTROL            ,
  KEY_RIGHTSHIFT              ,
  KEY_RIGHTALT                ,
  KEY_RIGHTGUI
};
 
// ads sensitivity mode
uint8 SensitivityMode       = 0; // 0: L2+L3 , 1: L2
 
// sparrow mode (stop auto run, firemode, antirecoil)
bool SparrowFlag;
uint8 SparrowMode;
bool SparrowEnableOverride;
 
// dpad to weapon type/slot
uint8 DWBtn[3] = {255,255,255};
uint8 DWBtnIdx=255;
 
// easy run mode
uint8 EasyRunMode; // 0: disabled, ...
uint8 EasyRunSens; // value to reach by stick movement before starting run
bool EasyRunL3Toggle; // use double-tap L3 to toggle easyrun ?
bool EasyRunOn      ; // to enable/disable during gaming
bool EasyRunActive  ; // get set during easyrun sensitivity mode
bool EasyRunPause   ; // gets set to true during reload or xtra key action
bool EasyRunPausedByCrouch; // gets set on little to no l_y moevment while circle gets pressed
 
// values for all the settings per weapon slot
uint8    cfgAntiRecoil[]               = {1,1,0};                                   // anti recoil: off / on
int8  cfgAntiRecoilV[]              = {0,0,0, 0,0,0};                        // normal fire anti recoil vertical   (hip , ads)
int8     cfgAntiRecoilH[]              = {0,0,0, 0,0,0};                        // normal fire anti recoil horizontal (hip , ads)
uint8 cfgRapidFireMode[]           = {2,2,0};                                  // rapid fire mode: off / on / pressure
uint8 cfgRapidFirePressure[]     = {100,100,100};                        // needed pressure for rapid fire mode 2
uint16 cfgRapidFireSPM[]           = {150,150,150, 150,150,150};    // rapid fire shots per minute (hip , ads)
uint8 cfgRapidFireBPS[]           = {1,1,1, 1,1,1};                        // rapid fire bullets per pull (hip , ads)
uint8 cfgRapidFireHold[]           = {0,0,0, 0,0,0};                        // calculated hold time from SPM value above
uint8 cfgRapidFireRelease[]     = {0,0,0, 0,0,0};                        // calculated release time from SPM value above
uint8 cfgRapidAntiRecoilMode[]= {1,1,0};                                   // anti recoil mode for rapid fire mode: off / on hold / on release
int8  cfgRapidAntiRecoilV[]     = {0,0,0, 0,0,0};                        // rapid fire - anti recoil vertical   (hip , ads)
int8     cfgRapidAntiRecoilH[]     = {0,0,0, 0,0,0};                        // rapid fire - anti recoil horizontal (hip , ads)
int8 cfgSensitivity[]               = {100,100,100};                        // sensitivity aim modification on L3+L2
int16 cfgEasyRunReloadPause[]= {1800,1800,1800};           // pauses easyrun on reload
 
bool WriteBusy; // block write of r (easyrun) on another active display_overlay
 
void WeaponLoad(uint8 slot) {
    pmem_read(11 +20*slot,&cfgAntiRecoil[slot]);
    pmem_read(12 +20*slot,&cfgAntiRecoilV[slot+ADS]);
    pmem_read(13 +20*slot,&cfgAntiRecoilH[slot+ADS]);
    pmem_read(23 +20*slot,&cfgAntiRecoilV[slot+HIP]);
    pmem_read(24 +20*slot,&cfgAntiRecoilH[slot+HIP]);
 
    pmem_read(14 +20*slot,&cfgRapidFireMode[slot]);
    pmem_read(15 +20*slot,&cfgRapidFirePressure[slot]);
  //printf("loading from: %d & %d",16 +20*slot,22 +20*slot);
    pmem_read(16 +20*slot,&cfgRapidFireSPM[slot+ADS]); // 16 + 20*0 ) [3]16, [4]36, [5]56
    pmem_read(22 +20*slot,&cfgRapidFireBPS[slot+ADS]); // 22 + 20*0 ) [3]22, [4]42, [5]62
  //printf("cfgRapidFireSPM[slot+ADS] %d, cfgRapidFireBPS[slot+ADS] %d",cfgRapidFireSPM[slot+ADS],cfgRapidFireBPS[slot+ADS]);
    pmem_read(28 +20*slot,&cfgRapidFireSPM[slot+HIP]);
    pmem_read(30 +20*slot,&cfgRapidFireBPS[slot+HIP]);
  //printf("cfgRapidFireSPM[slot+HIP] %d, cfgRapidFireBPS[slot+HIP] %d",cfgRapidFireSPM[slot+HIP],cfgRapidFireBPS[slot+HIP]);
 
    pmem_read(18 +20*slot,&cfgRapidAntiRecoilMode[slot]);
    pmem_read(19 +20*slot,&cfgRapidAntiRecoilV[slot+ADS]);
    pmem_read(20 +20*slot,&cfgRapidAntiRecoilH[slot+ADS]);
    pmem_read(25 +20*slot,&cfgRapidAntiRecoilV[slot+HIP]);
    pmem_read(26 +20*slot,&cfgRapidAntiRecoilH[slot+HIP]);
    pmem_read(21 +20*slot,&cfgSensitivity[slot]);
  //printf("rapid antirecoil ads vertical: %d",cfgRapidAntiRecoilV[slot+ADS]);
 
  pmem_read(94 + 2*slot,&cfgEasyRunReloadPause[slot]); // reload times of weapon to pause running when reloading
 
  RapidFireHoldRelease((fix32)cfgRapidFireSPM[slot+ADS], cfgRapidFireBPS[slot+ADS], &cfgRapidFireHold[slot+ADS], &cfgRapidFireRelease[slot+ADS]);
  RapidFireHoldRelease((fix32)cfgRapidFireSPM[slot+HIP], cfgRapidFireBPS[slot+HIP], &cfgRapidFireHold[slot+HIP], &cfgRapidFireRelease[slot+HIP]);
  //printf("hold: %d, release: %d",cfgRapidFireHold[slot+ADS],cfgRapidFireRelease[slot+ADS]);
  //printf("horizontal rf ads:%d , hip:%d",cfgRapidAntiRecoilH[slot+ADS],cfgRapidAntiRecoilH[slot+HIP]);
}
 
void WeaponSave(uint8 slot) {
 
  pmem_write(11 +20*slot,cfgAntiRecoil[slot]);
  pmem_write(12 +20*slot,cfgAntiRecoilV[slot+ADS]);
  pmem_write(13 +20*slot,cfgAntiRecoilH[slot+ADS]);
  pmem_write(23 +20*slot,cfgAntiRecoilV[slot+HIP]);
  pmem_write(24 +20*slot,cfgAntiRecoilH[slot+HIP]);
 
  pmem_write(18 +20*slot,cfgRapidAntiRecoilMode[slot]);
  pmem_write(19 +20*slot,cfgRapidAntiRecoilV[slot+ADS]);
  pmem_write(20 +20*slot,cfgRapidAntiRecoilH[slot+ADS]);
  pmem_write(25 +20*slot,cfgRapidAntiRecoilV[slot+HIP]);
  pmem_write(26 +20*slot,cfgRapidAntiRecoilH[slot+HIP]);
 
  pmem_write(14 +20*slot,cfgRapidFireMode[slot]);
  pmem_write(15 +20*slot,cfgRapidFirePressure[slot]);
  pmem_write(16 +20*slot,cfgRapidFireSPM[slot+ADS]);
  pmem_write(22 +20*slot,cfgRapidFireBPS[slot+ADS]);
  pmem_write(28 +20*slot,cfgRapidFireSPM[slot+HIP]);
  pmem_write(30 +20*slot,cfgRapidFireBPS[slot+HIP]);
  //pmem_write(21 +20*slot,cfgSensitivity[slot]); // no way to change this in-game
}
 
init {
    pmem_load();
 
    pmem_read(105,&DWBtn[0]);        // the button for kinetic
    DWBtn[0]-=1;
    pmem_read(106,&DWBtn[1]);        // the button for energy
    DWBtn[1]-=1;
    pmem_read(107,&DWBtn[2]);        // the button for power
    DWBtn[2]-=1;
 
    EasyRevive = (pmem_read(0) >> 0) & 0b1;
 
  DisableAFK = pmem_read(71) & 0b1;
  DisableToggles = pmem_read(77) & 0b1;
  pmem_read(72,&StickNoise);
  pmem_read(76,&SensitivityMode); // when to use the different sensitivity
 
  // easy run settings
  pmem_read(78,&EasyRunMode);         // type of easyrun to use (0=disabled), 1=always on, 2=on get_val l_y > EasyRunSens
  pmem_read(79,&EasyRunL3Toggle);     // easyrun L3 double-tap toggle
  pmem_read(80,&EasyRunSens);         // stick value to reach before start running
 
  pmem_read(81,&SparrowMode);         // sparrow toggle mode 0= off, 1= square hold, 2= L2+option, 3= both modes
 
    DisableFixSlotDblDLeft = pmem_read(82) & 0b1; // disable WeaponSlotFix by double dpad-left
 
    pmem_read(100, &AimAssist);
    pmem_read(101, &AimAssistShootY);
    pmem_read(102, &AimAssistShootX);
    pmem_read(103, &AA_VALUE);
    pmem_read(104, &AA_DELAY);
 
  // extra button functions
    pmem_read( 1,&xtraR3);
  //pmem_read(119,&xtraDP_LR);
  //pmem_read(120,&xtraDP_UD);
 
  // extra keys to monitor and their functions
  uint8 ki;
  for(ki=0;ki<9;ki++) {
    pmem_read( 2+ki,&xtraKeyAction[ki]); // key functions
    pmem_read(110+ki,&keys_to_monitor[ki]);// key to monitor
    keys_to_monitor[ki]=xtrakeytranslate[keys_to_monitor[ki]]; // translate combobox item-id to real key value
    if (keys_to_monitor[ki]>0) {
      keys_to_monitor[ki]=xkeys_add(keys_to_monitor[ki]);
    }
  }
 
    // load weapon settings
    WeaponLoad(PRIMARY);
    WeaponLoad(SECONDARY);
    WeaponLoad(POWER);
    WeaponLED(); // set led color
 
  if (EasyRunMode>0) EasyRunOn=TRUE;
 
  ICPM_Update(500);
}
 
main {
 
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // *** MODE Logic : Menu / Edit / In-Game ***
        // -------------------------------------------------------------------------
        // Menu Mode enter/leave ( Map / Orbit / Character settings )
        if (     (event_release(BUTTON_3) && !get_actual(BUTTON_8) && !get_actual(BUTTON_9))      ||
                (event_release(BUTTON_1)       && time_active(BUTTON_1)    < 500) ||
                (event_release(BUTTON_2) && time_active(BUTTON_2) > 500) ||
                (event_release(BUTTON_18) && time_active(BUTTON_18) < 500)
 
            ) {
            Menu_Enter = getLastButtonPressed();
            combo_run(MenuWrite);
        } else if(Menu) { // back to gaming mode
            if ( Menu_Enter == 1  && event_active(BUTTON_15) ) combo_run(GameWrite);
            else if ( event_active(BUTTON_8) ) combo_run(GameWrite);
        }
        // -------------------------------------------------------------------------
        // Edit mode L3+R3 > 3000ms (for value modification of anti recoil and rapid fires)
        if (!Menu && !SparrowFlag) {
            if(check_active(BUTTON_6,3000) && check_active(BUTTON_9,3000) && !EditBlock) {
                EditBlock = TRUE;
                if ( Edit == FALSE) combo_run(EditWrite);
                else {
          Edit = FALSE;
          WeaponSave(0);WeaponSave(1);WeaponSave(2);
          ICPM_Update(TRUE);
          combo_run(GameWrite);
        }
            }
            if(event_release(BUTTON_6) || event_release(BUTTON_9)) EditBlock = FALSE;
        }
 
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // *** TOGGLES On/Off In-game ***
    if (!Menu && !Edit && !SparrowFlag) {
    if (!DisableToggles && get_actual(BUTTON_6)) {
      // -----------------------------------------------------------------------
      // Anti Recoil On/Off for active weaponslot "dpad down"
      if(event_active(BUTTON_11) && time_release(BUTTON_11) < 250) {
        Toggle(&cfgAntiRecoil[WeaponActive],2,11);
        combo_stop(AntiRecoilWrite);    combo_stop(AntiRecoilBlink);
        combo_run(AntiRecoilWrite);    combo_run(AntiRecoilBlink);
      }
      // -----------------------------------------------------------------------
      // Rapid Fire : disabled/enabled/pressure for active weaponslot "dpad-up"
      if (event_active(BUTTON_10) && time_release(BUTTON_10) < 250) {
        Toggle(&cfgRapidFireMode[WeaponActive],3,14);
        combo_stop(FireModeWrite); combo_stop(FireModeBlink);
        combo_run(FireModeWrite); combo_run(FireModeBlink);
      }
      // -----------------------------------------------------------------------
      // Rapid Fire Anti Recoil Mode : disabled/OnHold/OnRelease for active weaponslot "dpad-right"
      if (event_active(BUTTON_13) && time_release(BUTTON_13) < 250) {
        Toggle(&cfgRapidAntiRecoilMode[WeaponActive],3,18);
        combo_stop(RapidFireAntiRecoilModeWrite); combo_stop(RapidFireAntiRecoilModeBlink);
        combo_run(RapidFireAntiRecoilModeWrite); combo_run(RapidFireAntiRecoilModeBlink);
      }
      // -------------------------------------------------------------------------
    } // eo : !DisableToggles
        // Toggle : AFK Mode
      if ( !DisableAFK ) {
        //if ( get_actual(BUTTON_8) && get_actual(BUTTON_9) ) set_val(BUTTON_3,0);
        //if ( get_actual(BUTTON_8) && get_actual(BUTTON_9) && event_active(BUTTON_3) )
        if ( get_actual(BUTTON_8) && get_actual(BUTTON_9) )
        {
            set_val(BUTTON_3,0);
            if (event_active(BUTTON_3))
            {
              AFK = ! AFK;
              if ( AFK == TRUE ) ColorLED(CA,100);
              else {
                WeaponLED();
                combo_stop(cmbAFK);
                combo_stop(AFKWrite);
                WeaponLED();
              }
            }
        }
      } // eo : !DisableAFK
        // -------------------------------------------------------------------------
    // Toggle : weapon tracking fix: double-tab PS4_LEFT
    if ( !DisableFixSlotDblDLeft && (event_active(BUTTON_12) && time_release(BUTTON_12) < 200))
        {
            WeaponSlotCyle();
        }
    } // eo : !Menu && !Edit && !SparrowFlag
 
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // *** USAGE ... In-game ... the fun stuff ***
    if (!Menu) {
    // -------------------------------------------------------------------------
    // sticknoise | deadzone remover
    if(abs(get_actual(STICK_1_X)) < StickNoise) { set_val(STICK_1_X, 0.0); }
    if(abs(get_actual(STICK_1_Y)) < StickNoise) { set_val(STICK_1_Y, 0.0); }
    if(abs(get_actual(STICK_2_X)) < StickNoise) { set_val(STICK_2_X, 0.0); }
    if(abs(get_actual(STICK_2_Y)) < StickNoise) { set_val(STICK_2_Y, 0.0); }
    //
    //
    if (!SparrowFlag) {
        // -------------------------------------------------------------------------
        // Aim Assist
        if (AimAssist) {
            if (is_active(BUTTON_8) || is_active(BUTTON_5)) {
                    if (!AimAssistShootX || !is_active(BUTTON_5)) combo_run(cmbAimAssistX);
                    if (!AimAssistShootY || !is_active(BUTTON_5)) combo_run(cmbAimAssistY);
                }
            if (is_active(STICK_1_X)) combo_stop(cmbAimAssistX);
            if (is_active(STICK_1_Y)) combo_stop(cmbAimAssistY);
        }
      // -------------------------------------------------------------------------
      // Use : Direct Weapon buttons
        if (!Edit && !get_actual(BUTTON_6)) {
            if (DWBtn[0]<255 && event_active(DWBtn[0])) { // kinectic
                WeaponActivate=PRIMARY;
                DWBtnIdx=DWBtn[0];
            }
            if (DWBtn[1]<255 && event_active(DWBtn[1])) { // energie
                WeaponActivate=SECONDARY;
                DWBtnIdx=DWBtn[1];
            }
            if (DWBtn[2]<255 && event_active(DWBtn[2])) { // power
                WeaponActivate=POWER;
                DWBtnIdx=DWBtn[2];
            }
            if (DWBtnIdx<255) combo_run(cDWpnSwitch);
        }
      // -------------------------------------------------------------------------
      // Use : weapon swapping tracking via TRIANGLE button
        static uint8 wpncyclepresses=0;
        if (check_release(BUTTON_14,160)) wpncyclepresses=0;
        if(event_release(BUTTON_14) && time_active(BUTTON_14) < 250) { // short hold -> Pri<->Sec
                    wpncyclepresses++;
                    if (wpncyclepresses==3) WeaponActive=(WeaponActive+1)%2;
                    WeaponSlotCyle();
                    //printf("wpncyclepresses : %d, weaponactive: %d, weaponACTIVATE: %d",wpncyclepresses,WeaponActive,WeaponActivate);
        }
        //else if(event_release(BUTTON_14) && time_active(BUTTON_14) < 1000)
                else if(event_release(BUTTON_14) && time_active(BUTTON_14) < 2000)
        { // long hold -> Power
          if (WeaponActive != POWER)          WeaponActivate=POWER;
          else WeaponActivate=PRIMARY;    // when Power is active, another long hold switches back to primary
        }  // even longer hold -> Activating something in game, ignoring ;-)
        if (WeaponActive != WeaponActivate) combo_run(cmbWeaponActivate);
      // -------------------------------------------------------------------------
      // R3 special function
      if (event_release(BUTTON_6) && time_active(BUTTON_6) < 200 && !Edit) xSwitch(xtraR3);
      // -------------------------------------------------------------------------
      // Use : Sensitivity changes when aiming & holding L3
        if ( SensitivityMode == 0 ) {
          if (get_actual(BUTTON_8) && get_actual(BUTTON_9)) {
            set_val(BUTTON_9,0.0);
            sensitivity(STICK_1_Y, cfgSensitivity[WeaponActive]);
            sensitivity(STICK_1_X, cfgSensitivity[WeaponActive]);
 
          }
        } else if ( SensitivityMode == 1 ) {
          if (get_actual(BUTTON_8)) {
            sensitivity(STICK_1_Y, cfgSensitivity[WeaponActive]);
            sensitivity(STICK_1_X, cfgSensitivity[WeaponActive]);
          }
        }
      // -------------------------------------------------------------------------
      // Use : Firing with Fire Mode and Anti Recoil
        if ( get_actual(BUTTON_5) ) { // fire weapon !
          combo_stop(cmbDoubleJump);combo_stop(cmbTripleJump);
 
          // check firemode to use
          switch(cfgRapidFireMode[WeaponActive]) {
            case RFM_DISABLED: // NORMAL fire mode , no rapid fire active
              // normal firemode : if enabled -> normal anti recoil
              if (cfgAntiRecoil[WeaponActive] > 0) {
                if ( get_actual(BUTTON_8) ) { // ADS - aiming down sight
                  AntiRecoil(STICK_1_Y, (fix32)cfgAntiRecoilV[WeaponActive+ADS]);
                  AntiRecoil(STICK_1_X, (fix32)cfgAntiRecoilH[WeaponActive+ADS]);
                } else {    // hip fire
                  AntiRecoil(STICK_1_Y, (fix32)cfgAntiRecoilV[WeaponActive+HIP]);
                  AntiRecoil(STICK_1_X, (fix32)cfgAntiRecoilH[WeaponActive+HIP]);
                }
              }
              break;
            case RFM_ENABLED: // RAPID enabled
              combo_run(cmbRapidFire);
              break;
            case RFM_PRESSURE: // RAPID enabled on PRESSURE reached
              if ((int)get_actual(BUTTON_5) >= cfgRapidFirePressure[WeaponActive]) { // pressure reached to rapid fire
                combo_run(cmbRapidFire);
              } else { // normal fire
                if (cfgAntiRecoil[WeaponActive] > 0) {
                  if ( get_actual(BUTTON_8) ) { // ADS - aiming down sight
                    AntiRecoil(STICK_1_Y, (fix32)cfgAntiRecoilV[WeaponActive+ADS]);
                    AntiRecoil(STICK_1_X, (fix32)cfgAntiRecoilH[WeaponActive+ADS]);
                  } else {    // hip fire
                    AntiRecoil(STICK_1_Y, (fix32)cfgAntiRecoilV[WeaponActive+HIP]);
                    AntiRecoil(STICK_1_X, (fix32)cfgAntiRecoilH[WeaponActive+HIP]);
                  }
                }
              }
              break;
          } // eo: switch firemode
        }
      // -------------------------------------------------------------------------
      // Use : Revive / Activate : Hold down Square on double-tap SQUARE
        if ( event_active(BUTTON_17) ) combo_stop(cmbHoldSquare);
        if (EasyRevive && get_actual(BUTTON_17) && time_release(BUTTON_17) < 250) {
          combo_run(cmbHoldSquare);
        }
      // -
      // Use : Extra Key actions
      xKeysActions();
      // -------------------------------------------------------------------------
      // Use & Toggle : Easy Run
      if (EasyRunMode>0) EasyRun();
    } // eo: !SparrowFlag
 
    // -------------------------------------------------------------------------
    // Use & Toggle : Sparrow Mode
    if (SparrowMode>0) Sparrow();
    }
 
 
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // *** EDITING anti recoil and rapid fire settings in-game ***
    if (Edit) {
      if (!EditWrite && !cmbWeaponActivate && !EditNonActive) combo_run(EditWriteItem);
        // EDIT what ?  -  Cycle through Anti Recoil <-> Rapid Fire editing
            if ( event_release(BUTTON_6) && time_active(BUTTON_6) < 500 ) {
                EditItem = (EditItem+1) % 2;
            }
        // -------------------------------------------------------------------------
        // EDIT : Anti Recoil
        if ( EditItem == EDIT_RECOIL )
        {
      EditAntiRecoil();
        }
        // -------------------------------------------------------------------------
        // EDIT : Rapid Fire  -  Up/Down: +/- fire rate , Left/Right: -/+ bullets per shot (trigger pull)
        if ( EditItem == EDIT_RAPID )
        {
      EditRapidFire();
        }
    }
 
 
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Special
        // -------------------------------------------------------------------------
        // input blocking to only activate gestures when the DPad direction is pressed longer than the double-tap check
        if (!Menu && !SparrowFlag) {
                uint8 i;
                for(i=BUTTON_10; i<=BUTTON_13; ++i) {
                    inhibit(i,250);
                }
        }   
        // -------------------------------------------------------------------------
        // AFK - prevent disconnect
    if ( AFK == TRUE ) {
          combo_run(AFKWrite);
          combo_run(cmbAFK);
    }
 
} // eo: main
 
 
void EditAntiRecoil() {
  if (!cfgAntiRecoil[WeaponActive]) {
    combo_run(EditNonActive);
    return; // don't edit when not enabled, todo: add warning
  }
 
  if (cfgRapidFireMode[WeaponActive] == RFM_DISABLED) // rapid fire disabled, using normal anti recoil if it is active
  {
    EditARMod(&cfgAntiRecoilV,&cfgAntiRecoilH);
  }
 
  if (cfgRapidFireMode[WeaponActive] == RFM_ENABLED ) // rapid fire enabled
  {
    EditARMod(&cfgRapidAntiRecoilV,&cfgRapidAntiRecoilH);
  }
 
  if (cfgRapidFireMode[WeaponActive] == RFM_PRESSURE) // rapid fire by pressure
  {
    // R1 hold (Melee) to edit AR for RF on pressure
    if (get_actual(BUTTON_4)) EditARMod(&cfgRapidAntiRecoilV,&cfgRapidAntiRecoilH); // rapid fire
    else EditARMod(&cfgAntiRecoilV,&cfgAntiRecoilH)// normal
  }
  //if (event_release(BUTTON_10)) printf("value: %d",cfgAntiRecoilV[WeaponActive+0]);
}
void EditARMod(int8 *ARV,int8 *ARH) {
  uint8 TYP=HIP; // HIP==0, ADS==3
 
  if ( get_actual(BUTTON_8) ) TYP=ADS; // HIP or ADS value to edit
 
  if      (event_active(BUTTON_10)) { // dpad-up
    ARV[WeaponActive+TYP]-=1;
  }
  else if (event_active(BUTTON_11)) { // dpad-down
    ARV[WeaponActive+TYP]+=1;
  }
  else if (event_active(BUTTON_12)) { // dpad-left
    ARH[WeaponActive+TYP]-=1;
  }
  else if (event_active(BUTTON_13)) { // dpad-right
    ARH[WeaponActive+TYP]+=1;
  }
  clamp(ARV[WeaponActive+TYP],-100,100);
  clamp(ARH[WeaponActive+TYP],-100,100);
}
 
 
void EditRapidFire() {
  if (cfgRapidFireMode[WeaponActive]==0) {
    combo_run(EditNonActive);
    return; // don't edit when not enabled, todo: add warning
  }
  EditRFMod(&cfgRapidFireSPM,&cfgRapidFireBPS);
}
 
void EditRFMod(uint16 *RFV,uint8 *RFH) {
  uint8 TYP=0; // HIP==0, ADS==3
 
  if ( get_actual(BUTTON_8) ) TYP=ADS; // HIP or ADS value to edit
 
  if      (event_active(BUTTON_10)) { // dpad-up
    RFV[WeaponActive+TYP]-=1;
  }
  else if (event_active(BUTTON_11)) { // dpad-down
    RFV[WeaponActive+TYP]+=1;
  }
  else if (event_active(BUTTON_12)) { // dpad-left
    RFH[WeaponActive+TYP]-=1;
  }
  else if (event_active(BUTTON_13)) { // dpad-right
    RFH[WeaponActive+TYP]+=1;
  }
  clamp(RFV[WeaponActive+TYP],20,1000);
  clamp(RFH[WeaponActive+TYP],1,30);
  RapidFireHoldRelease((fix32)cfgRapidFireSPM[WeaponActive+TYP], cfgRapidFireBPS[WeaponActive+TYP], &cfgRapidFireHold[WeaponActive+TYP], &cfgRapidFireRelease[WeaponActive+TYP]);
}
 
 
// set the led according to active weapon slot
void WeaponLED() {
  WeaponLEDOnly();
    if (Edit == TRUE) combo_run(EditWrite);
    else if (Menu == TRUE)  combo_run(MenuWrite);
}
 
void WeaponLEDOnly() {
  uint8 c[]={CG,CR,CP};
  ColorLED(c[WeaponActive],100);
}
 
//  toggle/cycle setting in valid range
void Toggle(bool *setting, uint8 modes, uint8 pmemdest) {
    if ( modes < 3 ) {
        if (*setting) { *setting=0; combo_run(DoubleRumbleNotifier); }
        else { *setting=1; combo_run(RumbleNotifier); }
    } else {
        *setting+=1;
    //printf("modes %d , setting: %d",modes,*setting);
        if (*setting == modes) { *setting=0; combo_run(DoubleRumbleNotifier); }
        else {combo_run(RumbleNotifier);}
    }
  //printf("modes %d , setting: %d",modes,*setting);
    pmem_write(pmemdest+20*WeaponActive,*setting);
    ICPM_Update(TRUE);
}
 
 
// cycle through weapons
void WeaponSlotCyle() {
    if (WeaponActive == PRIMARY)         WeaponActivate=SECONDARY;
    if (WeaponActive == SECONDARY)    WeaponActivate=PRIMARY;
    if (WeaponActive == POWER)             WeaponActivate=PRIMARY;
    if (WeaponActive != WeaponActivate
             && !(cmbWeaponActivate) ) combo_run(cmbWeaponActivate);
}
 
// antithesis antirecoil
void AntiRecoil (uint8 axis, fix32 recoil)
{
  fix32 RY = get_actual(STICK_1_Y);
  fix32 RX = get_actual(STICK_1_X);
 
  //if (get_val(BUTTON_5) && (sqrt(RX*RX + RY*RY)) <= abs(recoil))
  if ((sqrt(RX*RX + RY*RY)) <= abs(recoil))
  {
      if(abs(RY) <= abs(recoil))
      {
          set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_val(axis));
      }
  }
}
 
 
// calculate the rapid fire hold and wait time
void RapidFireHoldRelease(fix32 ShotPerMin, int ShotPerPull, uint8 *RFHold, uint8 *RFRelease) {
    *RFHold = (int)floor((1000.0 / (ShotPerMin / 60.0)) / 2.0) * ShotPerPull;
  if(mod((1000.0 / (ShotPerMin / 60.0)), 2.0) != 0.0) {
        *RFRelease = *RFHold + 1;
    } else {
        *RFRelease = *RFHold;
    }
  //printf("hold: %d, Release: %d",*RFHold,*RFRelease);
}
 
// change sticks sensitivity
void sensitivity(int id, int8 sen) {
    int val = (int)get_actual(id);
    val = (val * sen) / 100;
    set_val(id, clamp(val, -100, 100));
    return;
}
 
// returns last button released
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);
}
 
// extra key event -> action mapping
void xKeysActions() {
    uint8 k;
    for(k = 0; k < XKEYS_MONITOR_MAX; ++k) {
    if (xkeys_monitor[k]== 0) continue; // skip when no keyx is set
    if (xtraKeyAction[k] == X_OFF) continue; // skip when no action is set
    if (xtraKeyAction[k] == X_EASYRUN_A_HOLD) EasyRunPause=TRUE; // only allow easyrun on key is held down
    //if (xkeys_is_active(keys_to_monitor[k])) {
      if (xkeys_event_active(keys_to_monitor[k])) xSwitch(xtraKeyAction[k]);
      // execute or pause easyrun while key hold down
      if ( xkeys_is_active(keys_to_monitor[k]) &&  xtraKeyAction[k] >= X_EASYRUN_P_HOLD && xtraKeyAction[k] <= X_EASYRUN_A_HOLD) {
        xSwitch(xtraKeyAction[k]);
      }
    //}
    } // eo: for k < KEYS_TO_MONITOR
}
 
// trigger the correct action according to the selected combobox item
void xSwitch(uint8 action) {
  switch(action) {
    case X_FIXSLOT: WeaponSlotCyle();
                    break;
    case X_DBLTAB_CIRCLE:    combo_run(cmbDoubleTapCircle);
                    break;
    case X_RAPID_TOGGLE:     Toggle(&cfgRapidFireMode[WeaponActive],3,14);
                    combo_run(FireModeWrite);
                    combo_run(FireModeBlink);
                    break;               
    case X_AFK_TOGGLE :
                    if ( DisableAFK == TRUE ) break;
                    AFK = ! AFK;
                    if ( AFK == TRUE ) ColorLED(CA,100);
                    else WeaponLED();
                    break;
    case X_RUN_SLIDE:            combo_run(cmbRunSlide);
                    break;
    case X_RUN_SLIDE_M:        combo_run(cmbRunSlideMelee);
                    break;
    case X_RUN_SLIDE_J:        combo_run(cmbRunSlideJump);
                    break;
    case X_RUN_DBL_JUMP:        combo_run(cmbDoubleJump);
                    break;
    case X_RUN_TPL_JUMP:        combo_run(cmbTripleJump);
                    break;
    case X_HOLD_SQUARE:        combo_stop(cmbHoldSquare);    combo_run(cmbHoldSquare);
                    break;
    case X_EASYRUN_TOGGLE: if (EasyRunMode>0) EasyRunOn= !EasyRunOn; break; // only allow toggle if not disabled
    case X_EASYRUN_P_HOLD: if (EasyRunMode>0 && EasyRunOn) EasyRunPause=TRUE; break; // walk when key is held down
    case X_EASYRUN_A_HOLD: if (EasyRunMode>0 && EasyRunOn) EasyRunPause=FALSE; break; // run when key is held down
  } // eo: switch
}
 
 
// rapid fire
combo cmbRapidFire {
  uint8 UseWeapon = WeaponActive;
 
  // hip values as default
    int8 RapidAntiRecoilV=cfgRapidAntiRecoilV[UseWeapon+HIP];
    int8 RapidAntiRecoilH=cfgRapidAntiRecoilH[UseWeapon+HIP];
    uint8 RFHold=cfgRapidFireHold[UseWeapon+HIP];
    uint8 RFWait=cfgRapidFireRelease[UseWeapon+HIP];
 
  // overwrite with ADS values if ADS is active
  if ( get_actual(BUTTON_8) ) { // ADS - aiming down sight
    RapidAntiRecoilV=cfgRapidAntiRecoilV[UseWeapon+ADS];
    RapidAntiRecoilH=cfgRapidAntiRecoilH[UseWeapon+ADS];
    RFHold=cfgRapidFireHold[UseWeapon+ADS];
    RFWait=cfgRapidFireRelease[UseWeapon+ADS];
  }
 
    set_val(BUTTON_5, 100)
    if(cfgRapidAntiRecoilMode[UseWeapon] == RFAR_ONHOLD) {
      AntiRecoil(STICK_1_Y, (fix32)RapidAntiRecoilV);
      AntiRecoil(STICK_1_X, (fix32)RapidAntiRecoilH);
    }   
    wait(RFHold);
 
 
    set_val(BUTTON_5, 0);
    if(cfgRapidAntiRecoilMode[UseWeapon] == RFAR_ONRELEASE) {
        AntiRecoil(STICK_1_Y, (fix32)RapidAntiRecoilV);
        AntiRecoil(STICK_1_X, (fix32)RapidAntiRecoilH);
    }
    wait(RFWait);
}
 
// switch weapon and show weapon slots color
combo cmbWeaponActivate {
    if ( (WeaponActiveWrite) ) combo_stop(WeaponActiveWrite);
    combo_run(WeaponActiveWrite);
    WeaponActive = WeaponActivate;
    WeaponLED();
  wait(0); wait(400);
    combo_run(FireModeBlink);
}
 
combo cmbDoubleTapCircle {
    set_val(BUTTON_15,100);
    wait(40); wait(30);
    set_val(BUTTON_15,100);
    wait(40); wait(30);
}
 
combo cmbRunSlide {
    set_val(STICK_2_Y,-100);
    set_val(BUTTON_9,100);
    wait(200);
    set_val(STICK_2_Y,-100);
    set_val(BUTTON_15,100);
    wait(100); wait(50);
}
 
combo cmbRunSlideMelee {
    combo_run(cmbRunSlide);
    wait(900);
    set_val(BUTTON_4,100);
    wait(40);
    wait(0);
}
 
combo cmbRunSlideJump {
    combo_run(cmbRunSlide);
    wait(900);
    set_val(BUTTON_16,100);
    wait(40);
    wait(0);
}
 
combo cmbDoubleJump {
    set_val(BUTTON_16,100);
    wait(250); wait(350);
    set_val(BUTTON_16,100);
    wait(250); wait(0);
}
 
combo cmbTripleJump {
    set_val(BUTTON_16,100);
    wait(250); wait(350);
    set_val(BUTTON_16,100);
    wait(250); wait(350);
    set_val(BUTTON_16,100);
    wait(250); wait(0);
}
 
 
// writes m (menu) via the led
combo MenuWrite {
  WriteBusy=TRUE;
    display_overlay(_m_,400);
  wait(0); wait(400);
    Menu = TRUE;
    ColorLED(CC,100);
  WriteBusy=FALSE;
}
 
// writes AFK via the led
combo AFKWrite {
  WriteBusy=TRUE;
    display_overlay(_A_,400);wait(0); wait(1000);
    display_overlay(_F_,400);wait(0); wait(1000);
    display_overlay(_K_,400);wait(0); wait(2000);
  WriteBusy=FALSE;
}
 
// writes g (game) via the led
combo GameWrite {
  WriteBusy=TRUE;
    display_overlay(_g_,4000);
  wait(0); wait(400);
    Menu = FALSE;
    WeaponLED();
  WriteBusy=FALSE;
}
 
// writes e (edit) via the led
combo EditWrite {
    wait(200);
  WriteBusy=TRUE;
    Edit = TRUE;
    ColorLED(CW,100);
    display_overlay(_E_,2000);
  wait(0); wait(2000);
  WriteBusy=FALSE;
}
 
// display a(white) for antirecoil or f(yellow) for r (rapid)
combo EditWriteItem {
  WriteBusy=TRUE;
  ColorLED(cedit[EditItem],100);
  display_overlay(dedit[EditItem],2000);
  wait(0); wait(1000);
    WeaponLEDOnly();
  wait(0);    wait(1000);
  WriteBusy=FALSE;
}
 
combo EditNonActive {
  //WriteBusy=TRUE;
  ColorLED(CC,100,100,-1);
  display_overlay(dedit[EditItem],4000);
  wait(0); wait(4000);
  //WriteBusy=FALSE;
}
 
 
combo WeaponActiveWrite {
  wait(400);
  WriteBusy=TRUE;
    display_overlay(Overlay[WeaponActive+1],400);
  wait(0); wait(400);
  WriteBusy=FALSE;
}
 
 
// writes a (anti recoil) via the led
combo AntiRecoilWrite {
  WriteBusy=TRUE;
    display_overlay(_a_,400);wait(0);wait(400);
    //display_overlay(_r_,400);wait(0);wait(400);
  WriteBusy=FALSE;
}
 
// writes f (FireMode) via the led
combo FireModeWrite {
  WriteBusy=TRUE;
    display_overlay(_f_,400);wait(0);wait(400);
    //display_overlay(_m_,400);wait(0);wait(400);
  WriteBusy=FALSE;
}
 
// writes r (rapid anti recoil) via the led
combo RapidFireAntiRecoilModeWrite {
  WriteBusy=TRUE;
    display_overlay(_r_,400);wait(0);wait(200);
    //display_overlay(_a_,400);wait(0);wait(200);
  WriteBusy=FALSE;
}
 
 
// blink the led in color of the activated anti recoil mode (off/on)
combo AntiRecoilBlink {
  // uint8 cBlink[]={'R','G','Y','P'}; // led color blink for ar/rf mode/state
  ColorLED(cBlink[cfgAntiRecoil[WeaponActive]],150,150,2);
    wait(0);wait(600);
    WeaponLED();
}
 
// blink the led in color of the activated fire mode
combo FireModeBlink {
  uint8 iRFM = clamp(cfgRapidFireMode[WeaponActive],0,2); // limit to array size
  //uint8 cBlink[]={'R','G','A','P'}; // led color blink for ar/rf mode/state
  ColorLED(cBlink[iRFM],150,150,2);
    wait(0);wait(600);
    WeaponLED();
}
 
// blink the led for anti recoil mode for rapid fire
combo RapidFireAntiRecoilModeBlink {
  //uint8 cBlink[]={'R','G','A','P'}; // led color blink for ar/rf mode/state
  ColorLED(cBlink[cfgRapidAntiRecoilMode[WeaponActive]],150,150,2);
    wait(0);wait(600);
    WeaponLED();
}
 
combo cmbAFK {
    set_val(STICK_2_Y,100);
    wait(500);
    set_val(STICK_2_Y,-100);
    wait(500);
  wait(500);
  set_val(BUTTON_8,100);
  wait(1000);
    wait(4000);
}
 
combo cmbHoldSquare {
    set_val(BUTTON_17,100);
    wait(10000);
}
 
// rumble once
combo RumbleNotifier {
    ffb_set(FFB_1, 100.0, 140);
    wait(0);wait(200);
    ffb_set(FFB_1, 0.0, 140);
    wait(0);wait(200);
}
 
// rumble twice
combo DoubleRumbleNotifier {
  call(RumbleNotifier);
  call(RumbleNotifier);
}
 
 
void Sparrow() {
  // block short tap of options
  if ( SparrowMode == 2 && get_actual(BUTTON_8) >=95f) inhibit(BUTTON_3,500);
 
  // sparrow mode on toggles
  if (!SparrowFlag) {
 
    if ( SparrowMode == 1 ) {
      // override Square hold toggle if Square event_active followed by Fire/L3/ADS/Grenade/Melee button input before releasing
      if (event_active(STICK_2_X) || event_active(STICK_2_Y) || event_active(BUTTON_9) || event_active(BUTTON_8) || event_active(BUTTON_5) || event_active(BUTTON_4) || event_active(BUTTON_7)) SparrowEnableOverride=TRUE;
 
      // press of square
      if (event_active(BUTTON_17)) SparrowEnableOverride=FALSE;   
 
      if (SparrowFlag && event_active(BUTTON_17)) SparrowFlag=FALSE;
 
      // release of square
      if (event_release(BUTTON_17)) {
        //printf("release square");
        // short press = reload
        // long hold of square, estimating using sparrow
          if (time_active(BUTTON_17)>=1500 && !SparrowEnableOverride) {
            SparrowActivate();
          }
      }
    }
 
    else if ( SparrowMode == 2 ) {
      if (get_actual(BUTTON_8) >=95f) {
        inhibit(BUTTON_3,500);
        if (event_active(BUTTON_3)) {
          SparrowFlag = TRUE;
          SparrowActivate();
        }
      }
    }
 
    else if ( SparrowMode == 3 ) {
      if(getLastButtonPressed() == BUTTON_2 && get_actual(BUTTON_17)) {
        SparrowActivate();
      }
    }
  } // eo : sparrow mode on toggles
  else {
    // sparrow mode off toggle
    if (event_active(BUTTON_17)) SparrowFlag=FALSE;
  }
 
}
 
void SparrowActivate() {
  SparrowFlag = TRUE;
  ColorLED(CW,100);
  display_overlay(_S_,65000);
}
 
void EasyRun() {
 
  // Easy Run Toggle On/Off with "L3 double-tap"
  if (EasyRunL3Toggle && event_active(BUTTON_9) && time_release(BUTTON_9) < 250) {
    //printf("easy run toggle dbl L3");
    EasyRunOn= ! EasyRunOn;
  }
 
  // release of square
  if (event_release(BUTTON_17)) {
    //printf("release square");
    // short press = reload
      if (time_active(BUTTON_17)<1500) combo_run(cmbReload);
  }
 
  // first check on how to use easyrun
  if (EasyRunOn) {
 
    EasyRunActive=TRUE;
    if(EasyRunMode == 2) {
      EasyRunActive=FALSE;
      if (abs(get_actual(STICK_2_Y)) >= (fix32)EasyRunSens) EasyRunActive=TRUE;
    }
 
    // pause autorun on crouch until L3 gets pressed again
      if (abs(get_actual(STICK_2_Y)) < (fix32)EasyRunSens && event_active(BUTTON_15)) { 
        // its estimated that crouch is wanted on little or no l_y movement and circle press
        EasyRunPausedByCrouch=TRUE;
      }
      if (event_active(BUTTON_9)) EasyRunPausedByCrouch=FALSE;
 
    // pause during reload, on crouch, ..
      if (cmbReload || EasyRunPausedByCrouch) EasyRunActive=FALSE;
 
    // pause on ads, fire....
      if (get_actual(BUTTON_17) || get_actual(BUTTON_8) || get_actual(BUTTON_5) || get_actual(BUTTON_4) || get_actual(BUTTON_7)) {
        combo_stop(cmbReload);
        EasyRunActive=FALSE;
      }
 
    // display 'r' or 'r.' when autorun is enabled, not during weaponchange or edit mode
      if (!cmbWeaponActivate && !WriteBusy) combo_run(cmbEasyRunDisplay);
 
      if (EasyRunActive) combo_run(cmbEasyRun);
 
  } // eo: EasyRunOn
 
}
 
// to pause easyrun during reload
combo cmbReload {
  wait(cfgEasyRunReloadPause[WeaponActive]);
}
 
combo cmbEasyRun {
  set_val(BUTTON_9, 100.0);
  wait(60);
  set_val(BUTTON_9, 0.0);
  wait(60);
}
 
combo cmbEasyRunDisplay {
  if (EasyRunActive) display_overlay(_r_|BOTTOM_DOT,500); // when active show 'r.'
  else display_overlay(_r_,500);                          // when "ready" show 'r'
  wait(0);
  wait(500);
}
 
//if (!AimAssistShootY || !is_active(BUTTON_5))
combo cmbAimAssistY {
  set_val(STICK_1_Y, AA_VALUE);
  wait(AA_DELAY);
  set_val(STICK_1_Y, -AA_VALUE);
  wait(AA_DELAY);
}
 
combo cmbAimAssistX {
  set_val(STICK_1_X, AA_VALUE);
  wait(AA_DELAY);
  set_val(STICK_1_X, -AA_VALUE);
  wait(AA_DELAY);
}
 
combo cDWpnSwitch {
    set_val(DWBtnIdx,100);
    wait(40);
    set_val(DWBtnIdx,100);
    call(cHoldBtn);
    wait(0);
    DWBtnIdx=255;
}
 
combo cHoldBtn {
    set_val(DWBtnIdx,100);
    if (get_actual(DWBtnIdx)) combo_restart(cDWpnSwitch);
    wait(40);
}
 
 
// ADJUST AIM ASSIST WHERE IT DOESN'T SHAKE SCREEN BUT STILL WORKS /////////////
#define CIRCLE_RADIUS_R       32.0
#define CIRCLE_RADIUS_L       32.0
#define CIRCLE_STEP_R         0.10
#define CIRCLE_STEP_L         0.10
#define CIRCLE_SPEED_R        1
#define CIRCLE_SPEED_L        1
////////////////////////////////////////////////////////////////////////////////
bool assist_on = 1;
bool aim_on = 1;
bool ON_OFF_R;
bool ON_OFF_L;
////////////////////////////////////////////////////////////////////////////////
fix32 angle_R;
fix32 angle_L;
////////////////////////////////////////////////////////////////////////////////
 
main {
    // AIM ASSIST
    if(assist_on == 1) {
    if(aim_on == 0) {
    if(ON_OFF_R == 1) {
         set_val(STICK_1_X, CIRCLE_RADIUS_R * cos(angle_R));
         set_val(STICK_1_Y, CIRCLE_RADIUS_R * sin(angle_R));
            combo_run(AutoCircle_R);
    }
 
      if(get_actual(STICK_1_Y) < -35.0 || get_actual(STICK_1_Y) > 35.0 ||
       get_actual(STICK_1_X) < -35.0 || get_actual(STICK_1_X) > 35.0) {
        combo_stop(AutoCircle_R);
        ON_OFF_R = 0;
    }else {
        ON_OFF_R = 1;
    }
    if(ON_OFF_L == 1) {
         set_val(STICK_2_X, CIRCLE_RADIUS_L * cos(angle_L));
         set_val(STICK_2_Y, CIRCLE_RADIUS_L * sin(angle_L));
            combo_run(AutoCircle_L);
    }
 
      if(get_actual(STICK_2_Y) < -35.0 || get_actual(STICK_2_Y) > 35.0 ||
       get_actual(STICK_2_X) < -35.0 || get_actual(STICK_2_X) > 35.0) {
        combo_stop(AutoCircle_L);
        ON_OFF_L = 0;
    }else {
        ON_OFF_L = 1;
    }
    }
    if(aim_on == 1) {
    if(get_actual(BUTTON_8)) {
    if(ON_OFF_R == 1) {
         set_val(STICK_1_X, CIRCLE_RADIUS_R * cos(angle_R));
         set_val(STICK_1_Y, CIRCLE_RADIUS_R * sin(angle_R));
            combo_run(AutoCircle_R);
    }
 
      if(get_actual(STICK_1_Y) < -35.0 || get_actual(STICK_1_Y) > 35.0 ||
       get_actual(STICK_1_X) < -35.0 || get_actual(STICK_1_X) > 35.0) {
        combo_stop(AutoCircle_R);
        ON_OFF_R = 0;
    }else {
        ON_OFF_R = 1;
    }
    if(ON_OFF_L == 1) {
         set_val(STICK_2_X, CIRCLE_RADIUS_L * cos(angle_L));
         set_val(STICK_2_Y, CIRCLE_RADIUS_L * sin(angle_L));
            combo_run(AutoCircle_L);
    }
 
      if(get_actual(STICK_2_Y) < -35.0 || get_actual(STICK_2_Y) > 35.0 ||
       get_actual(STICK_2_X) < -35.0 || get_actual(STICK_2_X) > 35.0) {
        combo_stop(AutoCircle_L);
        ON_OFF_L = 0;
    }else {
        ON_OFF_L = 1;
    }
    }
    }
    }
}
 
combo AutoCircle_R
{
    wait(CIRCLE_SPEED_R);
    angle_R = mod(angle_R + CIRCLE_STEP_R, 2.0 * PI);
}
 
combo AutoCircle_L
{
    wait(CIRCLE_SPEED_L);
    angle_L = mod(angle_L - CIRCLE_STEP_L, 2.0 * PI);
}[/code]
User avatar
TaricNida
Corporal
Corporal
 
Posts: 5
Joined: Thu Dec 02, 2021 11:26 pm

Re: Combining Two Scripts for Destiny 2. Please Help!

Postby Mad » Fri Dec 03, 2021 11:11 pm

Not sure why you're posting it here.

Copy the aim assist script you want at the very bottom of destiny2_scachi.gpc
Save.
Install to memory slot.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: Combining Two Scripts for Destiny 2. Please Help!

Postby TaricNida » Fri Dec 03, 2021 11:50 pm

Oh sorry, I thought you meant here. Yeah, when I do that. I get 6 errors. It doesn’t allow me to do that
User avatar
TaricNida
Corporal
Corporal
 
Posts: 5
Joined: Thu Dec 02, 2021 11:26 pm

Re: Combining Two Scripts for Destiny 2. Please Help!

Postby Mad » Sat Dec 04, 2021 12:00 am

Without knowing the error cant really help.

My guess is you've moved the main script file but not the other includes it comes with.
Download the destiny script again from the online resource and paste the other one at the very bottom. Works for me.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: Combining Two Scripts for Destiny 2. Please Help!

Postby TaricNida » Sat Dec 04, 2021 12:21 am

Can you post what you added cause I'm still getting 5 errors when combining them
User avatar
TaricNida
Corporal
Corporal
 
Posts: 5
Joined: Thu Dec 02, 2021 11:26 pm


Return to Gtuner IV Support

Who is online

Users browsing this forum: No registered users and 77 guests