Can somebody get rid of this error on this script please?

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

Can somebody get rid of this error on this script please?

Postby Boot25 » Tue Dec 20, 2022 10:17 pm

These are the errors from output panel, the rapid fire part of it is messed up.


GPC error: deady.gpc(256): Scope level mismatch '}' (possible mismatched brackets)

GPC error: deady.gpc(258): Declaration syntax error 'combo'

GPC error: deady.gpc(263): Scope level mismatch '}' (possible mismatched brackets)

Code: Select all
#pragma METAINFO("Deadzone, Anti-Deadzone and Curve Manipulation(Super Simple Version)", 1, 00, "Eternal Dahaka")
#pragma METAINFO("<Jacked>", 1, 0, "")
 
#include <xb1.gph>
 
#define SHOOT                 XB1_RT
#define ADS                   XB1_LT
#define RAPIDFIRE_SPEED        30 // Lower the value, faster the rapidfire
 
bool toggle = !FALSE;
/*
v 1.00
Hello everyone.  This script should be able to counter square/axial deadzones,
add circular deadzones, allow control over the response curve and skip over or
add regions of restricted diagonal movement around the axes.
 
Additional huge CPU load reduction by mimicking code by ME.
 
Hope it's useful for players. :D
 
INITIAL NOTES
Use decimals for the deadzone values(20% = 0.2) and the axial restrict and use
positive numbers for the angularAnti(20 degrees = 20.0).
 
Circular anti-deadzone values are relative to the remaining range of the square
anti-deadzones when both are used together.  For example, if antiCircle and
antiSquare are both set to 0.50, you'll get an antideadzone of 0.75.
 
Uncap values is disabled by default to avoid acceleration ranges.  This will
cause issues with movement in the diagonals if any square deadzones are left
uncountered. Either make sure to counter them, or set this value to TRUE.
 
This graph link shows how some of the the values function with some sample ranges
if the descriptions aren't clear enough.
https://www.desmos.com/calculator/1twwnifmmg
Please refer to the documentation page for more detailed descriptions, examples
and recommended value ranges.
*/

    //CHANGE BELOW VALUES
 
    //RIGHT STICK SETTINGS
    bool useRightStickSettings    =  TRUE;    //If FALSE, all settings calculations for the right stick will be ignored.
 
    fix32 deadzone                =  0.00;    //Enter value of desired circular deadzone.
    fix32 antiCircularDeadzone    =  0.00;    //Enter value of the game's circular deadzone.  Common sizes are 0.2 to 0.25.
    fix32 antiSquareDeadzone      =  0.00;    //Enter value of the game's square/axial deadzone.  Common sizes are 0.2 to 0.25.
    fix32 outerDeadzoneIn         =  1.00;      //Only useful if user's stick is unable to reach certain magnitudes.  1.00 is ideal normnally.
    fix32 outerDeadzoneOut        =  1.00;    //Enter value of the maximum range you want to limit stick output. Do not use values over 1.
    fix32 degree                  =  1.00;    //Enter value of the game's curve to cancel it into a linear curve.  Larger values result in faster starting movement.
    bool  uncapValues             =  FALSE;      //Choose if to uncap values beyond the outerDeadzone.
    bool toggle                   = !FALSE;
    int8 useAlternate             =  50;      //Choose to use alternate settings when a button is held down.
    int8 useAlternate2              =  50;      //Please use values of ~42-60 to ignore buttons, or replace value of the button you'd
                                              //like to use to switch to the alternate values below.  The button values can be
                                              //found in the leftmost column from Help > GPC Input Reference or by pressing F1.
    //RIGHT STICK ALTERNATE SETTINGS
    fix32 deadzoneA               =  0.00;
    fix32 antiCircularDeadzoneA   =  0.00;
    fix32 antiSquareDeadzoneA     =  0.00;
    fix32 outerDeadzoneInA        =  1.00;
    fix32 outerDeadzoneOutA       =  1.00;
    fix32 degreeA                 =  1.00;
    bool  uncapValuesA            =  FALSE;
 
    //RIGHT STICK ALTERNATE 2 SETTINGS
    fix32 deadzoneA2              =  0.00;
    fix32 antiCircularDeadzoneA2  =  0.00;
    fix32 antiSquareDeadzoneA2    =  0.00;
    fix32 outerDeadzoneInA2       =  1.00;
    fix32 outerDeadzoneOutA2      =  1.00;
    fix32 degreeA2                =  1.00;
    bool  uncapValuesA2           =  FALSE;
 
    /*------------------------------------------------------------*/
 
    //LEFT STICK SETTINGS
    bool useLeftStickSettings     =  TRUE;    //If FALSE, all settings calculations for the left stick will be ignored.
 
    fix32 deadzoneL               =  0.00;    //Enter value of desired circular deadzone.
    fix32 antiCircularDeadzoneL   =  0.00;    //Enter value of the game's circular deadzone.  Common sizes are 0.2 to 0.25.
    fix32 antiSquareDeadzoneL     =  0.00;    //Enter value of the game's square/axial deadzone.  Common sizes are 0.2 to 0.25.
    fix32 outerDeadzoneInL        =  1.00;      //Only useful if user's stick is unable to reach certain magnitudes.  1.00 is ideal normnally.
    fix32 outerDeadzoneOutL       =  1.00;    //Enter value of the maximum range you want to limit stick input. Do not use values over 1.
    fix32 degreeL                 =  1.00;    //Enter value of the game's curve to cancel it into a linear curve.  Larger values result in faster starting movement.
    bool  uncapValuesL            =  FALSE;      //Choose if to uncap values beyond the outerDeadzone.
 
    int8 useAlternateL            =  50;      //Choose to use alternate settings when a button is held down.
    int8 useAlternateL2           =  50;      //Please use values of ~42-60 to ignore buttons, or replace value of the button you'd
                                              //like to use to switch to the alternate values below.  The button values can be
                                              //found in the leftmost column from Help > GPC Input Reference or by pressing F1.
    //LEFT STICK ALTERNATE SETTINGS
    fix32 deadzoneLA              =  0.00;
    fix32 antiCircularDeadzoneLA  =  0.00;
    fix32 antiSquareDeadzoneLA    =  0.00;
    fix32 outerDeadzoneInLA       =  1.00;
    fix32 outerDeadzoneOutLA      =  1.00;
    fix32 degreeLA                =  1.00;
    bool  uncapValuesLA           =  FALSE;
 
    //LEFT STICK ALTERNATE 2 SETTINGS
    fix32 deadzoneLA2             =  0.00;
    fix32 antiCircularDeadzoneLA2 =  0.00;
    fix32 antiSquareDeadzoneLA2   =  0.00;
    fix32 outerDeadzoneInLA2      =  1.00;
    fix32 outerDeadzoneOutLA2     =  1.00;
    fix32 degreeLA2               =  1.00;
    bool  uncapValuesLA2          =  FALSE;
 
 
fix32 stickRX, stickRY;
fix32 stickLX, stickLY;   
 
main {
 
    //Apply right stick settings
    if(useRightStickSettings){
        static fix32 prevRX, prevRY;      //Magic CPU reduction variables by ME.
        fix32 currRX = get_val(STICK_1_X);
        fix32 currRY = get_val(STICK_1_Y);
 
        if(prevRX != currRX || prevRY != currRY){
            if(get_val(useAlternate) > 0.00){
                applyStick(deadzoneA, antiCircularDeadzoneA, antiSquareDeadzoneA, outerDeadzoneInA, outerDeadzoneOutA,  degreeA, uncapValuesA,  1);
            }
            else if(get_val(useAlternate2) > 0.00){
                applyStick(deadzoneA2, antiCircularDeadzoneA2, antiSquareDeadzoneA2, outerDeadzoneInA2, outerDeadzoneOutA2,  degreeA2, uncapValuesA2,  1);
 
            }
            else{
                applyStick(deadzone, antiCircularDeadzone, antiSquareDeadzone, outerDeadzoneIn, outerDeadzoneOut,  degree, uncapValues,  1);
            }
 
            prevRX = currRX;
            prevRY = currRY;
        }
 
        set_val(STICK_1_X, stickRX);
        set_val(STICK_1_Y, stickRY);
    }
 
    //Apply left stick settings
    if(useLeftStickSettings){
        static fix32 prevLX, prevLY;      //Magic CPU reduction variables by ME.
        fix32 currLX = get_val(STICK_2_X);
        fix32 currLY = get_val(STICK_2_Y);
 
        if(prevLX != currLX || prevLY != currLY){   
            if(get_val(useAlternateL) > 0.00){
                applyStick(deadzoneLA, antiCircularDeadzoneLA, antiSquareDeadzoneLA,outerDeadzoneInLA, outerDeadzoneOutLA, degreeLA, uncapValuesLA, 2);
            }
            else if(get_val(useAlternateL2) > 0.00){
                applyStick(deadzoneLA2, antiCircularDeadzoneLA2, antiSquareDeadzoneLA2, outerDeadzoneInLA2, outerDeadzoneOutLA2, degreeLA2, uncapValuesLA2, 2);
            }
            else{
                applyStick(deadzoneL, antiCircularDeadzoneL, antiSquareDeadzoneL,outerDeadzoneInL, outerDeadzoneOutL, degreeL, uncapValuesL, 2);
            }
 
            prevLX = currLX;
            prevLY = currLY;        //fixed typo(prevLX = currLY) replicating ME.'s code.  Caught by Kevin M.
        }
 
        set_val(STICK_2_X, stickLX);
        set_val(STICK_2_Y, stickLY);
    }
}
 
void applyStick(fix32 dead, fix32 antiCDead, fix32 antiSDead, fix32 outerDeadIn, fix32 outerDeadOut, fix32 deg, bool uncap, int8 stick){
 
    fix32 x;
    fix32 y;
    if(stick == 1){
        x               = get_val(STICK_1_X)/100.0;
        y               = get_val(STICK_1_Y)/100.0;
    }
    else{
        x               = get_val(STICK_2_X)/100.0;
        y               = get_val(STICK_2_Y)/100.0;
    }
 
    //True Reference Angle
    fix32 rAngle = rad2deg(abs(atan(y/x)));
    if(abs(x) < 0.0001){rAngle = 90.0;}
 
    //Magnitude and Angle
    fix32 inputMagnitude  = sqrt(x*x + y*y);
    fix32 outputMagnitude;
    fix32 angle           = rad2deg(abs(atan(y/x)));
 
    //if(abs(x) < 0.0001){angle = 90.0;}               //avoids angle change with Atan by avoiding dividing by 0
 
    //printf("ratio = %f, angle = %f, cos = %f, sin = %f", abs(y)/abs(x), angle, cos(deg2rad(angle)), sin(deg2rad(angle)));
 
    //Resizes circular antideadzone to output expected value(counters shrinkage when scaling for the square antideadzone below).
    antiCDead =   antiCDead/( (antiCDead*(1.0 - antiSDead/outerDeadOut) )/( antiCDead*(1.0 - antiSDead) ) );
 
    fix32 refAngle = angle;
 
    //~~~~~~~~~~Deadzone wrap~~~~~~~~~~~~~~~~~~//
    if(inputMagnitude > dead){
 
        outputMagnitude = (inputMagnitude - dead)/(outerDeadIn - dead);
 
        //Circular antideadzone scaling
        outputMagnitude = ((pow(outputMagnitude, (1.0/deg))*(outerDeadOut - antiCDead) + antiCDead));       
 
        //Capping max range
        if(outputMagnitude > outerDeadOut && !uncap){
            outputMagnitude = outerDeadOut;
        }   
 
        //Scaling values for square antideadzone
        fix32 newX = (x/inputMagnitude)*outputMagnitude;
        fix32 newY = (y/inputMagnitude)*outputMagnitude;
 
        //Square antideadzone scaling
        fix32 outputX = abs(newX)*(1.0 - antiSDead/outerDeadOut) + antiSDead;
        if(x < 0.0){outputX = outputX*(-1.0);}
        if(refAngle == 90.0){outputX = 0.0;}
 
        fix32 outputY = abs(newY)*(1.0 - antiSDead/outerDeadOut) + antiSDead;
        if(y < -0.0){outputY = outputY*(-1.0);}
        if(refAngle == 0.0){outputY = 0.0;}
 
        //Output
        if(stick == 1){
            stickRX = clamp(outputX*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
            stickRY = clamp(outputY*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
        }
        else{
            stickLX = clamp(outputX*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
            stickLY = clamp(outputY*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
        }
    }
 
    else{
        if(stick == 1){
            stickRX = 0.0;
            stickRY = 0.0;
        }
        else{
            stickLX = 0.0;
            stickLY = 0.0;
        }                   
    }
 
}
 
    if((get_val(XB1_UP) && event_active(XB1_RT)) || (get_val(XB1_RT) && event_active(XB1_UP))) {
        toggle = !toggle;
    }
    if(toggle && is_active(SHOOT)) {
        combo_run(RapidFire);
    } else if(RapidFire) {
        combo_stop(RapidFire);
    }
}
 
combo RapidFire {
    set_val(SHOOT, 100.0);
    wait(RAPIDFIRE_SPEED);
    set_val(SHOOT, 0.0);
    wait(RAPIDFIRE_SPEED);
}
User avatar
Boot25
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Wed Feb 02, 2022 9:54 am

Re: Can somebody get rid of this error on this script please

Postby Mad » Tue Dec 20, 2022 10:35 pm

Code: Select all
#pragma METAINFO("Deadzone, Anti-Deadzone and Curve Manipulation(Super Simple Version)", 1, 00, "Eternal Dahaka")
#pragma METAINFO("<Jacked>", 1, 0, "")
 
#include <xb1.gph>
 
#define SHOOT                 XB1_RT
#define ADS                   XB1_LT
#define RAPIDFIRE_SPEED        30 // Lower the value, faster the rapidfire
 
/*
v 1.00
Hello everyone.  This script should be able to counter square/axial deadzones,
add circular deadzones, allow control over the response curve and skip over or
add regions of restricted diagonal movement around the axes.
 
Additional huge CPU load reduction by mimicking code by ME.
 
Hope it's useful for players. :D
 
INITIAL NOTES
Use decimals for the deadzone values(20% = 0.2) and the axial restrict and use
positive numbers for the angularAnti(20 degrees = 20.0).
 
Circular anti-deadzone values are relative to the remaining range of the square
anti-deadzones when both are used together.  For example, if antiCircle and
antiSquare are both set to 0.50, you'll get an antideadzone of 0.75.
 
Uncap values is disabled by default to avoid acceleration ranges.  This will
cause issues with movement in the diagonals if any square deadzones are left
uncountered. Either make sure to counter them, or set this value to TRUE.
 
This graph link shows how some of the the values function with some sample ranges
if the descriptions aren't clear enough.
https://www.desmos.com/calculator/1twwnifmmg
Please refer to the documentation page for more detailed descriptions, examples
and recommended value ranges.
*/

    //CHANGE BELOW VALUES
 
    //RIGHT STICK SETTINGS
    bool useRightStickSettings    =  TRUE;    //If FALSE, all settings calculations for the right stick will be ignored.
 
    fix32 deadzone                =  0.00;    //Enter value of desired circular deadzone.
    fix32 antiCircularDeadzone    =  0.00;    //Enter value of the game's circular deadzone.  Common sizes are 0.2 to 0.25.
    fix32 antiSquareDeadzone      =  0.00;    //Enter value of the game's square/axial deadzone.  Common sizes are 0.2 to 0.25.
    fix32 outerDeadzoneIn         =  1.00;      //Only useful if user's stick is unable to reach certain magnitudes.  1.00 is ideal normnally.
    fix32 outerDeadzoneOut        =  1.00;    //Enter value of the maximum range you want to limit stick output. Do not use values over 1.
    fix32 degree                  =  1.00;    //Enter value of the game's curve to cancel it into a linear curve.  Larger values result in faster starting movement.
    bool  uncapValues             =  FALSE;      //Choose if to uncap values beyond the outerDeadzone.
    bool toggle                   = !FALSE;
    int8 useAlternate             =  50;      //Choose to use alternate settings when a button is held down.
    int8 useAlternate2              =  50;      //Please use values of ~42-60 to ignore buttons, or replace value of the button you'd
                                              //like to use to switch to the alternate values below.  The button values can be
                                              //found in the leftmost column from Help > GPC Input Reference or by pressing F1.
    //RIGHT STICK ALTERNATE SETTINGS
    fix32 deadzoneA               =  0.00;
    fix32 antiCircularDeadzoneA   =  0.00;
    fix32 antiSquareDeadzoneA     =  0.00;
    fix32 outerDeadzoneInA        =  1.00;
    fix32 outerDeadzoneOutA       =  1.00;
    fix32 degreeA                 =  1.00;
    bool  uncapValuesA            =  FALSE;
 
    //RIGHT STICK ALTERNATE 2 SETTINGS
    fix32 deadzoneA2              =  0.00;
    fix32 antiCircularDeadzoneA2  =  0.00;
    fix32 antiSquareDeadzoneA2    =  0.00;
    fix32 outerDeadzoneInA2       =  1.00;
    fix32 outerDeadzoneOutA2      =  1.00;
    fix32 degreeA2                =  1.00;
    bool  uncapValuesA2           =  FALSE;
 
    /*------------------------------------------------------------*/
 
    //LEFT STICK SETTINGS
    bool useLeftStickSettings     =  TRUE;    //If FALSE, all settings calculations for the left stick will be ignored.
 
    fix32 deadzoneL               =  0.00;    //Enter value of desired circular deadzone.
    fix32 antiCircularDeadzoneL   =  0.00;    //Enter value of the game's circular deadzone.  Common sizes are 0.2 to 0.25.
    fix32 antiSquareDeadzoneL     =  0.00;    //Enter value of the game's square/axial deadzone.  Common sizes are 0.2 to 0.25.
    fix32 outerDeadzoneInL        =  1.00;      //Only useful if user's stick is unable to reach certain magnitudes.  1.00 is ideal normnally.
    fix32 outerDeadzoneOutL       =  1.00;    //Enter value of the maximum range you want to limit stick input. Do not use values over 1.
    fix32 degreeL                 =  1.00;    //Enter value of the game's curve to cancel it into a linear curve.  Larger values result in faster starting movement.
    bool  uncapValuesL            =  FALSE;      //Choose if to uncap values beyond the outerDeadzone.
 
    int8 useAlternateL            =  50;      //Choose to use alternate settings when a button is held down.
    int8 useAlternateL2           =  50;      //Please use values of ~42-60 to ignore buttons, or replace value of the button you'd
                                              //like to use to switch to the alternate values below.  The button values can be
                                              //found in the leftmost column from Help > GPC Input Reference or by pressing F1.
    //LEFT STICK ALTERNATE SETTINGS
    fix32 deadzoneLA              =  0.00;
    fix32 antiCircularDeadzoneLA  =  0.00;
    fix32 antiSquareDeadzoneLA    =  0.00;
    fix32 outerDeadzoneInLA       =  1.00;
    fix32 outerDeadzoneOutLA      =  1.00;
    fix32 degreeLA                =  1.00;
    bool  uncapValuesLA           =  FALSE;
 
    //LEFT STICK ALTERNATE 2 SETTINGS
    fix32 deadzoneLA2             =  0.00;
    fix32 antiCircularDeadzoneLA2 =  0.00;
    fix32 antiSquareDeadzoneLA2   =  0.00;
    fix32 outerDeadzoneInLA2      =  1.00;
    fix32 outerDeadzoneOutLA2     =  1.00;
    fix32 degreeLA2               =  1.00;
    bool  uncapValuesLA2          =  FALSE;
 
 
fix32 stickRX, stickRY;
fix32 stickLX, stickLY;   
 
main {
    if((get_val(XB1_UP) && event_active(XB1_RT)) || (get_val(XB1_RT) && event_active(XB1_UP))) {
        toggle = !toggle;
    }
    if(toggle && is_active(SHOOT)) {
        combo_run(RapidFire);
    } else if(RapidFire) {
        combo_stop(RapidFire);
    }
 
    //Apply right stick settings
    if(useRightStickSettings){
        static fix32 prevRX, prevRY;      //Magic CPU reduction variables by ME.
        fix32 currRX = get_val(STICK_1_X);
        fix32 currRY = get_val(STICK_1_Y);
 
        if(prevRX != currRX || prevRY != currRY){
            if(get_val(useAlternate) > 0.00){
                applyStick(deadzoneA, antiCircularDeadzoneA, antiSquareDeadzoneA, outerDeadzoneInA, outerDeadzoneOutA,  degreeA, uncapValuesA,  1);
            }
            else if(get_val(useAlternate2) > 0.00){
                applyStick(deadzoneA2, antiCircularDeadzoneA2, antiSquareDeadzoneA2, outerDeadzoneInA2, outerDeadzoneOutA2,  degreeA2, uncapValuesA2,  1);
 
            }
            else{
                applyStick(deadzone, antiCircularDeadzone, antiSquareDeadzone, outerDeadzoneIn, outerDeadzoneOut,  degree, uncapValues,  1);
            }
 
            prevRX = currRX;
            prevRY = currRY;
        }
 
        set_val(STICK_1_X, stickRX);
        set_val(STICK_1_Y, stickRY);
    }
 
    //Apply left stick settings
    if(useLeftStickSettings){
        static fix32 prevLX, prevLY;      //Magic CPU reduction variables by ME.
        fix32 currLX = get_val(STICK_2_X);
        fix32 currLY = get_val(STICK_2_Y);
 
        if(prevLX != currLX || prevLY != currLY){   
            if(get_val(useAlternateL) > 0.00){
                applyStick(deadzoneLA, antiCircularDeadzoneLA, antiSquareDeadzoneLA,outerDeadzoneInLA, outerDeadzoneOutLA, degreeLA, uncapValuesLA, 2);
            }
            else if(get_val(useAlternateL2) > 0.00){
                applyStick(deadzoneLA2, antiCircularDeadzoneLA2, antiSquareDeadzoneLA2, outerDeadzoneInLA2, outerDeadzoneOutLA2, degreeLA2, uncapValuesLA2, 2);
            }
            else{
                applyStick(deadzoneL, antiCircularDeadzoneL, antiSquareDeadzoneL,outerDeadzoneInL, outerDeadzoneOutL, degreeL, uncapValuesL, 2);
            }
 
            prevLX = currLX;
            prevLY = currLY;        //fixed typo(prevLX = currLY) replicating ME.'s code.  Caught by Kevin M.
        }
 
        set_val(STICK_2_X, stickLX);
        set_val(STICK_2_Y, stickLY);
    }
}
 
combo RapidFire {
    set_val(SHOOT, 100.0);
    wait(RAPIDFIRE_SPEED);
    set_val(SHOOT, 0.0);
    wait(RAPIDFIRE_SPEED);
}
 
void applyStick(fix32 dead, fix32 antiCDead, fix32 antiSDead, fix32 outerDeadIn, fix32 outerDeadOut, fix32 deg, bool uncap, int8 stick){
 
    fix32 x;
    fix32 y;
    if(stick == 1){
        x               = get_val(STICK_1_X)/100.0;
        y               = get_val(STICK_1_Y)/100.0;
    }
    else{
        x               = get_val(STICK_2_X)/100.0;
        y               = get_val(STICK_2_Y)/100.0;
    }
 
    //True Reference Angle
    fix32 rAngle = rad2deg(abs(atan(y/x)));
    if(abs(x) < 0.0001){rAngle = 90.0;}
 
    //Magnitude and Angle
    fix32 inputMagnitude  = sqrt(x*x + y*y);
    fix32 outputMagnitude;
    fix32 angle           = rad2deg(abs(atan(y/x)));
 
    //if(abs(x) < 0.0001){angle = 90.0;}               //avoids angle change with Atan by avoiding dividing by 0
 
    //printf("ratio = %f, angle = %f, cos = %f, sin = %f", abs(y)/abs(x), angle, cos(deg2rad(angle)), sin(deg2rad(angle)));
 
    //Resizes circular antideadzone to output expected value(counters shrinkage when scaling for the square antideadzone below).
    antiCDead =   antiCDead/( (antiCDead*(1.0 - antiSDead/outerDeadOut) )/( antiCDead*(1.0 - antiSDead) ) );
 
    fix32 refAngle = angle;
 
    //~~~~~~~~~~Deadzone wrap~~~~~~~~~~~~~~~~~~//
    if(inputMagnitude > dead){
 
        outputMagnitude = (inputMagnitude - dead)/(outerDeadIn - dead);
 
        //Circular antideadzone scaling
        outputMagnitude = ((pow(outputMagnitude, (1.0/deg))*(outerDeadOut - antiCDead) + antiCDead));       
 
        //Capping max range
        if(outputMagnitude > outerDeadOut && !uncap){
            outputMagnitude = outerDeadOut;
        }   
 
        //Scaling values for square antideadzone
        fix32 newX = (x/inputMagnitude)*outputMagnitude;
        fix32 newY = (y/inputMagnitude)*outputMagnitude;
 
        //Square antideadzone scaling
        fix32 outputX = abs(newX)*(1.0 - antiSDead/outerDeadOut) + antiSDead;
        if(x < 0.0){outputX = outputX*(-1.0);}
        if(refAngle == 90.0){outputX = 0.0;}
 
        fix32 outputY = abs(newY)*(1.0 - antiSDead/outerDeadOut) + antiSDead;
        if(y < -0.0){outputY = outputY*(-1.0);}
        if(refAngle == 0.0){outputY = 0.0;}
 
        //Output
        if(stick == 1){
            stickRX = clamp(outputX*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
            stickRY = clamp(outputY*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
        }
        else{
            stickLX = clamp(outputX*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
            stickLY = clamp(outputY*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
        }
    }
 
    else{
        if(stick == 1){
            stickRX = 0.0;
            stickRY = 0.0;
        }
        else{
            stickLX = 0.0;
            stickLY = 0.0;
        }                   
    }
}
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: Can somebody get rid of this error on this script please

Postby Boot25 » Tue Dec 20, 2022 11:09 pm

Thank you so much!
User avatar
Boot25
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Wed Feb 02, 2022 9:54 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 102 guests