i need help with script

Forum to discuss the scripts, configs and connection of XIM with the Titan devices.

Moderator: antithesis

i need help with script

Postby TheOne » Tue Dec 18, 2018 9:08 pm

hi

i need help with script

i use this 2 script ( antithesis Antirecoil & Autofire ) for 2 a weapon

i want it only work with ADS

and make switch between them when i prss (Triangle)

and it possible to make display info at device monitor

1st
Code: Select all
#pragma METAINFO("antithesis Antirecoil & Autofire", 1, 00, "antithesis")
 
 
 //------------------------------------------------------------------------------
// ANTI-RECOIL
fix32 RECOIL_V = 27.5;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
//------------------------------------------------------------------------------
// APEX DEADZONE REMOVER
fix32 StickNoise = 4.32;
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
    // Fine-tune the time between single shots, set to 10 shots / sec by default (100ms)
    uint8 RapidHold = 30; // Hold the button in ms
    uint8 RapidRest = 30; // Release the button in ms
 
main {
 
    if (get_val (BUTTON_5)) // only active when firing to allow for microaim adjustments without the input being filtered
    {   
        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 (get_val (BUTTON_5)) //antirecoil only active when firing
    {   
        combo_run(RapidFire);
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
}
 
combo RapidFire
{   
    set_val(BUTTON_5, 100);
    wait(RapidHold);
    set_val(BUTTON_5, 0);
    wait(RapidRest);
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
 
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (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));
        }
    }
}


2nd

Code: Select all
#pragma METAINFO("antithesis Antirecoil & Autofire", 1, 00, "antithesis")
 
 
 //------------------------------------------------------------------------------
// ANTI-RECOIL
fix32 RECOIL_V = 18.1;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
//------------------------------------------------------------------------------
// APEX DEADZONE REMOVER
fix32 StickNoise = 4.32;
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
    // Fine-tune the time between single shots, set to 10 shots / sec by default (100ms)
    uint8 RapidHold = 50; // Hold the button in ms
    uint8 RapidRest = 50; // Release the button in ms
 
main {
 
    if (get_val (BUTTON_5)) // only active when firing to allow for microaim adjustments without the input being filtered
    {   
        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 (get_val (BUTTON_5)) //antirecoil only active when firing
    {   
        combo_run(RapidFire);
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
}
 
combo RapidFire
{   
    set_val(BUTTON_5, 100);
    wait(RapidHold);
    set_val(BUTTON_5, 0);
    wait(RapidRest);
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
 
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (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));
        }
    }
}
User avatar
TheOne
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Mon Aug 13, 2018 7:43 pm

Re: i need help with script

Postby J2Kbr » Fri Dec 21, 2018 8:33 am

I added this logic to the first script:
Code: Select all
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        if(toggle) {
            RECOIL_V = 18.1;
            RECOIL_H = 0.0;
            RapidHold = 50;
            RapidRest = 50;
        } else {
            RECOIL_V = 27.5;
            RECOIL_H = 0.0;
            RapidHold = 30;
            RapidRest = 30;
        }
    }

If the Triangle is pressed it changes the anti-recoil and rapidfire configuration according the two posted scripts.

Full script:
Code: Select all
#pragma METAINFO("antithesis Antirecoil & Autofire", 1, 00, "antithesis")
 
 
 //------------------------------------------------------------------------------
// ANTI-RECOIL
fix32 RECOIL_V = 27.5;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
//------------------------------------------------------------------------------
// APEX DEADZONE REMOVER
fix32 StickNoise = 4.32;
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
// Fine-tune the time between single shots, set to 10 shots / sec by default (100ms)
uint8 RapidHold = 30; // Hold the button in ms
uint8 RapidRest = 30; // Release the button in ms
 
bool toggle;
 
main {
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        if(toggle) {
            RECOIL_V = 18.1;
            RECOIL_H = 0.0;
            RapidHold = 50;
            RapidRest = 50;
        } else {
            RECOIL_V = 27.5;
            RECOIL_H = 0.0;
            RapidHold = 30;
            RapidRest = 30;
        }
    }
 
    if (get_val (BUTTON_5)) // only active when firing to allow for microaim adjustments without the input being filtered
    {   
        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 (get_val (BUTTON_5)) //antirecoil only active when firing
    {   
        combo_run(RapidFire);
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
}
 
combo RapidFire
{   
    set_val(BUTTON_5, 100);
    wait(RapidHold);
    set_val(BUTTON_5, 0);
    wait(RapidRest);
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
 
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (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));
        }
    }
}
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: i need help with script

Postby TheOne » Fri Dec 21, 2018 11:07 am

Code: Select all
#pragma METAINFO("antithesis Antirecoil & Autofire", 1, 00, "antithesis")
 
 
 //------------------------------------------------------------------------------
// ANTI-RECOIL
fix32 RECOIL_V = 27.5;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
//------------------------------------------------------------------------------
// APEX DEADZONE REMOVER
fix32 StickNoise = 4.32;
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
// Fine-tune the time between single shots, set to 10 shots / sec by default (100ms)
uint8 RapidHold = 30; // Hold the button in ms
uint8 RapidRest = 30; // Release the button in ms
 
bool toggle;
 
main {
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        if(toggle) {
            RECOIL_V = 18.1;
            RECOIL_H = 0.0;
            RapidHold = 50;
            RapidRest = 50;
        } else {
            RECOIL_V = 27.5;
            RECOIL_H = 0.0;
            RapidHold = 30;
            RapidRest = 30;
        }
    }
 
    if (get_val (BUTTON_5)) // only active when firing to allow for microaim adjustments without the input being filtered
    {   
        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 (get_val (BUTTON_5)) //antirecoil only active when firing
    {   
        combo_run(RapidFire);
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
}
 
combo RapidFire
{   
    set_val(BUTTON_5, 100);
    wait(RapidHold);
    set_val(BUTTON_5, 0);
    wait(RapidRest);
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
 
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (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));
        }
    }
}


Thanks J2Kbr

can u plz add display info at device monitor like ( lighting on/off in device ) ( or number)

i use it in game like pubg some time i get confused .. info in device monitor will help
Last edited by TheOne on Fri Dec 21, 2018 7:04 pm, edited 1 time in total.
User avatar
TheOne
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Mon Aug 13, 2018 7:43 pm

Re: i need help with script

Postby J2Kbr » Fri Dec 21, 2018 3:16 pm

Added a visual feedback: BLUE for the first configuration, and RED to the second: :smile0517:
Code: Select all
#pragma METAINFO("antithesis Antirecoil & Autofire", 1, 00, "antithesis")
 
//------------------------------------------------------------------------------
// ANTI-RECOIL
fix32 RECOIL_V = 27.5;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
//------------------------------------------------------------------------------
// APEX DEADZONE REMOVER
fix32 StickNoise = 4.32;
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
// Fine-tune the time between single shots, set to 10 shots / sec by default (100ms)
uint8 RapidHold = 30; // Hold the button in ms
uint8 RapidRest = 30; // Release the button in ms
 
bool toggle;
 
main {
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        led_reset();
        if(toggle) {
            RECOIL_V = 18.1;
            RECOIL_H = 0.0;
            RapidHold = 50;
            RapidRest = 50;
            led_set(LED_2, -1.0, 0);
        } else {
            RECOIL_V = 27.5;
            RECOIL_H = 0.0;
            RapidHold = 30;
            RapidRest = 30;
            led_set(LED_1, -1.0, 0);
        }
    }
 
    if (get_val (BUTTON_5)) // only active when firing to allow for microaim adjustments without the input being filtered
    {   
        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 (get_val (BUTTON_5)) //antirecoil only active when firing
    {   
        combo_run(RapidFire);
        AntiRecoil(STICK_1_Y, RECOIL_V);
        AntiRecoil(STICK_1_X, RECOIL_H);
    }
}
 
combo RapidFire
{   
    set_val(BUTTON_5, 100);
    wait(RapidHold);
    set_val(BUTTON_5, 0);
    wait(RapidRest);
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
 
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (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));
        }
    }
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: i need help with script

Postby TheOne » Fri Dec 21, 2018 7:04 pm

Thanks so much . u the best :)
User avatar
TheOne
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Mon Aug 13, 2018 7:43 pm

Re: i need help with script

Postby TheOne » Fri Jan 11, 2019 11:17 pm

can u plz add : [ Turn ON/OFF ] script when i [ HOLD (TouchPad) and Press (PS) ] with light off when script off

Code: Select all
#pragma METAINFO("antithesis Antirecoil & Autofire", 1, 00, "antithesis")
 
//------------------------------------------------------------------------------
// ANTI-RECOIL
fix32 RECOIL_V = 27.5;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
//------------------------------------------------------------------------------
// APEX DEADZONE REMOVER
fix32 StickNoise = 4.32;
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
// Fine-tune the time between single shots, set to 10 shots / sec by default (100ms)
uint8 RapidHold = 30; // Hold the button in ms
uint8 RapidRest = 30; // Release the button in ms
 
bool toggle;
 
main {
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        led_reset();
        if(toggle) {
            RECOIL_V = 18.1;
            RECOIL_H = 0.0;
            RapidHold = 50;
            RapidRest = 50;
            led_set(LED_1, -1.0, 0);
        } else {
            RECOIL_V = 27.5;
            RECOIL_H = 0.0;
            RapidHold = 30;
            RapidRest = 30;
            led_set(LED_3, -1.0, 0);
        }
    }
 
    if (get_val (BUTTON_8)) // only active when firing to allow for microaim adjustments without the input being filtered
    {
        if (get_val (BUTTON_5))   
 
        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 (get_val (BUTTON_8)) //while holding ADS
    {
        if (get_val (BUTTON_5))   // while holding SHOOT
 
        combo_run(RapidFire);
        AntiRecoil(STICK_1_Y, RECOIL_V);
        AntiRecoil(STICK_1_X, RECOIL_H);
    }
}
 
combo RapidFire
{   
    set_val(BUTTON_5, 100);
    wait(RapidHold);
    set_val(BUTTON_5, 0);
    wait(RapidRest);
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
 
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (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));
        }
    }
}
 
User avatar
TheOne
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Mon Aug 13, 2018 7:43 pm

Re: i need help with script

Postby J2Kbr » Mon Jan 14, 2019 11:22 am

TheOne wrote:can u plz add : [ Turn ON/OFF ] script when i [ HOLD (TouchPad) and Press (PS) ] with light off when script off

Done. ;)
Code: Select all
#pragma METAINFO("antithesis Antirecoil & Autofire", 1, 00, "antithesis")
 
//------------------------------------------------------------------------------
// ANTI-RECOIL
fix32 RECOIL_V = 27.5;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
//------------------------------------------------------------------------------
// APEX DEADZONE REMOVER
fix32 StickNoise = 4.32;
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
// Fine-tune the time between single shots, set to 10 shots / sec by default (100ms)
uint8 RapidHold = 30; // Hold the button in ms
uint8 RapidRest = 30; // Release the button in ms
 
bool toggle;
bool general_toggle;
 
main {
    if(get_actual(BUTTON_2)) {
       if(event_active(BUTTON_1)) {
           general_toggle = !general_toggle;
       }
       set_val(BUTTON_1, 0.0);
    }
    if(general_toggle) {
        if(event_active(BUTTON_14)) {
            toggle = !toggle;
            led_reset();
            if(toggle) {
                RECOIL_V = 18.1;
                RECOIL_H = 0.0;
                RapidHold = 50;
                RapidRest = 50;
                led_set(LED_1, -1.0, 0);
            } else {
                RECOIL_V = 27.5;
                RECOIL_H = 0.0;
                RapidHold = 30;
                RapidRest = 30;
                led_set(LED_3, -1.0, 0);
            }
        }
 
        if (get_val (BUTTON_8)) // only active when firing to allow for microaim adjustments without the input being filtered
        {
            if (get_val (BUTTON_5))   
 
            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 (get_val (BUTTON_8)) //while holding ADS
        {
            if (get_val (BUTTON_5))   // while holding SHOOT
 
            combo_run(RapidFire);
            AntiRecoil(STICK_1_Y, RECOIL_V);
            AntiRecoil(STICK_1_X, RECOIL_H);
        }
    }
}
 
combo RapidFire
{   
    set_val(BUTTON_5, 100);
    wait(RapidHold);
    set_val(BUTTON_5, 0);
    wait(RapidRest);
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
 
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (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));
        }
    }
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to XIM Apex, XIM4, XIM Edge with Titan devices

Who is online

Users browsing this forum: No registered users and 53 guests

cron