Page 2 of 13

Re: Titan One to Titan Two Script Converter

PostPosted: Sat Mar 16, 2019 11:19 pm
by Buffy
Hello all, I've lowered the required JRE version required to run the JAR to increase compatibility on more PC's.

Re: T1/CM to Titan Two Script Converter

PostPosted: Tue Mar 19, 2019 3:06 pm
by doiz
Amazing work thanks

Re: T1/CM to Titan Two Script Converter [v0.18 - 03/20/2019]

PostPosted: Wed Mar 20, 2019 11:41 pm
by Kuyl
omg...this is amazing <3 :smile0517:

Re: T1/CM to Titan Two Script Converter [v0.19 - 03/21/2019]

PostPosted: Thu Mar 21, 2019 6:48 pm
by TrayDay
Man, I want to say thank you for providing this useful tool. This will certainly help many, including myself, in being able to convert some scripts over. Thanks Buffy!

Re: T1/CM to Titan Two Script Converter [v0.19 - 03/21/2019]

PostPosted: Thu Mar 21, 2019 8:09 pm
by Rayman413
This is awesome super easy to use your the best

Re: T1/CM to Titan Two Script Converter [v0.23 - 03/26/2019]

PostPosted: Mon Apr 01, 2019 10:59 pm
by guko3867
great tool thank you so much

Re: T1/CM to Titan Two Script Converter [v0.24 - 04/05/2019]

PostPosted: Fri Apr 19, 2019 4:15 pm
by AhmedEgg
thank you so much, i've been trying to find a program that does this but didnt think it was possible

thanks aloootttt

Re: T1/CM to Titan Two Script Converter [v0.24 - 04/05/2019]

PostPosted: Mon Apr 22, 2019 8:57 pm
by supermandoggo
thank you!!!!

converting script

PostPosted: Sat May 04, 2019 4:48 pm
by Darkness
Can someone please help me convert this script to the T2 ?

Code: Select all
#include <titanone.gph>
//Posted by JQuest313, a member of the community in the device Forums - https://device.com/forums
 
//Posted : Saturday 4th of May, 2019 14:53 UTC 
 
// Geras By Fwak. V.1.0.
// Big Thanks To Batts <3.
/*---------------------------------------------------------------------------------
Infinite Warden|
----------------
 
RB Adjust = Spends a Meter
RT Adjust = Spends a Second Meter
LT Adjust = Uses Fatal during Combo (Can be used during RB/RT's combo adjust)
 
---------------------------------------------------------------------------------
IF YOU WANT TO USE SECOND BAR OF METER DURING THE FIRST BAR, PRESS RT/R2 AS SOON
AS YOU SEE THE FIRST BAR GO OFF/USED.
---------------------------------------------------------------------------------
IF YOU WANT TO USE Fatal DURING FIRST METER, PRESS LT/L2 AFTER THE DASH.
---------------------------------------------------------------------------------
 
There is quite a few check points in this one (checks if it should change Combos
mid Combo), so go in practice and get the timings down.
---------------------------------------------------------------------------------
 
RS UP --------
RS Down ------    (RS DOWN + UP are same Combo)
Hold X    ------ = All 5 can use RB and RT and LT
RS Right -----
RS Left ------
 
LS Up = Easy Fatal
 
LT + R3 to changes to corner combos which there's four of and all use 2 Meters.
 
Fatality on R3.
 
-----------------------------------------------------------------------------------*/

 
 
define Y                   =  17; // TRIANGLE, Y
define B                   =  18; // CIRCLE, B 
define A                   =  19; // CROSS, A
define X                   =  20; // SQUARE, X
define RB                  =   3; // R1, RB   
define RT                  =   4; // R2, RT   
define LB                  =   6; // L1, LB   
define LT                  =   7; // L2, LT   
define TOUCH               =  27; // TOUCH PAD   
define UP                  =  13; // DPAD UP   
define DOWN                =  14; // DPAD DOWN
define LEFT                =  15; // DPAD LEFT 
define RIGHT               =  16; // DPAD RIGHT 
define MOVE_X              =  11; // LEFT ANALOG X
define MOVE_Y              =  12; // LEFT ANALOG Y
 
 
define BACK                = 128; // BACK FLAG   
define FORWARD             = 129; // FORWARD FLAG
 
// End Flags. 253, 254 and 255 should never be used in the
// data segment for other purposes.                 
//-----------------------------------------------------
define CHK_PNT          = 253// check for transition to another combo
define EOC              = 254// End of Combo     
define EOD              = 255// End of Data Segment
//-----------------------------------------------------
 
//Define Combos
//--------------------------------------
define Combo1     = 10;     
define Combo2     = 11;     
define Combo3     = 12;     
define Combo4     = 13;     
define Combo5     = 14;     
define Combo6     = 15;     
define Combo7     = 16;     
define Combo8     = 17;     
define Combo9     = 18;     
define Combo10    = 19;
define Combo11      = 26;
define Combo12      = 30;
define Punish      = 31;
define Fatality1  = 24;     
define Fatality2  = 25;     
//--------------------------------------
 
//Define Combo Adjusters
//--------------------------------------
define LB_PRESS   = 20;    //
define LT_PRESS   = 21;    //
define RB_PRESS   = 22;    //
define RT_PRESS   = 23;    //
//--------------------------------------
 
// Combo Data
//--------------------------------------
data(
 
//--------------------------------------
RT_PRESS,
1,FORWARD,100,
10,0,8,
1,FORWARD,100,
10,0,4,
1,FORWARD,100,
4,0,8,
2,FORWARD,100,
A,100,
8,
1,BACK,100,
8,
2,FORWARD,100,
X,100,
10,0,20,
1,RB,100,
10,0,73,
1,DOWN,100,
10,
2,DOWN,100,
Y,100,
20,
1,DOWN,100,
80,
2,DOWN,100,
Y,100,
10,0,55,
1,FORWARD,100,
4,0,4,
1,FORWARD,100,
4,0,43,
2,FORWARD,100,
A,100,
4,CHK_PNT,
1,BACK,100,
4,
2,FORWARD,100,
Y,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
RB_PRESS,
1,BACK,100,
8,
2,FORWARD,100,
Y,100,
10,0,80,
1,RB,100,
10,0,185,CHK_PNT,
1,FORWARD,100,
4,0,4,
1,FORWARD,100,
10,0,18,
1,B,100,
8,CHK_PNT,
1,BACK,100,
8,
2,FORWARD,100,
Y,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
LT_PRESS,
2,RT,100,
LT,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
LB_PRESS,
 
EOC,
 
//--------------------------------------
// Hold X/Square
//--------------------------------------
Punish,
1,X,100,
10,0,10,
1,X,100,
10,0,30,CHK_PNT,
1,X,100,
10,0,20,
2,X,100,
A,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
//--------------------------------------
// Right Stick RIGHT
//--------------------------------------
Combo1,
2,BACK,100,
Y,100,
10,0,10,
1,Y,100,
50,CHK_PNT,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
// Right Stick LEFT
//--------------------------------------
Combo2,
2,FORWARD,100,
Y,100,
10,0,20,
1,X,100,
10,0,20,CHK_PNT,
1,Y,100,
10,0,20,
1,DOWN,100,
10,0,20,
2,BACK,100,
Y,100,
10,0,20,
1,X,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
//--------------------------------------
// Right Stick UP
//--------------------------------------
Combo3,
1,Y,100,
10,0,18,
1,B,100,
10,0,25,CHK_PNT,
1,X,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
// Right Stick DOWN
//--------------------------------------
Combo4,
1,Y,100,
10,0,18,
1,B,100,
10,0,25,CHK_PNT,
1,X,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
// Left Stick RIGHT
//--------------------------------------
Combo5,
 
EOC,
 
//--------------------------------------
// Left Stick LEFT
//--------------------------------------
Combo6,
 
EOC,
 
 
//--------------------------------------
//Left Stick Up
//--------------------------------------
Combo7,
2,LT,100,
RT,100,
200,0,200,
EOC,
 
 
//--------------------------------------
//Left Stick Down
//--------------------------------------
Combo8,
 
EOC,
 
 
//--------------------------------------
// Right Stick RIGHT *SWITCHED*
//--------------------------------------
Combo9,
2,BACK,100,
Y,100,
10,0,20,
1,Y,100,
10,0,8,
1,BACK,100,
8,
2,FORWARD,100,
Y,100,
10,0,120,
1,RB,100,
10,0,210,
2,FORWARD,100,
Y,100,
10,0,4,
1,X,100,
10,0,4,
1,Y,100,
10,0,4,
1,BACK,100,
4,0,4,
2,FORWARD,100,
X,100,
10,0,90,
1,RB,100,
10,0,80,
2,DOWN,100,
Y,100,
10,
1,DOWN,100,
90,
2,DOWN,100,
Y,100,
10,0,30,
1,BACK,100,
75,
2,BACK,100,
X,100,
8,
1,FORWARD,100,
8,
2,BACK,100,
Y,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
//Right Stick Up *SWITCHED*
//--------------------------------------
Combo10,
1,X,100,
10,0,10,
1,X,100,
10,0,8,
1,BACK,100,
8,
2,FORWARD,100,
Y,100,
10,0,110,
1,RB,100,
10,0,223,
2,FORWARD,100,
Y,100,
10,0,4,
1,X,100,
10,0,4,
1,Y,100,
10,0,4,
1,BACK,100,
4,0,4,
2,FORWARD,100,
X,100,
10,0,90,
1,RB,100,
10,0,80,
2,DOWN,100,
Y,100,
10,
1,DOWN,100,
90,
2,DOWN,100,
Y,100,
10,0,30,
1,BACK,100,
85,
2,BACK,100,
X,100,
8,
1,FORWARD,100,
8,
2,BACK,100,
Y,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
// Right Stick LEFT *SWITCHED*
//--------------------------------------
Combo11,
2,FORWARD,100,
Y,100,
10,0,20,
1,X,100,
10,0,20,
1,Y,100,
10,0,95,
1,B,100,
10,0,8,
1,BACK,100,
8,
2,FORWARD,100,
Y,100,
10,0,80,
1,RB,100,
10,0,220,
2,BACK,100,
Y,100,
10,0,4,
1,Y,100,
10,0,4,
1,BACK,100,
4,0,4,
2,FORWARD,100,
X,100,
10,0,50,
1,RB,100,
10,0,80,
2,DOWN,100,
Y,100,
10,
1,DOWN,100,
90,
2,DOWN,100,
Y,100,
10,0,30,
1,BACK,100,
102,
2,BACK,100,
X,100,
8,
1,FORWARD,100,
8,
2,BACK,100,
Y,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
// Right Stick DONW *SWITCHED*
//--------------------------------------
Combo12,
1,Y,100,
10,0,10,
1,B,100,
10,0,8,
1,BACK,100,
8,
2,FORWARD,100,
Y,100,
10,0,110,
1,RB,100,
10,0,223,
2,FORWARD,100,
Y,100,
10,0,4,
1,X,100,
10,0,4,
1,Y,100,
10,0,4,
1,BACK,100,
4,0,4,
2,FORWARD,100,
X,100,
10,0,90,
1,RB,100,
10,0,80,
2,DOWN,100,
Y,100,
10,
1,DOWN,100,
90,
2,DOWN,100,
Y,100,
10,0,30,
1,BACK,100,
80,
2,BACK,100,
X,100,
8,
1,FORWARD,100,
8,
2,BACK,100,
Y,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
 
 
//--------------------------------------
Fatality1,
//--------------------------------------
1,RT,100,
10,0,20,
1,FORWARD,100,
10,0,4,
1,DOWN,100,
10,0,4,
1,DOWN,100,
10,0,4,
1,A,100,
10,
0,200,
0,200,
0,200,
0,200,
0,200,
EOC,
EOD );
//End Of Combo Data
//--------------------------------------
 
//Unmaps
unmap PS4_RX;
unmap PS4_RY;
unmap PS4_LX;
unmap PS4_LY;
unmap PS4_L3;
unmap PS4_R3;
 
int c, idx, i = -1, btn, v;
int back = LEFT, forward = RIGHT;
int button, button_1, button_2, button_3, button_4, button_5
int value, value_1, value_2, value_3, value_4, value_5;
int lt_press, lb_press, rt_press, rb_press
int wait_time;                             
int switch,flash;                             
 
 
//--block button
int b,bb,bb_array[3];
 
 
 
main {
 
//--switch XB1_LT + press XB1_RS
    if(get_val(XB1_LT)){
        //--block button
        bb = bb(XB1_LT);
        if(event_press(XB1_RS)){
            //--block button until release
            bb = bb(XB1_RS);
            //--toggle
            switch = !switch;
            //--rumble controller
            combo_run(RUMBLE_NOTIFY);
         }                                       
    } 
 
//--BACK and FORWARD       
    if(get_val(RIGHT)) {
        back = LEFT;
        forward = RIGHT;
    }else if(get_val(LEFT)) {
        back = RIGHT;
        forward = LEFT;
    }
 
 
 
 
//--EXECUTE COMBOS
 
    if(i != -1) {
 
        //--check for activator button press
        if(event_press(XB1_RT)) rt_press = TRUE;
        if(event_press(XB1_RB)) rb_press = TRUE;
        if(event_press(XB1_LT)) lt_press = TRUE;
        if(event_press(XB1_LB)) lb_press = TRUE;
 
 
        // execute combo step-by-step     
        if(!combo_running(EXECUTE_STEP)) {     
            if(get_step_values())               
                if(wait_time == 0)
                    combo_run(EXECUTE_STEP_NO_WAIT);
                else                         
                    combo_run(EXECUTE_STEP);   
             else{   
                i = -1; //--end of combo
                flash = FALSE;
            }
        }                                       
 
        // RS X / Y are in rest = cancel the combo
        if( (abs(get_val (9))  <= 20 && abs(get_val (10)) <= 20 && abs(get_val (11)) <= 20 && abs(get_val (12)) <= 20) && (!get_val(5) && !get_val(8)) && (!get_val(XB1_X)) && (!get_val(XB1_Y))) {           
                i = -1;
                combo_stop(EXECUTE_STEP);     
        }
 
        // block user input (does not interfere in the combo)
       for(btn = 3;btn <= 20;btn++) {
            set_val(btn,0);
        } 
 
    //--no combo running                         
    }else{
        //--reset activator button and led
        rt_press = FALSE;
        rb_press = FALSE;
        lt_press = FALSE;
        lb_press = FALSE;
        flash = FALSE;
 
        if(switch){
              //------------------
            // Right Stick RIGHT
           //--------------------
            if (get_val (9) >= 60)  {
                i = get_combo_index(Combo9); }
             //-----------------
            // Right Stick LEFT
           //-------------------
            if (get_val (9) <= -60)  {
                i = get_combo_index(Combo11); }
             //---------------
            // Right Stick UP
           //-----------------
            if (get_val (10) <= -60)   {
                i = get_combo_index(Combo10); }
             //-----------------
            // Right Stick DOWN
           //-------------------
            if (get_val (10) >= 60)  {
                i = get_combo_index(Combo12); }
             //-------------
            // hold LS / L3
           //---------------
            if (get_val (8)) {
                i = get_combo_index(); }
             //-------------
            // hold RS / R3
           //---------------
            if (get_val(5)) {     
                i = get_combo_index(Fatality1); }
 
          //--switch (default)                             
          }else{
              //---------------
            //Hold X/Square.
            //----------------
            if (get_val(XB1_X) && !get_val(forward) && !get_val(XB1_DOWN)) {
                set_val(XB1_X,0);
            if (get_lval(XB1_X)) i = get_combo_index(Punish); }
            //---------------------------
            //Right Stick RIGHT.
            //---------------------------
            if (get_val (9) >= 60) {
             i = get_combo_index(Combo1); }
            //---------------------------
            // Right Stick LEFT.
            //---------------------------
            if (get_val (9) <= -60) {
             i = get_combo_index(Combo2); }
             //---------------
            // Right Stick UP
           //-----------------
            if (get_val (10) <= -60) { 
             i = get_combo_index(Combo3); }
            //-----------------
           // Right Stick DOWN
           //-------------------
             if (get_val (10) >= 60)  {
             i = get_combo_index(Combo4); }
        }//--end of switch
    }//--end of combo run
 
    //--block btns
    if(bb) block_btn();
 
 
}//--end of main
 
 
combo RUMBLE_NOTIFY {                       
    set_rumble(switch,100);                     
    wait(300);             
    reset_rumble();                             
}
// This combo will run a step with wait           
combo EXECUTE_STEP {                               
    set_buttons_values();                         
    wait(wait_time);                               
    set_buttons_values();                         
} 
 
// This combo will run a step without wait       
combo EXECUTE_STEP_NO_WAIT {                     
    set_buttons_values();                         
}                                                 
 
 // Returns the starting index of a combo
function get_combo_index(combo_id) {
    i = 0;                                       
    while(TRUE) {//-----------------------       
        v = dbyte(i);                             
        if(v == combo_id) {                       
            return(i + 1);                       
        } else {//====================           
            while(v != EOC && v != EOD) {//#     
                i = i + 1;                       
                v = dbyte(i);                     
            }//#                                 
            if(v == EOD) break;                   
            else i = i + 1;                       
        }//=============================         
    }//-----------------------------------       
    return(-1);                                   
}                                                 
 
// Set the buttons, values and wait time of a step
function get_step_values() {
 
 
    //--get value from data segment
    btn = dbyte(i);
 
    //--look for CHK_PNT
    if(btn == CHK_PNT) {
        //--RT_PRESS combo
        if(check_point(rt_press,RT_PRESS))      rt_press = FALSE;
        //--RB_PRESS combo
        else if(check_point(rb_press,RB_PRESS)) rb_press = FALSE;
        //--LT_PRESS combo
        else if(check_point(lt_press,LT_PRESS)) lt_press = FALSE;
        //--LB_PRESS combo
        else if(check_point(lb_press,LB_PRESS)) lb_press = FALSE;
        //--no activator pressed
        else {
            i += 1;
            btn = dbyte(i);
        }
    }
 
    i += 1;
    if(btn >= 1) {                                   
        button_1 = convert_back_forward(dbyte(i)); i = i + 1;
        value_1 = dbyte(i); i = i + 1;             
    } else { button_1 = -1; value_1 = 0; }         
 
    if(btn >= 2) {                                   
        button_2 = convert_back_forward(dbyte(i)); i = i + 1;
        value_2 = dbyte(i); i = i + 1;             
    } else { button_2 = -1; value_2 = 0; }         
 
    if(btn >= 3) {                                   
        button_3 = convert_back_forward(dbyte(i)); i = i + 1;
        value_3 = dbyte(i); i = i + 1;             
    } else { button_3 = -1; value_3 = 0; }         
 
    if(btn >= 4) {                                   
        button_4 = convert_back_forward(dbyte(i)); i = i + 1;
        value_4 = dbyte(i); i = i + 1;             
    } else { button_4 = -1; value_4 = 0; }         
 
    if(btn >= 5) {                                   
        button_5 = convert_back_forward(dbyte(i)); i = i + 1;
        value_5 = dbyte(i); i = i + 1;               
    } else { button_5 = -1; value_5 = 0; }         
 
    wait_time = dbyte(i); i = i + 1;               
    wait_time = (wait_time - 1) * 10;               
    if(wait_time < 0) wait_time = 0;               
 
    return(TRUE);                                   
}                                                   
 
 
function check_point(f_bool,f_combo) {
    //--check for activator button pressed
    if(f_bool) {
        //--new combo
        i = get_combo_index(f_combo);
        btn = dbyte(i);
        return TRUE;
    }
    return FALSE;
}
// If the step has FORWARD and BACK buttons, set the correct value.
function convert_back_forward(button) {             
    if(button == FORWARD)                           
        return forward;                           
    if(button == BACK)   
        return back;                               
    return(button);                                 
}                                                   
 
// Set the buttons and values, function used on the combos.
function set_buttons_values() {   
    for(idx = 1;idx <= 5;idx++) {
        if(button[idx] != -1) set_val(button[idx],value[idx])
    }
}
//--BLOCK BUTTONS
function bb(f_btn) {
    for(b = 0;b <= 2;b++) {
        if(!bb_array[b]) {
            bb_array[b] = f_btn;
            return TRUE
        }
        if(bb_array[b] == f_btn)
            return TRUE;
    }
    return FALSE;
}
function block_btn() {
    bb = FALSE;
    for(b = 0;b <= 2;b++) {
        if(bb_array[b]) {
            if(event_release(bb_array[b])) {
                bb_array[b] = 0;
            }else{
                set_val(bb_array[b],0);
                bb = TRUE;
            }
        }
    }
}
function led_color(f_color) {
   for(c = 0; c <= 3; c++) {
     set_led(c,dbyte((f_color * 4) + c));
   }
}


The error code im getting is:
Code: Select all
GPC error: mk11.gpc2.gpc(856): Invalid symbol redefinition 'bb'
GPC error: mk11.gpc2.gpc(856): Invalid parameter ')'
GPC: GPC Compile ABORTED with 0 warning(s) and 2 error(s).


Help would be appreciate!

Re: converting script

PostPosted: Sat May 04, 2019 4:58 pm
by Buffy
viewtopic.php?f=26&t=12027

Make sure you're using the most current version of the converter.

Code: Select all
 
#pragma METAINFO("this.gpc", 1, 0, "Buffy's GPC Converter v0.24r2")
#include <titanone.gph>
 
 
//Posted by JQuest313, a member of the community in the device Forums - https://device.com/forums
//Posted : Saturday 4th of May, 2019 14:53 UTC 
// Geras By Fwak. V.1.0.
// Big Thanks To Batts <3.
/*---------------------------------------------------------------------------------
Infinite Warden|
----------------
 
RB Adjust = Spends a Meter
RT Adjust = Spends a Second Meter
LT Adjust = Uses Fatal during Combo (Can be used during RB/RT's combo adjust)
 
---------------------------------------------------------------------------------
IF YOU WANT TO USE SECOND BAR OF METER DURING THE FIRST BAR, PRESS RT/R2 AS SOON
AS YOU SEE THE FIRST BAR GO OFF/USED.
---------------------------------------------------------------------------------
IF YOU WANT TO USE Fatal DURING FIRST METER, PRESS LT/L2 AFTER THE DASH.
---------------------------------------------------------------------------------
 
There is quite a few check points in this one (checks if it should change Combos
mid Combo), so go in practice and get the timings down.
---------------------------------------------------------------------------------
 
RS UP --------
RS Down ------    (RS DOWN + UP are same Combo)
Hold X    ------ = All 5 can use RB and RT and LT
RS Right -----
RS Left ------
 
LS Up = Easy Fatal
 
LT + R3 to changes to corner combos which there's four of and all use 2 Meters.
 
Fatality on R3.
 
-----------------------------------------------------------------------------------**/
// TRIANGLE, Y
// CIRCLE, B 
// CROSS, A
// SQUARE, X
// R1, RB   
// R2, RT   
// L1, LB   
// L2, LT   
// TOUCH PAD   
// DPAD UP   
// DPAD DOWN
// DPAD LEFT 
// DPAD RIGHT 
// LEFT ANALOG X
// LEFT ANALOG Y
// BACK FLAG   
// FORWARD FLAG
// End Flags. 253, 254 and 255 should never be used in the
// data segment for other purposes.                 
//-----------------------------------------------------
// check for transition to another combo
// End of Combo     
// End of Data Segment
//-----------------------------------------------------
//Define Combos
//--------------------------------------
//--------------------------------------
//Define Combo Adjusters
//--------------------------------------
//
//
//
//
//--------------------------------------
// Combo Data
//--------------------------------------
//--------------------------------------
//--------------------------------------
//--------------------------------------
//--------------------------------------
//--------------------------------------
// Hold X/Square
//--------------------------------------
//--------------------------------------
// Right Stick RIGHT
//--------------------------------------
//--------------------------------------
// Right Stick LEFT
//--------------------------------------
//--------------------------------------
// Right Stick UP
//--------------------------------------
//--------------------------------------
// Right Stick DOWN
//--------------------------------------
//--------------------------------------
// Left Stick RIGHT
//--------------------------------------
//--------------------------------------
// Left Stick LEFT
//--------------------------------------
//--------------------------------------
//Left Stick Up
//--------------------------------------
//--------------------------------------
//Left Stick Down
//--------------------------------------
//--------------------------------------
// Right Stick RIGHT *SWITCHED*
//--------------------------------------
//--------------------------------------
//Right Stick Up *SWITCHED*
//--------------------------------------
//--------------------------------------
// Right Stick LEFT *SWITCHED*
//--------------------------------------
//--------------------------------------
// Right Stick DONW *SWITCHED*
//--------------------------------------
//--------------------------------------
//--------------------------------------
//End Of Combo Data
//--------------------------------------
//Unmaps
//--block button
//--switch XB1_LT + press XB1_RS
//--block button
//--block button until release
//--toggle
//--rumble controller
//--BACK and FORWARD       
//--EXECUTE COMBOS
//--check for activator button press
// execute combo step-by-step     
//--end of combo
// RS X / Y are in rest = cancel the combo
// block user input (does not interfere in the combo)
//--no combo running                         
//--reset activator button and led
//------------------
// Right Stick RIGHT
//--------------------
//-----------------
// Right Stick LEFT
//-------------------
//---------------
// Right Stick UP
//-----------------
//-----------------
// Right Stick DOWN
//-------------------
//-------------
// hold LS / L3
//---------------
//-------------
// hold RS / R3
//---------------
//--switch (default)                             
//---------------
//Hold X/Square.
//----------------
//---------------------------
//Right Stick RIGHT.
//---------------------------
//---------------------------
// Right Stick LEFT.
//---------------------------
//---------------
// Right Stick UP
//-----------------
//-----------------
// Right Stick DOWN
//-------------------
//--end of switch
//--end of combo run
//--block btns
//--end of main
// This combo will run a step with wait           
// This combo will run a step without wait       
// Returns the starting index of a combo
//-----------------------       
//====================           
//#     
//#                                 
//=============================         
//-----------------------------------       
// Set the buttons, values and wait time of a step
//--get value from data segment
//--look for CHK_PNT
//--RT_PRESS combo
//--RB_PRESS combo
//--LT_PRESS combo
//--LB_PRESS combo
//--no activator pressed
//--check for activator button pressed
//--new combo
// If the step has FORWARD and BACK buttons, set the correct value.
// Set the buttons and values, function used on the combos.
//--BLOCK BUTTONS
 
 
 
 
define Y = 17;
define B = 18;
define A = 19;
define X = 20;
define RB = 3;
define RT = 4;
define LB = 6;
define LT = 7;
define TOUCH = 27;
define UP = 13;
define DOWN = 14;
define LEFT = 15;
define RIGHT = 16;
define MOVE_X = 11;
define MOVE_Y = 12;
define BACK = 128;
define FORWARD = 129;
define CHK_PNT = 253;
define EOC = 254;
define EOD = 255;
define Combo1 = 10;
define Combo2 = 11;
define Combo3 = 12;
define Combo4 = 13;
define Combo5 = 14;
define Combo6 = 15;
define Combo7 = 16;
define Combo8 = 17;
define Combo9 = 18;
define Combo10 = 19;
define Combo11 = 26;
define Combo12 = 30;
define Punish = 31;
define Fatality1 = 24;
define Fatality2 = 25;
define LB_PRESS = 20;
define LT_PRESS = 21;
define RB_PRESS = 22;
define RT_PRESS = 23;
 
data(
RT_PRESS,
1, FORWARD, 100,
10, 0, 8,
1, FORWARD, 100,
10, 0, 4,
1, FORWARD, 100,
4, 0, 8,
2, FORWARD, 100,
A, 100,
8,
1, BACK, 100,
8,
2, FORWARD, 100,
X, 100,
10, 0, 20,
1, RB, 100,
10, 0, 73,
1, DOWN, 100,
10,
2, DOWN, 100,
Y, 100,
20,
1, DOWN, 100,
80,
2, DOWN, 100,
Y, 100,
10, 0, 55,
1, FORWARD, 100,
4, 0, 4,
1, FORWARD, 100,
4, 0, 43,
2, FORWARD, 100,
A, 100,
4, CHK_PNT,
1, BACK, 100,
4,
2, FORWARD, 100,
Y, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
RB_PRESS,
1, BACK, 100,
8,
2, FORWARD, 100,
Y, 100,
10, 0, 80,
1, RB, 100,
10, 0, 185, CHK_PNT,
1, FORWARD, 100,
4, 0, 4,
1, FORWARD, 100,
10, 0, 18,
1, B, 100,
8, CHK_PNT,
1, BACK, 100,
8,
2, FORWARD, 100,
Y, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
LT_PRESS,
2, RT, 100,
LT, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
LB_PRESS,
EOC,
Punish,
1, X, 100,
10, 0, 10,
1, X, 100,
10, 0, 30, CHK_PNT,
1, X, 100,
10, 0, 20,
2, X, 100,
A, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Combo1,
2, BACK, 100,
Y, 100,
10, 0, 10,
1, Y, 100,
50, CHK_PNT,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Combo2,
2, FORWARD, 100,
Y, 100,
10, 0, 20,
1, X, 100,
10, 0, 20, CHK_PNT,
1, Y, 100,
10, 0, 20,
1, DOWN, 100,
10, 0, 20,
2, BACK, 100,
Y, 100,
10, 0, 20,
1, X, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Combo3,
1, Y, 100,
10, 0, 18,
1, B, 100,
10, 0, 25, CHK_PNT,
1, X, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Combo4,
1, Y, 100,
10, 0, 18,
1, B, 100,
10, 0, 25, CHK_PNT,
1, X, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Combo5,
EOC,
Combo6,
EOC,
Combo7,
2, LT, 100,
RT, 100,
200, 0, 200,
EOC,
Combo8,
EOC,
Combo9,
2, BACK, 100,
Y, 100,
10, 0, 20,
1, Y, 100,
10, 0, 8,
1, BACK, 100,
8,
2, FORWARD, 100,
Y, 100,
10, 0, 120,
1, RB, 100,
10, 0, 210,
2, FORWARD, 100,
Y, 100,
10, 0, 4,
1, X, 100,
10, 0, 4,
1, Y, 100,
10, 0, 4,
1, BACK, 100,
4, 0, 4,
2, FORWARD, 100,
X, 100,
10, 0, 90,
1, RB, 100,
10, 0, 80,
2, DOWN, 100,
Y, 100,
10,
1, DOWN, 100,
90,
2, DOWN, 100,
Y, 100,
10, 0, 30,
1, BACK, 100,
75,
2, BACK, 100,
X, 100,
8,
1, FORWARD, 100,
8,
2, BACK, 100,
Y, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Combo10,
1, X, 100,
10, 0, 10,
1, X, 100,
10, 0, 8,
1, BACK, 100,
8,
2, FORWARD, 100,
Y, 100,
10, 0, 110,
1, RB, 100,
10, 0, 223,
2, FORWARD, 100,
Y, 100,
10, 0, 4,
1, X, 100,
10, 0, 4,
1, Y, 100,
10, 0, 4,
1, BACK, 100,
4, 0, 4,
2, FORWARD, 100,
X, 100,
10, 0, 90,
1, RB, 100,
10, 0, 80,
2, DOWN, 100,
Y, 100,
10,
1, DOWN, 100,
90,
2, DOWN, 100,
Y, 100,
10, 0, 30,
1, BACK, 100,
85,
2, BACK, 100,
X, 100,
8,
1, FORWARD, 100,
8,
2, BACK, 100,
Y, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Combo11,
2, FORWARD, 100,
Y, 100,
10, 0, 20,
1, X, 100,
10, 0, 20,
1, Y, 100,
10, 0, 95,
1, B, 100,
10, 0, 8,
1, BACK, 100,
8,
2, FORWARD, 100,
Y, 100,
10, 0, 80,
1, RB, 100,
10, 0, 220,
2, BACK, 100,
Y, 100,
10, 0, 4,
1, Y, 100,
10, 0, 4,
1, BACK, 100,
4, 0, 4,
2, FORWARD, 100,
X, 100,
10, 0, 50,
1, RB, 100,
10, 0, 80,
2, DOWN, 100,
Y, 100,
10,
1, DOWN, 100,
90,
2, DOWN, 100,
Y, 100,
10, 0, 30,
1, BACK, 100,
102,
2, BACK, 100,
X, 100,
8,
1, FORWARD, 100,
8,
2, BACK, 100,
Y, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Combo12,
1, Y, 100,
10, 0, 10,
1, B, 100,
10, 0, 8,
1, BACK, 100,
8,
2, FORWARD, 100,
Y, 100,
10, 0, 110,
1, RB, 100,
10, 0, 223,
2, FORWARD, 100,
Y, 100,
10, 0, 4,
1, X, 100,
10, 0, 4,
1, Y, 100,
10, 0, 4,
1, BACK, 100,
4, 0, 4,
2, FORWARD, 100,
X, 100,
10, 0, 90,
1, RB, 100,
10, 0, 80,
2, DOWN, 100,
Y, 100,
10,
1, DOWN, 100,
90,
2, DOWN, 100,
Y, 100,
10, 0, 30,
1, BACK, 100,
80,
2, BACK, 100,
X, 100,
8,
1, FORWARD, 100,
8,
2, BACK, 100,
Y, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
Fatality1,
1, RT, 100,
10, 0, 20,
1, FORWARD, 100,
10, 0, 4,
1, DOWN, 100,
10, 0, 4,
1, DOWN, 100,
10, 0, 4,
1, A, 100,
10,
0, 200,
0, 200,
0, 200,
0, 200,
0, 200,
EOC,
EOD );
 
unmap PS4_RX;
unmap PS4_RY;
unmap PS4_LX;
unmap PS4_LY;
unmap PS4_L3;
unmap PS4_R3;
 
int c,  idx,  i =- 1,  btn,  v;
int back = LEFT,  forward = RIGHT;
int button,  button_1button_2button_3button_4button_5;
int value,  value_1,  value_2,  value_3,  value_4,  value_5;
int lt_press,  lb_press,  rt_press,  rb_press;
int wait_time;
int t1_switch, flash;
int b, bb, bb_array[3];
 
main {
    if (get_val(XB1_LT)) {
        bb = f_bb(XB1_LT);
        if (event_press(XB1_RS)) {
            bb = f_bb(XB1_RS);
            t1_switch =! t1_switch;
            combo_run(c_RUMBLE_NOTIFY);
        }
    }
    if (get_val(RIGHT)) {
        back = LEFT;
        forward = RIGHT;
    }
    else if (get_val(LEFT)) {
        back = RIGHT;
        forward = LEFT;
    }
    if (i != - 1) {
        if (event_press(XB1_RT)) rt_press = TRUE;
        if (event_press(XB1_RB)) rb_press = TRUE;
        if (event_press(XB1_LT)) lt_press = TRUE;
        if (event_press(XB1_LB)) lb_press = TRUE;
        if (!combo_running(c_EXECUTE_STEP)) {
            if (f_get_step_values()) if (wait_time == 0) combo_run(c_EXECUTE_STEP_NO_WAIT);
            else  combo_run(c_EXECUTE_STEP);
            else {
                i =- 1;
                flash = FALSE;
            }
        }
        if ((abs(get_val(9)) <= 20 && abs(get_val(10)) <= 20 && abs(get_val(11)) <= 20 && abs(get_val(12)) <= 20) && (!get_val(5) && !get_val(8)) && (!get_val(XB1_X)) && (!get_val(XB1_Y))) {
            i =- 1;
            combo_stop(c_EXECUTE_STEP);
        }
        for (btn = 3; btn <= 20; btn ++ ) {
            set_val(btn, 0);
        }
    }
    else {
        rt_press = FALSE;
        rb_press = FALSE;
        lt_press = FALSE;
        lb_press = FALSE;
        flash = FALSE;
        if (t1_switch) {
            if (get_val(9) >= 60) {
                i = f_get_combo_index(Combo9);
            }
            if (get_val(9) <= - 60) {
                i = f_get_combo_index(Combo11);
            }
            if (get_val(10) <= - 60) {
                i = f_get_combo_index(Combo10);
            }
            if (get_val(10) >= 60) {
                i = f_get_combo_index(Combo12);
            }
            if (get_val(8)) {
                i = f_get_combo_index();
            }
            if (get_val(5)) {
                i = f_get_combo_index(Fatality1);
            }
        }
        else {
            if (get_val(XB1_X) && !get_val(forward) && !get_val(XB1_DOWN)) {
                set_val(XB1_X, 0);
                if (get_lval(XB1_X)) i = f_get_combo_index(Punish);
            }
            if (get_val(9) >= 60) {
                i = f_get_combo_index(Combo1);
            }
            if (get_val(9) <= - 60) {
                i = f_get_combo_index(Combo2);
            }
            if (get_val(10) <= - 60) {
                i = f_get_combo_index(Combo3);
            }
            if (get_val(10) >= 60) {
                i = f_get_combo_index(Combo4);
            }
        }
    }
    if (bb) f_block_btn();
}
 
 
combo c_RUMBLE_NOTIFY {
    set_rumble(t1_switch, 100);
    wait(300);
    reset_rumble();
}
 
combo c_EXECUTE_STEP {
    f_set_buttons_values();
    wait(wait_time);
    f_set_buttons_values();
}
 
combo c_EXECUTE_STEP_NO_WAIT {
    f_set_buttons_values();
}
 
 
function f_get_combo_index(combo_id) {
    i = 0;
    while (TRUE) {
        v = dbyte(i);
        if (v == combo_id) {
            return (i + 1);
        }
        else {
            while (v != EOC && v != EOD) {
                i = i + 1;
                v = dbyte(i);
            }
            if (v == EOD) break;
            else  i = i + 1;
        }
    }
    return ( - 1);
}
 
function f_get_step_values() {
    btn = dbyte(i);
    if (btn == CHK_PNT) {
        if (f_check_point(rt_press, RT_PRESS)) rt_press = FALSE;
        else if (f_check_point(rb_press, RB_PRESS)) rb_press = FALSE;
        else if (f_check_point(lt_press, LT_PRESS)) lt_press = FALSE;
        else if (f_check_point(lb_press, LB_PRESS)) lb_press = FALSE;
        else {
            i += 1;
            btn = dbyte(i);
        }
    }
    i += 1;
    if (btn >= 1) {
        button_1 = f_convert_back_forward(dbyte(i));
        i = i + 1;
        value_1 = dbyte(i);
        i = i + 1;
    }
    else {
        button_1 =- 1;
        value_1 = 0;
    }
    if (btn >= 2) {
        button_2 = f_convert_back_forward(dbyte(i));
        i = i + 1;
        value_2 = dbyte(i);
        i = i + 1;
    }
    else {
        button_2 =- 1;
        value_2 = 0;
    }
    if (btn >= 3) {
        button_3 = f_convert_back_forward(dbyte(i));
        i = i + 1;
        value_3 = dbyte(i);
        i = i + 1;
    }
    else {
        button_3 =- 1;
        value_3 = 0;
    }
    if (btn >= 4) {
        button_4 = f_convert_back_forward(dbyte(i));
        i = i + 1;
        value_4 = dbyte(i);
        i = i + 1;
    }
    else {
        button_4 =- 1;
        value_4 = 0;
    }
    if (btn >= 5) {
        button_5 = f_convert_back_forward(dbyte(i));
        i = i + 1;
        value_5 = dbyte(i);
        i = i + 1;
    }
    else {
        button_5 =- 1;
        value_5 = 0;
    }
    wait_time = dbyte(i);
    i = i + 1;
    wait_time = (wait_time - 1) * 10;
    if (wait_time < 0) wait_time = 0;
    return (TRUE);
}
 
function f_check_point(f_bool, f_combo) {
    if (f_bool) {
        i = f_get_combo_index(f_combo);
        btn = dbyte(i);
        return TRUE;
    }
    return FALSE;
}
 
function f_convert_back_forward(button) {
    if (button == FORWARD)
        return forward;
    if (button == BACK)
        return back;
    return (button);
}
 
function f_set_buttons_values() {
    for (idx = 1; idx <= 5; idx ++ ) {
        if (button[ - (idx)] != - 1) set_val(button[ - (idx)], value[ - (idx)]);
    }
}
 
function f_bb(f_btn) {
    for (b = 0; b <= 2; b ++ ) {
        if (!bb_array[b]) {
            bb_array[b] = f_btn;
            return TRUE;
        }
        if (bb_array[b] == f_btn)
            return TRUE;
    }
    return FALSE;
}
 
function f_block_btn() {
    bb = FALSE;
    for (b = 0; b <= 2; b ++ ) {
        if (bb_array[b]) {
            if (event_release(bb_array[b])) {
                bb_array[b] = 0;
            }
            else {
                set_val(bb_array[b], 0);
                bb = TRUE;
            }
        }
    }
}
 
/* function f_led_color(f_color) {
    for (c = 0; c <= 3; c ++ ) {
        set_led(c, dbyte((f_color * 4) + c));
    }
}
*/