Help with autorun on this script please
6 posts
• Page 1 of 1
Help with autorun on this script please
Hi guys, any chance you can have a look at this script and see why the autorun doesn't work please? i've tried altering myself but get errors :( this is the script before i meddled with it.
- Code: Select all
#pragma METAINFO("Project_X_T2_V7.4", 1, 0, "<Sweet_EviL>")
#ifndef EASYCOLOR_GPH_
#define EASYCOLOR_GPH_
/*
<cfgdesc>
[Project X Version 7.4 by Sweet EviL]
color = #FF0000
shortdesc = The features and behaviors of your script can be configured utilizing a wide set of controls.
control = info
[Ballistic Curve]
shortdesc = Select Aim Assist Type:
byteoffset = 0
bitsize = 8
control = combobox
default = 0
item = ORBITAL
item = CARDIOIDE
item = ROTATED ELLIPSE
item = HYPOTROCHOIDES
[Aim Assist Type]
shortdesc = Select Aim Assist Type:
byteoffset = 0
bitsize = 8
control = combobox
default = 0
item = ORBITAL
item = CARDIOIDE
item = ROTATED ELLIPSE
item = HYPOTROCHOIDES
[Aim Assist Config]
shortdesc = Aim Assist Radius
byteoffset = 1
bitsize = 8
control = dial
default = 10
minimum = 1
maximum = 30
step = 1
7
[Aim Assist Config 2]
groupcol = true
shortdesc = Aim Assist Coefficient
byteoffset = 2
bitsize = 8
control = dial
default = 1
minimum = 1
maximum = 50
step = 1
</cfgdesc>
*/
#define PS4_PS BUTTON_1
#define PS4_TOUCH BUTTON_2
#define PS4_OPTIONS BUTTON_3
#define PS4_R1 BUTTON_4
#define PS4_R2 BUTTON_5
#define PS4_R3 BUTTON_6
#define PS4_L1 BUTTON_7
#define PS4_L2 BUTTON_8
#define PS4_L3 BUTTON_9
#define PS4_UP BUTTON_10
#define PS4_DOWN BUTTON_11
#define PS4_LEFT BUTTON_12
#define PS4_RIGHT BUTTON_13
#define PS4_TRIANGLE BUTTON_14
#define PS4_CIRCLE BUTTON_15
#define PS4_CROSS BUTTON_16
#define PS4_SQUARE BUTTON_17
#define PS4_SHARE BUTTON_18
#define PS4_TOUCH1 BUTTON_19
#define PS4_TOUCH2 BUTTON_20
#define PS4_RX STICK_1_X
#define PS4_RY STICK_1_Y
#define PS4_LX STICK_2_X
#define PS4_LY STICK_2_Y
#define PS4_TOUCH1X POINT_1_X
#define PS4_TOUCH1Y POINT_1_Y
#define PS4_TOUCH2X POINT_2_X
#define PS4_TOUCH2Y POINT_2_Y
#define PS4_ACCX ACCEL_1_X
#define PS4_ACCY ACCEL_1_Y
#define PS4_ACCZ ACCEL_1_Z
#define PS4_GYROX GYRO_1_X
#define PS4_GYROY GYRO_1_Y
#define PS4_GYROZ GYRO_1_Z
#define ORBITAL 0
#define CARDIOIDE 1
#define ROTATED_ELLIPSE 2
#define HYPOTROCHOIDES 3
#define MWStandard 01
#define MWRumble 02
#define CWStandard 03
#define CWRumble 04
int16 Max_Drift_Calib_Cycle = 100;
fix32 Max_Drift = 15.0;
uint8 Aim_Type = ROTATED_ELLIPSE;
fix32 Aim_Radius = 16.6; // Shape magnitude
fix32 Rotation_speed = 2.0; // only for ellipsoide
fix32 Aim_Coef = 0.05; // Larger values result in faster shape drowing
fix32 Game_Deadzone = 0.05; // Enter value of the game's square/axial deadzone.
fix32 Positive_Boost = 1.0; // Only useful if user's stick is unable to reach certain magnitudes. 1.00 is ideal normnally.
fix32 Negative_Boost = 1.0; // Enter value of the maximum range you want to limit stick output. Do not use values over 1.
fix32 Curve_Coef = 0.5; // if >1.0 --> Larger values result in faster starting movement | if <1.0 --> slower starting movement
fix32 Vertical_Recoil = 24.3;
uint16 Vertical_Recoil_Timeout = 1200; // time in ms so 1200 = 1.2s
fix32 Consistant_Vertical_Recoil = 11.3;
fix32 Horizontal_Recoil = -3.4;
uint16 Horizontal_Recoil_Timeout = 1100;
fix32 Consistant_Horizontal_Recoil = -1.2;
fix32 Steady_Aim_Resolution = 1.5;
uint8 Slide_Cancel_Mode = 04; // 00 = OFF, 01 = MW Standard, 02 = MW Rumble, 03 CW Standard, 04 CW Rumble
uint16 MW_Slide_Delay = 200;
uint16 CW_Slide_Delay = 110;
uint8 Hair_Triggers = TRUE; // Set to FALSE if you don't want Hair Triggers
uint8 Auto_Sprint = TRUE; // Set to TRUE for Auto Sprint
fix32 THRESHOLD = 80.0;
uint8 Hold_Breath = FALSE; // Set to TRUE for Hold Breath
uint8 Block_Rumble = FALSE; // Set to FALSE to disable any rumble output
uint8 Turbo_Melee = FALSE; // Set to TRUE to melee fast by holding the melee button
uint8 Bunny_Hop = FALSE; // Set to TRUE to Bunny Hop by holding the Jump button
bool bRapid = FALSE; // Set to TRUE if you want on by Default. L2 + UP For ingame quick toggle
fix32 Angle;
int16 Drift_Calib_Cycle;
fix32 C_RX;
fix32 C_RY;
fix32 C_LX;
fix32 C_LY;
fix32 rx_drift;
fix32 ry_drift;
fix32 lx_drift;
fix32 ly_drift;
fix32 rs_b_drift;
fix32 ls_b_drift;
fix32 _ret;
bool slide_enable;
bool SPRINTING;
bool KillSwitch;
//uint8 u8_pmem;
//#define __USE_DEBUG__
/*init {
pmem_load();
pmem_read(0, &Aim_Type);
pmem_read(1, &u8_pmem);
Aim_Radius = (fix32)u8_pmem;
pmem_read(2, &u8_pmem);
Aim_Coef = ((fix32)u8_pmem/100.0);
printf("Aim_Type: %u", Aim_Type);
printf("Aim_Radius: %.02f", Aim_Radius);
printf("Aim_Coef: %.02f", Aim_Coef);
}*/
main {
if (get_actual(PS4_L2) && event_active(PS4_OPTIONS)) {
KillSwitch = !KillSwitch;
ColorLED('R');
combo_run(Rumble);
}
if(!KillSwitch) {
ColorLED('G');
if(Drift_Calib_Cycle < Max_Drift_Calib_Cycle)
{
rx_drift = max(rx_drift, abs(get_actual(PS4_RX)) + 1.0);
ry_drift = max(ry_drift, abs(get_actual(PS4_RY)) + 1.0);
lx_drift = max(lx_drift, abs(get_actual(PS4_LX)) + 1.0);
ly_drift = max(ly_drift, abs(get_actual(PS4_LY)) + 1.0);
rx_drift = min(rx_drift, Max_Drift);
ry_drift = min(ry_drift, Max_Drift);
lx_drift = min(lx_drift, Max_Drift);
ly_drift = min(ly_drift, Max_Drift);
Drift_Calib_Cycle++;
rx_drift = max(rx_drift, ry_drift);
lx_drift = max(lx_drift, ly_drift);
if(Drift_Calib_Cycle == Max_Drift_Calib_Cycle)
{
rx_drift += 1.0;
lx_drift += 1.0;
rs_b_drift /= 100.0;
ls_b_drift /= 100.0;
#ifdef __USE_DEBUG__
printf("Drift_Calib_Cycle: %d", Drift_Calib_Cycle);
printf("rx_drift: %.02f", rx_drift);
printf("lx_drift: %.02f", lx_drift);
#endif
}
}
else
{
C_RX = get_actual(PS4_RX);
C_RY = get_actual(PS4_RY);
C_LX = get_actual(PS4_LX);
C_LY = get_actual(PS4_LY);
C_RX = Get_Steady_Aim(C_RX, Steady_Aim_Resolution);
C_RY = Get_Steady_Aim(C_RY, Steady_Aim_Resolution);
C_LX = Get_Steady_Aim(C_LX, Steady_Aim_Resolution);
C_LY = Get_Steady_Aim(C_LY, Steady_Aim_Resolution);
if(!is_active(PS4_RX) && C_RX < rx_drift)
{
C_RX = 0.0;
}
if(!is_active(PS4_RY) && C_RY < rx_drift)
{
C_RY = 0.0;
}
if(!is_active(PS4_LX) && C_LX < lx_drift)
{
C_LX = 0.0;
}
if(!is_active(PS4_LY) && C_LX < lx_drift)
{
C_LY = 0.0;
}
if(is_active(PS4_L2) || is_active(PS4_R2))
{
Ballistic_Curve(rs_b_drift, Game_Deadzone, Game_Deadzone, Positive_Boost, Negative_Boost, Curve_Coef, 0.0, 0.0, FALSE, &C_RX, &C_RY);
#ifdef __USE_DEBUG__
printf("C_RX: %.02f, C_RY: %.02f", C_RX, C_RY);
#endif
switch (Aim_Type)
{
case ORBITAL:
C_RX += (Aim_Radius * cos(Angle));
C_RY += (Aim_Radius * sin(Angle));
break;
case CARDIOIDE:
C_RX += (Aim_Radius * (2.0 * cos(Angle) + cos(2.0 * Angle)));
C_RY += (Aim_Radius * (2.0 * sin(Angle) + sin(2.0 * Angle)));
break;
case ROTATED_ELLIPSE:
_ret = Rotation_speed * Angle;
C_RY += (Aim_Radius * ((cos(Angle) * cos(_ret)) - (0.4 * (sin(Angle) + sin(_ret)))));
C_RX += (Aim_Radius * ((sin(Angle) * cos(_ret)) - (0.4 * (cos(Angle) + sin(_ret)))));
break;
case HYPOTROCHOIDES:
C_RX += ((Aim_Radius * 2.0 * sin(2.0 * Angle)) - (Aim_Radius * sin(3.0 * Angle)));
C_RY += ((Aim_Radius * 2.0 * cos(2.0 * Angle)) + (Aim_Radius * cos(3.0 * Angle)));
default:
break;
}
if(get_actual(PS4_RX) >= 0.0)
{
Angle -= Aim_Coef * (fix32)elapsed_time();
}
else
{
Angle += Aim_Coef * (fix32)elapsed_time();
}
C_RY += Get_Anti_Recoil(PS4_R2, Vertical_Recoil, Consistant_Vertical_Recoil, Vertical_Recoil_Timeout);
C_RX += Get_Anti_Recoil(PS4_R2, Horizontal_Recoil, Consistant_Horizontal_Recoil, Horizontal_Recoil_Timeout);
}
else
{
Angle = 0.0;
}
set_val(PS4_RX, clamp(C_RX, -100.00, 100.00));
set_val(PS4_RY, clamp(C_RY, -100.00, 100.00));
set_val(PS4_LX, clamp(C_LX, -100.00, 100.00));
set_val(PS4_LY, clamp(C_LY, -100.00, 100.00));
}
if(Block_Rumble)
{
ffb_set(FFB_1, 0.0, 0);
ffb_set(FFB_2, 0.0, 0);
ffb_set(FFB_3, 0.0, 0);
ffb_set(FFB_4, 0.0, 0);
}
if(Auto_Sprint)
{
if(!get_val(PS4_L2) && get_actual(PS4_LY) <= -THRESHOLD)
combo_run(auto_sprint);
}
if(Hair_Triggers)
{
if(get_val(PS4_R2))
set_val(PS4_R2, 100);
if(get_val(PS4_L2))
set_val(PS4_L2, 100);
}
if(Bunny_Hop) {
if (check_active(PS4_CROSS, 200))
combo_run(cBunnyHop);
if (event_release(PS4_CROSS))
combo_stop(cBunnyHop);
}
if(Turbo_Melee) {
if (check_active(PS4_R3, 200))
combo_run(Turbo__Melee);
if (event_release(PS4_R3))
combo_stop(Turbo__Melee);
}
if(Hold_Breath)
{
if(get_val(PS4_L2))
set_val(PS4_L3, 100);
}
if(Slide_Cancel_Mode) {
if(get_actual(PS4_LY) < -75.0) {
slide_enable = 0;
if(event_release(PS4_CIRCLE)) {
if (Slide_Cancel_Mode == 1) {
slide_enable = 1;
}
else if (Slide_Cancel_Mode == 2)
{
if(((ffb_get(FFB_1, NULL) >= 10.0 || ffb_get(FFB_1, NULL) >= 26.0))) {
slide_enable = 1;
}
}
else if (Slide_Cancel_Mode == 3)
{
slide_enable = 2;
}
else if (Slide_Cancel_Mode == 4)
{
if(((ffb_get(FFB_1, NULL) >= 10. || ffb_get(FFB_1, NULL) >= 36.0))) {
slide_enable = 2;
}
}
}
if(slide_enable) {
if(slide_enable == 1)
combo_run(CANCEL_SLIDE_MW);
else if(slide_enable == 2)
combo_run(CANCEL_SLIDE_CW);
}
}
}
if (get_actual(PS4_L2) && event_active(PS4_UP)) {
bRapid = !bRapid;
combo_run(Rumble);
}
if (bRapid) {
if (is_active(PS4_R2))
combo_run(cRapidFire);
if (event_release(PS4_R2))
combo_stop(cRapidFire);
}
}
}
combo Rumble {
ffb_set(FFB_2, 100.0, 275);
wait(0);
wait(500);
ffb_reset();
}
combo CANCEL_SLIDE_MW {
set_val(PS4_CIRCLE, 100);
wait(MW_Slide_Delay);
set_val(PS4_CIRCLE, 0);
wait(60);
set_val(PS4_CIRCLE, 100);
wait(50);
set_val(PS4_CIRCLE, 100);
set_val(PS4_CROSS, 100);
wait(60);
set_val(PS4_CIRCLE, 0);
set_val(PS4_CROSS, 100);
wait(10);
set_val(PS4_CROSS, 0);
wait(0);
}
combo CANCEL_SLIDE_CW {
set_val(PS4_CIRCLE, 100);
wait(CW_Slide_Delay);
set_val(PS4_CIRCLE, 0);
wait(20);
set_val(PS4_L3, 0);
set_val(PS4_L2, 100);
wait(10);
set_val(PS4_L2, 0);
set_val(PS4_CIRCLE, 100);
set_val(PS4_L3, 100);
wait(20);
set_val(PS4_CIRCLE, 0);
set_val(PS4_L3, 0);
wait(20);
}
combo cBunnyHop {
set_val(PS4_CROSS, 100);
wait(56);
set_val(PS4_CROSS, 0);
wait(56);
set_val(PS4_CROSS, 100);
wait(56);
set_val(PS4_CROSS, 0);
wait(56);
}
combo Turbo__Melee {
set_val(PS4_R3, 100);
wait(56);
set_val(PS4_R3, 0);
wait(48);
}
combo cRapidFire {
set_val(PS4_R2, 100);
wait(52);
set_val(PS4_R2, 0);
wait(28);
}
combo auto_sprint {
SPRINTING = TRUE;
set_val(PS4_L3, 100);
wait(30);
wait(116);
}
/* Credit: Eternal Dahaka
I made a little change, Thank you
https://www.desmos.com/calculator/1twwnifmmg
*/
void Ballistic_Curve(fix32 dead, fix32 antiCDead, fix32 antiSDead, fix32 outerDeadIn, fix32 outerDeadOut, fix32 deg, fix32 angleRestrict, fix32 angular, bool uncap, fix32 *Stick_X, fix32 *Stick_Y) {
fix32 x = (*Stick_X)/100.0;
fix32 y = (*Stick_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
//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) ) );
//Angular Restriction
if((angle > 0.0) && (angle < angleRestrict/2.0)){angle = 0.00;}
if(angle > 90.0 - angleRestrict/2.0 && angle < 90.0){angle = 90.0;}
if((angle > angleRestrict/2.0) && (angle < (90.0 - angleRestrict/2.0))){
angle = ((angle - angleRestrict/2.0)*(90.0))/((90.0 - angleRestrict/2.0) - angleRestrict/2.0);
}
fix32 refAngle = angle;
if(refAngle < 0.001){refAngle = 0.0;}
//Angular Restriction Countering
if(angle < 90.0 && angle > 0.0){
angle = ((angle - 0.0)*((90.0 - (angular/2.0)) - (angular/2.0)))/(90.0) + (angular/2.0);
}
//Flipping angles back to correct quadrant
if(x < 0.0 && y > 0.0){angle = -angle;}
if(x > 0.0 && y < 0.0){angle = angle - 180.0;}
if(x < 0.0 && y < 0.0){angle = angle + 180.0;}
//~~~~~~~~~~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 = cos(deg2rad(angle))*outputMagnitude;
fix32 newY = sin(deg2rad(angle))*outputMagnitude;
//Magic angle wobble fix by user ME.
if (angle > 45.0 && angle < 225.0) {
newX = inv(sin(deg2rad(angle - 90.0)))*outputMagnitude;
newY = inv(cos(deg2rad(angle - 270.0)))*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
*Stick_X = clamp(outputX*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
*Stick_Y = clamp(outputY*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
}
else{
*Stick_X = 0.0;
*Stick_Y = 0.0;
}
}
fix32 Get_Anti_Recoil(int8 button, fix32 ar, fix32 consistant_ar, uint16 timeout)
{
if(is_active(button))
{
if(time_active(button) <= timeout)
{
return ar;
}
else
{
return consistant_ar;
}
}
return 0.0;
}
fix32 Get_Steady_Aim(fix32 axis_val, fix32 resolution )
{
int16 i16_axis_val = (int16)(axis_val * 100.0);
int16 i16_resolution = (int16)(resolution * 100.0);
return ((fix32)((i16_axis_val/i16_resolution) * i16_resolution))/100.0;
}
void ColorLED(char Color) {
fix32 Color1, Color2, Color3, Color4;
if(Color == 'B') {Color1 = 100.0; Color2 = 0.00; Color3 = 0.00; Color4 = 0.00;}
if(Color == 'R') {Color1 = 0.00; Color2 = 100.0; Color3 = 0.00; Color4 = 0.00;}
if(Color == 'G') {Color1 = 0.00; Color2 = 0.00; Color3 = 100.0; Color4 = 0.00;}
if(Color == 'P') {Color1 = 0.00; Color2 = 0.00; Color3 = 0.00; Color4 = 100.0;}
if(Color == 'C') {Color1 = 100.0; Color2 = 0.00; Color3 = 100.0; Color4 = 0.00;}
if(Color == 'A') {Color1 = 0.00; Color2 = 100.0; Color3 = 100.0; Color4 = 0.00;}
if(Color == 'W') {Color1 = 100.0; Color2 = 100.0; Color3 = 100.0; Color4 = 100.0;}
led_set(LED_1, Color1, 0);
led_set(LED_2, Color2, 0);
led_set(LED_3, Color3, 0);
led_set(LED_4, Color4, 0);
return;
}
#endif
-
minataur07 - Sergeant First Class
- Posts: 25
- Joined: Sat Jun 20, 2020 7:42 pm
Re: Help with autorun on this script please
It's working, pushing the left stick forward spams left stick click for sprinting.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4532
- Joined: Wed May 22, 2019 5:39 am
Re: Help with autorun on this script please
Is there any way to alter it to 100% at the slightest touch rather than click mate? My astro c40 struggles and the run is hard to activate :(
-
minataur07 - Sergeant First Class
- Posts: 25
- Joined: Sat Jun 20, 2020 7:42 pm
Re: Help with autorun on this script please
Tried altering myself but get errors:(
-
minataur07 - Sergeant First Class
- Posts: 25
- Joined: Sat Jun 20, 2020 7:42 pm
Re: Help with autorun on this script please
This part:
Try editing where it says 80.0 (meaning 80%) to 15.0 (15%). Like so:
- Code: Select all
uint8 Auto_Sprint = TRUE; // Set to TRUE for Auto Sprint
fix32 THRESHOLD = 80.0;
Try editing where it says 80.0 (meaning 80%) to 15.0 (15%). Like so:
- Code: Select all
uint8 Auto_Sprint = TRUE; // Set to TRUE for Auto Sprint
fix32 THRESHOLD = 15.0;
-
TheBruhhh - First Sergeant
- Posts: 65
- Joined: Sun Nov 24, 2019 1:28 pm
Re: Help with autorun on this script please
Ok mate thanks, I'll give it a go .
-
minataur07 - Sergeant First Class
- Posts: 25
- Joined: Sat Jun 20, 2020 7:42 pm
6 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 101 guests