Combo Recorder

This script allows for recording combos up to 14 buttons long. However, the user will have to modify wait times between the button presses manually via the D pad buttons. Please see the script comments for instructions on how to operate this script. YOUR COMBO WILL BE SAVED WHILE THE DEVICE IS ON ANOTHER SCRIPT OR EVEN POWERED OFF
Version2.0
AuthorElvish
Publish DateSun, 30 Aug 2015 - 20:13
Last UpdateSun, 30 Aug 2015 - 20:13
Downloads170
RATE


3

0

Release Notes: Currently does not work for Analog sticks.
Code: Select all
/*
Combo Recorder
Version: 2
Author: Elvish
 
    Start Recording
        1. Xbox- Right Trigger, Right Bumper, Left Trigger, Left Bumper)
           PS4 - R2, R1, L2, L1
        2. The controller will vibrate 3 times indicating it is now time to record your button presses
        3. Press each button you want to be pressed in your combo (up to 14 buttons)
        4. If you wish to record less then 14 buttons hold down the last button you want to record for about 2 seconds
            -The controller will vibrate to tell you recording is finished.
        5. Otherwise recording will be turned off once you press the 14th button
 
    Play back combo
        1. Press A(Xbox) or Cross(PS4) to toggle combo on/off
        2. Wait time modifiers:
            D Pad Up - Add 10 MS
            D Pad Right - Add 100 MS
            D Pad Down - Subtract 10 MS
            D Pad Left - Subtract 100 MS
*/

 
int Button_IDs[13];
int Button_Held = 0;
int Button_Pressed;
int Index = 0;
int Wait_Time = 100;
int Recording = FALSE;
 
int Waiting = FALSE;
int Display_Index = 1;
int Run_Script_On = FALSE;
 
init{
    Load_Buttons();
}
 
main {
    Button_Pressed = -1;
    if(event_press(0)){Button_Pressed = 0;}          //XB1_XBOX || PS4_PS
    else if(event_press(1)){Button_Pressed = 1;}     //XB1_VIEW || PS4_SHARE
    else if(event_press(2)){Button_Pressed = 2;}     //XB1_MENU || PS4_OPTIONS
    else if(event_press(3)){Button_Pressed = 3;}     //XB1_RB   || PS4_R1
    else if(event_press(4)){Button_Pressed = 4;}     //XB1_RT   || PS4_R2
    else if(event_press(5)){Button_Pressed = 5;}     //XB1_RS   || PS4_R3
    else if(event_press(6)){Button_Pressed = 6;}     //XB1_LB   || PS4_L1
    else if(event_press(7)){Button_Pressed = 7;}     //XB1_LT   || PS4_L2
    else if(event_press(8)){Button_Pressed = 8;}     //XB1_LS   || PS4_L3
//    else if(event_press(9)){Button_Pressed = 9;}     //XB1_RX   || PS4_RX
//    else if(event_press(10)){Button_Pressed = 10;}   //XB1_RY   || PS4_RY
//    else if(event_press(11)){Button_Pressed = 11;}   //XB1_LX   || PS4_LX
//    else if(event_press(12)){Button_Pressed = 12;}   //XB1_LY   || PS4_LY
    else if(event_press(13)){Button_Pressed = 13;}   //XB1_UP   || PS4_UP
    else if(event_press(14)){Button_Pressed = 14;}   //XB1_DOWN || PS4_DOWN
    else if(event_press(15)){Button_Pressed = 15;}   //XB1_LEFT || PS4_LEFT
    else if(event_press(16)){Button_Pressed = 16;}   //XB1_RIGHT|| PS4_RIGHT
    else if(event_press(17)){Button_Pressed = 17;}   //XB1_Y    || PS4_TRIANGLE
    else if(event_press(18)){Button_Pressed = 18;}   //XB1_B    || PS4_CIRCLE
    else if(event_press(19)){Button_Pressed = 19;}   //XB1_A    || PS4_CROSS
    else if(event_press(20)){Button_Pressed = 20;}   //XB1_X    || PS4_SQUARE
 
 
    if(Recording && !Waiting){
        if(Index >= 13 || Button_Held >= 2000){
            Recording = FALSE;
            Save_Buttons();
            combo_run(Stop_Recording);
        }
        if(get_val(0) || get_val(1) || get_val(2) || get_val(3) || get_val(4) || get_val(5) || get_val(6) || get_val(7) || get_val(8) || /*get_val(9) || get_val(10) || get_val(11) || get_val(12) ||*/ get_val(13) || get_val(14) || get_val(15) || get_val(16) || get_val(17) || get_val(18) || get_val(19) || get_val(20)){
            Button_Held = Button_Held + get_rtime();
        }
        else{
            Button_Held = 0;
        }
        if(Button_Pressed > -1){
            Button_IDs[Index] = Button_Pressed;
            Index = Index + 1;
        }
    }   
 
    else if(!Recording){
        if(get_val(4) && get_val(3) && get_val(7) && get_val(6)){
            Waiting = TRUE;
            Index = 0;
            combo_run(Rumble_To_Three);
        }
        if(event_press(19)){
            Run_Script_On = !Run_Script_On;
            if(!Run_Script_On && combo_running(Test_Combo)){
                combo_stop(Test_Combo);
            }
        }
        if(Run_Script_On){
            combo_run(Test_Combo);
            if(event_press(14) && Wait_Time - 10 >= 0){
                Wait_Time = Wait_Time - 10;
                set_pvar(SPVAR_15, Wait_Time);
            }
            if(event_press(15) && Wait_Time - 100 >= 0){
                Wait_Time = Wait_Time - 100;
                set_pvar(SPVAR_15, Wait_Time);
            }           
            if(event_press(13) && Wait_Time + 10 <= 4000){
                Wait_Time = Wait_Time + 10;
                set_pvar(SPVAR_15, Wait_Time);   
            }
            if(event_press(16) && Wait_Time + 100 <= 4000){
                Wait_Time = Wait_Time + 100;
                set_pvar(SPVAR_15, Wait_Time);
            }
 
            set_val(13, 0);
            set_val(14, 0);
            set_val(15, 0);
            set_val(16, 0);
        }
    }
}
 
combo Rumble_To_Three
{
    set_rumble(RUMBLE_A, 50);   wait(325);
    set_rumble(RUMBLE_A, 0);    wait(350);
    set_rumble(RUMBLE_A, 50);   wait(315);
    set_rumble(RUMBLE_A, 0);    wait(350);
    set_rumble(RUMBLE_A, 50);   wait(310);
    set_rumble(RUMBLE_A, 0);    wait(350);
    Recording = TRUE;
    Waiting = FALSE;
}
 
combo Stop_Recording
{
    set_rumble(RUMBLE_A, 50);   wait(325);
    set_rumble(RUMBLE_A, 0);    wait(350);
}
 
combo Test_Combo
{
    set_val(Button_IDs[Display_Index], 100);
    wait(Wait_Time);
    set_val(Button_IDs[Display_Index], 0);
    wait(Wait_Time);
    Display_Index = Display_Index + 1;
 
    if(Display_Index >= Index){
        Display_Index = 0;
    }
}
 
function Save_Buttons()
{
    set_pvar(SPVAR_1, Button_IDs[0]);
    set_pvar(SPVAR_2, Button_IDs[1]);
    set_pvar(SPVAR_3, Button_IDs[2]);
    set_pvar(SPVAR_4, Button_IDs[3]);
    set_pvar(SPVAR_5, Button_IDs[4]);
    set_pvar(SPVAR_6, Button_IDs[5]);
    set_pvar(SPVAR_7, Button_IDs[6]);
    set_pvar(SPVAR_8, Button_IDs[7]);
    set_pvar(SPVAR_9, Button_IDs[8]);
    set_pvar(SPVAR_10, Button_IDs[9]);
    set_pvar(SPVAR_11, Button_IDs[10]);
    set_pvar(SPVAR_12, Button_IDs[11]);
    set_pvar(SPVAR_13, Button_IDs[12]);
    set_pvar(SPVAR_14, Button_IDs[13]);
    set_pvar(SPVAR_15, Wait_Time);
    set_pvar(SPVAR_16, Index);
}
 
function Load_Buttons()
{
    Button_IDs[0] = get_pvar(SPVAR_1, 0, 20, 0);
    Button_IDs[1] = get_pvar(SPVAR_2, 0, 20, 0);
    Button_IDs[2] = get_pvar(SPVAR_3, 0, 20, 0);
    Button_IDs[3] = get_pvar(SPVAR_4, 0, 20, 0);
    Button_IDs[4] = get_pvar(SPVAR_5, 0, 20, 0);
    Button_IDs[5] = get_pvar(SPVAR_6, 0, 20, 0);
    Button_IDs[6] = get_pvar(SPVAR_7, 0, 20, 0);
    Button_IDs[7] = get_pvar(SPVAR_8, 0, 20, 0);
    Button_IDs[8] = get_pvar(SPVAR_9, 0, 20, 0);
    Button_IDs[9] = get_pvar(SPVAR_10, 0, 20, 0);
    Button_IDs[10] = get_pvar(SPVAR_11, 0, 20, 0);
    Button_IDs[11] = get_pvar(SPVAR_12, 0, 20, 0);
    Button_IDs[12] = get_pvar(SPVAR_13, 0, 20, 0);
    Button_IDs[13] = get_pvar(SPVAR_14, 0, 20, 0);
    Wait_Time = get_pvar(SPVAR_15, 0, 4000, 100);
    Index = get_pvar(SPVAR_16, 0, 13, 0);
}