Combine individual scripts into ONE larger script

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

Combine individual scripts into ONE larger script

Postby CYI30RG » Fri Apr 12, 2019 6:30 pm

Hi crew!!! does anyone have tutorials or tutorial videos on how to combine individual scripts into one larger working script? also i need to know how to add a hotkey toggle on/off.

any and all relevant replies respected and appreciated.

NOTE: for bf4 xbox one i want to add the crouchfire spam script that was given to me to hardcore gamers bf4 gamepack...but with an on and off feature....lets say double clicking left analog stick.

on THIS SCRIPT I WANT TO ADD THE INDIVIDUAL SCRIPT (AT BOTTOM OF THIS POST):
Code: Select all
//                      _____   _____   _   _  
//                     |  _  \ |  ___| | | | |
//                     | |_| | | |__   | |_| |
//                     |  _  { |  __|  \___  |
//                     | |_| | | |         | |
//                     |_____/ |_|         |_|                         
//
// RapidFire On|Off LED / AutoRun / AutoSpot On|Off LED / AutoBreath 
//                              Anti-Recoil
//-------------------------------------------------------------------
/****************************************************************
 *  Author:HardCoreGamer                                        *
 *  Version:2.0                                                 *
 *  Published @ Consoletuner.com                                *
 ****************************************************************/

//--------------------------------------------------------------------
//Hold VIEW , then hold MENU to turn RAPIDFIRE  ON / OFF.                       
//If RAPIDFIRE is ON the LED Should turn Purple, If LED 1 goes off it turns blue
//The opposite if RAPIDFIRE is OFF.
//
//Tap RB for XB1 - PS4 Tap R1 - XB360 Tap Back - PS3 Tap Select to turn autsopt on/off.
//
//I added LED to autospot so you can tell easier if you have autospot on or off.
//
//When auto spot is on its turns color cyan and when it's off it turns back to its default
//color which is blue, and when both mods are on your gonna see the color light cyan and
//puple slowly blinking if you don't  want LED on auto spot you can simply just remove
//set_led(3, 0) and set_led(3, 1) from combo AutoSpot {, it should be at the end.
//
//Remember to disable autospot when you die beacuse if you don't your weapon class
//menu will start acting up.
//---------------------------------------------------------------------                                           
 
define RATE_OF_FIRE=20; //Range: 1 to 25 RPS (Round/s)             
define SPOT=900; //auto-spot modifier
define SPOT_BUTTON=3; //XB1_RB - PS4_R1
define ANTI_RECOIL=35; //change this value to compensate to the vertical recoil
define ANTI_RECOIL_LEFT=0; //change this value to compensate to the left
define ANTI_RECOIL_RIGHT=0; //change this value to compensate to the right
define ONLY_WITH_SCOPE=TRUE; //Use Anti-recoil only when scoping
 
int rapid_onoff=TRUE;
int fire_button;
int scope_button;
int hold_time;
int rest_time;
int autospot=FALSE;
int anti_recoil;
int anti_recoil_left;
int anti_recoil_right;
 
init {
if(get_console() == PIO_PS3) {
fire_button = 3;
scope_button = 6;}
else { // Natural Trigger & Bumper
fire_button = 4;
scope_button = 7;}
hold_time = 500 / RATE_OF_FIRE;
rest_time = hold_time - 20;
if(rest_time < 0) rest_time=0;
}
 
main {
set_led(LED_1, 1);
set_led(LED_3, 0);
set_led(LED_4, 0);
 
 
    if(get_val(XB1_VIEW) && event_press(XB1_MENU)) {
       rapid_onoff = !rapid_onoff;
    }
    if(rapid_onoff) {
       set_led(LED_1, 0);
       set_led(LED_4, 1);
    }
     if(get_val(fire_button) && rapid_onoff) {combo_run(RAPID_FIRE);}
     else if(combo_running(RAPID_FIRE)) {combo_stop(RAPID_FIRE);}
 
if(get_val(12) < -20) {set_val(8, 100)}
else if(get_val(12) > -20) { set_val(8, 0)}
// AUTOSPOT tap (XB360 BACK -PS3_SELECT ) to turn on/off AutoSpot
if(event_release(3) && get_ptime(3) < 1000) {autospot = !autospot;set_val(1,0);}
if ((autospot && !get_val(SPOT_BUTTON)) && (SPOT > 0 )) combo_run(AutoSpot);
if(get_val(7) > 10) {combo_run(AutoBreath);}
if(get_val(7) < 10) {combo_stop(AutoBreath);}
 
if(!ONLY_WITH_SCOPE || get_val(scope_button)) {combo_run(AntiRecoil);}
}
 
combo RAPID_FIRE {
set_val(fire_button, 100);
wait(hold_time);
set_val(fire_button, 0);
wait(rest_time);
set_val(fire_button, 0);
}
 
combo AutoSpot {
set_led(LED_3, 0);
set_val(SPOT_BUTTON, 100);
wait(50);
set_led(LED_3, 1);
set_val(SPOT_BUTTON, 0);
wait(SPOT);
}
 
combo AutoBreath {
wait(200);
set_val(8, 100);
wait(4000);
}
 
combo AntiRecoil {
if(get_val(fire_button)) {
anti_recoil = get_val(10) + ANTI_RECOIL;
if(anti_recoil > 100) anti_recoil = 100;
set_val(10, anti_recoil);
anti_recoil_left = get_val(9) -ANTI_RECOIL_LEFT;
if(anti_recoil_left > 100) anti_recoil_left = 100;
set_val(9, anti_recoil_left);
anti_recoil_right = get_val(9) +ANTI_RECOIL_RIGHT;
if(anti_recoil_right > 100) anti_recoil_right = 100;
set_val(9, anti_recoil_right);}
}


******************** I WANT TO ADD THIS SCRIPT TO THE ABOVE:

Code: Select all
define CROUCH_SPAM_SPEED = 95;
 
main {
    if(get_val(XB1_LT) && get_val(XB1_RT)) {
        combo_run(CrouchSpam);
    }
}
 
 
combo CrouchSpam {
    set_val(XB1_B, 100);
    wait(40);
    wait(CROUCH_SPAM_SPEED);
}
User avatar
CYI30RG
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Tue Apr 09, 2019 5:58 pm

Re: Combine individual scripts into ONE larger script

Postby antithesis » Sat Apr 13, 2019 12:32 am

That's easy. Just put the define with the other defines, put the if statement from main into main (don't include main { and the closing } ) and the combo with the other combos.

All you need is a little gumption to try it yourself. Note that all braces are balanced, i.e for every { there's a matching } at the end of a statement.
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Combine individual scripts into ONE larger script

Postby CYI30RG » Sat Apr 13, 2019 8:36 am

antithesis wrote:That's easy. Just put the define with the other defines, put the if statement from main into main (don't include main { and the closing } ) and the combo with the other combos.

All you need is a little gumption to try it yourself. Note that all braces are balanced, i.e for every { there's a matching } at the end of a statement.


ive tried that. refer to this post: viewtopic.php?f=4&t=12332

i tried several different ways. i am VERY NO0B to script and can only do minor editing.
User avatar
CYI30RG
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Tue Apr 09, 2019 5:58 pm

Re: Combine individual scripts into ONE larger script

Postby J2Kbr » Tue Apr 16, 2019 9:27 am

Scripts combined:
Code: Select all
// _____ _____ _ _
// | _ \ | ___| | | | |
// | |_| | | |__ | |_| |
// | _ { | __| \___ |
// | |_| | | | | |
// |_____/ |_| |_|
//
// RapidFire On|Off LED / AutoRun / AutoSpot On|Off LED / AutoBreath
// Anti-Recoil
//-------------------------------------------------------------------
/****************************************************************
* Author:HardCoreGamer *
* Version:2.0 *
* Published @ Consoletuner.com *
****************************************************************/

//--------------------------------------------------------------------
//Hold VIEW , then hold MENU to turn RAPIDFIRE ON / OFF.
//If RAPIDFIRE is ON the LED Should turn Purple, If LED 1 goes off it turns blue
//The opposite if RAPIDFIRE is OFF.
//
//Tap RB for XB1 - PS4 Tap R1 - XB360 Tap Back - PS3 Tap Select to turn autsopt on/off.
//
//I added LED to autospot so you can tell easier if you have autospot on or off.
//
//When auto spot is on its turns color cyan and when it's off it turns back to its default
//color which is blue, and when both mods are on your gonna see the color light cyan and
//puple slowly blinking if you don't want LED on auto spot you can simply just remove
//set_led(3, 0) and set_led(3, 1) from combo AutoSpot {, it should be at the end.
//
//Remember to disable autospot when you die beacuse if you don't your weapon class
//menu will start acting up.
//---------------------------------------------------------------------
 
define CROUCH_SPAM_SPEED = 95;
 
define RATE_OF_FIRE=20; //Range: 1 to 25 RPS (Round/s)
define SPOT=900; //auto-spot modifier
define SPOT_BUTTON=3; //XB1_RB - PS4_R1
define ANTI_RECOIL=35; //change this value to compensate to the vertical recoil
define ANTI_RECOIL_LEFT=0; //change this value to compensate to the left
define ANTI_RECOIL_RIGHT=0; //change this value to compensate to the right
define ONLY_WITH_SCOPE=TRUE; //Use Anti-recoil only when scoping
 
int rapid_onoff=TRUE;
int fire_button;
int scope_button;
int hold_time;
int rest_time;
int autospot=FALSE;
int anti_recoil;
int anti_recoil_left;
int anti_recoil_right;
 
init {
if(get_console() == PIO_PS3) {
fire_button = 3;
scope_button = 6;}
else { // Natural Trigger & Bumper
fire_button = 4;
scope_button = 7;}
hold_time = 500 / RATE_OF_FIRE;
rest_time = hold_time - 20;
if(rest_time < 0) rest_time=0;
}
 
main {
set_led(LED_1, 1);
set_led(LED_3, 0);
set_led(LED_4, 0);
 
 
if(get_val(XB1_VIEW) && event_press(XB1_MENU)) {
rapid_onoff = !rapid_onoff;
}
if(rapid_onoff) {
set_led(LED_1, 0);
set_led(LED_4, 1);
}
if(get_val(fire_button) && rapid_onoff) {combo_run(RAPID_FIRE);}
else if(combo_running(RAPID_FIRE)) {combo_stop(RAPID_FIRE);}
 
if(get_val(12) < -20) {set_val(8, 100)}
else if(get_val(12) > -20) { set_val(8, 0)}
// AUTOSPOT tap (XB360 BACK -PS3_SELECT ) to turn on/off AutoSpot
if(event_release(3) && get_ptime(3) < 1000) {autospot = !autospot;set_val(1,0);}
if ((autospot && !get_val(SPOT_BUTTON)) && (SPOT > 0 )) combo_run(AutoSpot);
if(get_val(7) > 10) {combo_run(AutoBreath);}
if(get_val(7) < 10) {combo_stop(AutoBreath);}
 
if(!ONLY_WITH_SCOPE || get_val(scope_button)) {combo_run(AntiRecoil);}
 
if(get_val(XB1_LT) && get_val(XB1_RT)) {
combo_run(CrouchSpam);
}
}
 
combo RAPID_FIRE {
set_val(fire_button, 100);
wait(hold_time);
set_val(fire_button, 0);
wait(rest_time);
set_val(fire_button, 0);
}
 
combo AutoSpot {
set_led(LED_3, 0);
set_val(SPOT_BUTTON, 100);
wait(50);
set_led(LED_3, 1);
set_val(SPOT_BUTTON, 0);
wait(SPOT);
}
 
combo AutoBreath {
wait(200);
set_val(8, 100);
wait(4000);
}
 
combo AntiRecoil {
if(get_val(fire_button)) {
anti_recoil = get_val(10) + ANTI_RECOIL;
if(anti_recoil > 100) anti_recoil = 100;
set_val(10, anti_recoil);
anti_recoil_left = get_val(9) -ANTI_RECOIL_LEFT;
if(anti_recoil_left > 100) anti_recoil_left = 100;
set_val(9, anti_recoil_left);
anti_recoil_right = get_val(9) +ANTI_RECOIL_RIGHT;
if(anti_recoil_right > 100) anti_recoil_right = 100;
set_val(9, anti_recoil_right);}
}
 
combo CrouchSpam {
set_val(XB1_B, 100);
wait(40);
wait(CROUCH_SPAM_SPEED);
}
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: Combine individual scripts into ONE larger script

Postby CYI30RG » Tue Apr 16, 2019 12:39 pm

JTBR what determines when to use a double closing bracket versus a single close bracket?

i will try script now...thank you for taking the time :)
User avatar
CYI30RG
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Tue Apr 09, 2019 5:58 pm


Return to Gtuner Pro Support

Who is online

Users browsing this forum: No registered users and 25 guests