Rapid Fire Single and Akimbo with toggle

Starts off with single rapid fire. Up on the D-pad will switch to akimbo rapid fire. From there, up on the D-pad again will switch back to regular rapid fire. Thumbs up if you like the script!
Version1.10
AuthorGLaDOS
Publish DateMon, 13 Jan 2014 - 00:49
Last UpdateMon, 13 Jan 2014 - 03:58
Downloads271
RATE


2

1

Release Notes: Up on the D-pad toggles akimbo/single rapid fire. *Fixed issue where it would toggle to akimbo, but wouldn't toggle back. ***Special Thanks to EODCM over at the cronusmax forums for helping me out with this script! He fixed a lot of my errors.
Code: Select all
define RAPIDFIRE_BUTTON1 = XB360_RT;
    define RAPIDFIRE_BUTTON2 = XB360_LT;
 
    define RATE_OF_FIRE1 = 20// Range: 1 to 25 RPS (Round/s)
    define RATE_OF_FIRE2 = 20// Values higher than 25 would be so
    int akimbo_onoff = FALSE;
                                // fast that the game probably will
                                // not detect 100% of the events.
 
    //
    // No need to make changes in the code below.
    //
 
    int hold_time1, rest_time1;
    int hold_time2, rest_time2;
 
    init {
        hold_time1 = 500 / RATE_OF_FIRE1;
        rest_time1 = hold_time1 - 20;
        if(rest_time1 < 0) rest_time1 = 0;
 
        hold_time2 = 500 / RATE_OF_FIRE2;
        rest_time2 = hold_time2 - 20;
        if(rest_time2 < 0) rest_time2 = 0;
    }
 
    main {
 
 
        if(get_val(RAPIDFIRE_BUTTON1)) {
            combo_run(RapidFire1);
        } else if(combo_running(RapidFire1)) {
            combo_stop(RapidFire1);
        }
 
        if(event_press(XB360_UP)){
          akimbo_onoff = !akimbo_onoff;
            if(akimbo_onoff){
              set_val(TRACE_1, 1); //1  = akimbo_onoff is TRUE, 0 = rap[id_onoff is FALSE
            }else if(!akimbo_onoff){
              set_val(TRACE_1, 0); //akimbo_onoff = FALSE
            }
} 
 
    if(get_val(RAPIDFIRE_BUTTON2) && akimbo_onoff) { //Now Looks for a "TRUE" value of rapid_onoff and turns on rapid fire on the left trigger accordingly
        combo_run(RapidFire2);
    } else if(combo_running(RapidFire2)) {
        combo_stop(RapidFire2);
    }
}
    combo RapidFire1 {
        set_val(RAPIDFIRE_BUTTON1, 100);
        wait(hold_time1);
        set_val(RAPIDFIRE_BUTTON1, 0);
        wait(rest_time1);
        set_val(RAPIDFIRE_BUTTON1, 0);
    }
 
    combo RapidFire2 {
        set_val(RAPIDFIRE_BUTTON2, 100);
        wait(hold_time2);
        set_val(RAPIDFIRE_BUTTON2, 0);
        wait(rest_time2);
        set_val(RAPIDFIRE_BUTTON2, 0);
    }