MK11

GPC script programming for Titan Two device. Code examples, how to, questions, requests.

Moderators: The_Rabid_Taco, pablosscripts, bonefisher

Re: MK11

Postby ViciousXlV » Mon May 20, 2019 5:15 pm

J2 is there something with the t2 were we can record inputs from the controller like combo magick for combos or commands for mk11?
User avatar
ViciousXlV
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Mon Mar 11, 2019 9:16 am

Re: MK11

Postby Scachi » Mon May 20, 2019 5:23 pm

ViciousXlV wrote:J2 is there something with the t2 were we can record inputs from the controller like combo magick for combos or commands for mk11?

There is, record a macro and convert the selection to a combo :
https://www.consoletuner.com/wiki/index ... ing:macros
At the bottom of that page is the info to convert it to a combo
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 2124
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: MK11

Postby STEELES » Fri May 24, 2019 5:02 pm

im trying to conver the swide switching script , for t1 by insterting #include <titanone.gph>

but i get errors, any ideas?
User avatar
STEELES
Master Sergeant
Master Sergeant
 
Posts: 27
Joined: Sat Mar 23, 2019 2:00 pm

Re: MK11

Postby J2Kbr » Mon May 27, 2019 10:48 am

STEELES wrote:im trying to conver the swide switching script , for t1 by insterting #include <titanone.gph> but i get errors, any ideas?

Errors fixed (the original script declared a variable named 'switch', but switch is a reserved keyword on the Titan Two):
Code: Select all
#include <titanone.gph>
 
define BF_Y = 17; // TRIANGLE, Y
define BF_B = 18; // CIRCLE, B
define BF_A = 19; // CROSS, A
define BF_X = 20; // SQUARE, X
define BR1 = 3; // R1, RB
define BR2 = 4; // R2, RT
define BL1 = 6; // L1, LB
define BL2 = 7; // L2, LT
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
define EOC = 254; // End of Combo
define EOD = 255; // End of Data Segment
// combo names
define RIGHTstickRIGHT =0;
define RIGHTstickLEFT =1;
define RIGHTstickUP =2;
define RIGHTstickDOWN =3;
define LEFTstickRIGHT =4;
define LEFTstickLEFT =5;
define LEFTstickDOWN =6;
define LEFTstickUP =7;
define LEFTstickPRESS =8;
define RIGHTstickPRESS =9;
define DOWNA =10;
define sRIGHTstickRIGHT =11;
define sRIGHTstickLEFT =12;
define sRIGHTstickUP =13;
define sRIGHTstickDOWN =14;
define sLEFTstickRIGHT =15;
define sLEFTstickLEFT =16;
define sLEFTstickDOWN =17;
define sLEFTstickUP =18;
define sLEFTstickPRESS =19;
define sRIGHTstickPRESS =20;
// data segment
data(
 
 
 
 
RIGHTstickRIGHT,
2,BACK,100,BF_X,100,4,0,4,
2,BACK,100,BF_Y,100,4,0,40,
 
 
1,BACK,100,4,0,4,
1,FORWARD,100,4,0,4,
1,BF_A,100,4,0,10,
 
 
1,BACK,100,120,0,4,
 
 
1,BF_B,100,4,0,4,
1,DOWN,100,4,0,4,
1,FORWARD,100,4,0,4,
1,BF_A,100,4,0,122,
 
 
2,FORWARD,100,BF_B,100,4,0,250,
 
 
EOC,
 
 
RIGHTstickLEFT,
1,BF_Y,100,4,0,4,
1,BF_A,100,4,0,30,
 
 
1,BACK,100,4,0,4,
1,FORWARD,100,4,0,4,
1,BF_A,100,4,0,30,
 
 
1,BACK,100,90,0,4,
 
 
1,BF_B,100,4,0,4,
1,DOWN,100,4,0,4,
1,FORWARD,100,4,0,4,
1,BF_Y,100,4,0,100,
1,BR1,100,4,0,250,
 
 
EOC,
 
 
RIGHTstickUP,
 
 
2,BACK,100,BF_X,100,4,0,4,
2,BACK,100,BF_Y,100,4,0,30,
 
 
1,BACK,100,4,0,4,
1,FORWARD,100,4,0,4,
1,BF_A,100,4,0,10,
 
 
1,BACK,40,140,0,4,
 
 
1,BF_B,100,4,0,4,
1,DOWN,100,4,0,4,
1,FORWARD,100,4,0,4,
1,BF_B,100,4,0,250,
 
 
EOC,
 
 
RIGHTstickDOWN,
2,BACK,100,BF_X,100,4,0,4,
1,BF_Y,100,4,0,4,
2,DOWN,100,BF_Y,100,4,0,250,
 
 
EOC,
 
 
sRIGHTstickRIGHT,
EOC,
 
 
sRIGHTstickLEFT,
EOC,
 
 
sRIGHTstickUP,
EOC,
 
 
sRIGHTstickDOWN,
EOC,
 
 
 
 
LEFTstickRIGHT,
 
 
EOC,
 
 
LEFTstickLEFT,
 
 
EOC,
 
 
LEFTstickDOWN,
 
 
EOC,
 
 
LEFTstickUP,
 
 
EOC,
 
 
LEFTstickPRESS,
EOC,
 
 
sLEFTstickPRESS,
EOC,
RIGHTstickPRESS,
EOC,
sRIGHTstickPRESS,
EOC,
 
 
 
 
EOD );
 
 
 
 
// Unmaps
unmap PS4_L3;
unmap PS4_LY;
unmap PS4_LX;
 
 
 
 
// Variables
int i = -1, b, v;
int back = LEFT, forward = RIGHT;
int button_1, button_2, button_3, button_4, button_5;
int value_1, value_2, value_3, value_4, value_5;
int wait_time;
int toggle;
int RUMBLE_TYPE=RUMBLE_A;
int delay_t;
int cancel;
 
main {
 
 
 
 
if (event_release(PS4_L2)){ //CREDIT TO SOLO FOR SWITCH SCRIPT
toggle=!toggle;
set_val(PS4_L2 ,0);
}
 
 
 
// Determine Back and Forward
if(get_val(RIGHT) ) {
back = LEFT; forward = RIGHT;
} else if(get_val(LEFT)) {
back = RIGHT; forward = LEFT;
}
 
// If there is a combo to be executed
if(i >= 0 && delay_t<=0) {
// Execute the 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 { // the combo finished
i = -1;
}
}
 
 
// CANCEL combos condition-----------------------------------------
// RS X and Y are in rest - cancel the combo
if(cancel==1){
if ( (abs(get_val (9)) <= 20 && abs(get_val (10)) <= 20) ) {
i = -1;
combo_stop(execute_step);
}
}else if(cancel==2){
if ( (abs(get_val (11)) <= 20 && abs(get_val (12)) <= 20) ) {
i = -1;
combo_stop(execute_step);
}
}
 
 
// Make sure the user inputs does not interfere in the combo
set_val(BF_Y , 0);
set_val(BF_B , 0);
set_val(BF_A , 0);
set_val(BF_X , 0);
set_val(BR1 , 0);
set_val(BR2 , 0);
set_val(BL1 , 0);
set_val(BL2 , 0);
set_val(UP , 0);
set_val(DOWN , 0);
set_val(LEFT , 0);
set_val(RIGHT , 0);
set_val(MOVE_X , 0);
set_val(MOVE_Y , 0);
 
// if no combo execute - look for combo activation
} else {
// EDIT THIS PART OF SCRIPT for combo run ---------------------------
//////////////////////////////////////////////////////////////////////////
if(toggle){
 
// RS DOWN to Activate
if (get_val (9) <= -60) {
cancel=1;
i = get_combo_index(sRIGHTstickLEFT);
}
// Press RS UP to Activate
if (get_val (9) >= 60) {
cancel=1;
i = get_combo_index(sRIGHTstickRIGHT);
}
// RS LEFT
if (get_val (10) <= -60) {
cancel=1;
i = get_combo_index(sRIGHTstickUP);
}
/////RS RIGHT
if (get_val (10) >= 40) {
cancel=1;
i = get_combo_index(sRIGHTstickDOWN);
}
// LS UP
if (get_val (12)<= -60) {
cancel=2;
i = get_combo_index(sLEFTstickUP);
}
// LEFT Stick Pressed
if (get_val (5)) {
cancel=3;
i = get_combo_index(sLEFTstickPRESS);
}
// RIGHT Stick Pressed
if (get_val (8)) {
cancel=3;
i = get_combo_index(sRIGHTstickPRESS);
}
// LS DOWN
if (get_val (12) >= 60) {
cancel=2;
i = get_combo_index(sLEFTstickDOWN);
}
// LS LEFT
if (get_val (11)<= -60) {
cancel=2;
i = get_combo_index(LEFTstickLEFT);
}
// LS RIGHT
if (get_val (11)>= 60) {
cancel=2;
i = get_combo_index(LEFTstickRIGHT);
}
// switch
}else{
// RS DOWN to Activate
if (get_val (9) <= -60) {
cancel=1;
i = get_combo_index(RIGHTstickLEFT);
}
// Press RS UP to Activate
if (get_val (9) >= 60) {
cancel=1;
i = get_combo_index(RIGHTstickRIGHT);
}
// RS LEFT
if (get_val (10) <= -60) {
cancel=1;
i = get_combo_index(RIGHTstickUP);
}
/////RS RIGHT
if (get_val (10) >= 40) {
cancel=1;
i = get_combo_index(RIGHTstickDOWN);
}
// LS UP
if (get_val (12)<= -60) {
cancel=2;
i = get_combo_index(LEFTstickUP);
}
// LEFT Stick Pressed
if (get_val (5)) {
cancel=3;
i = get_combo_index(LEFTstickPRESS);
}
// RIGHT Stick Pressed
if (get_val (8)) {
cancel=3;
i = get_combo_index(RIGHTstickPRESS);
}
// LS DOWN
if (get_val (12) >= 60) {
cancel=2;
i = get_combo_index(LEFTstickDOWN);
}
// LS LEFT
if (get_val (11)<= -60) {
cancel=2;
i = get_combo_index(LEFTstickLEFT);
}
// LS RIGHT
if (get_val (11)>= 60) {
cancel=2;
i = get_combo_index(LEFTstickRIGHT);
}
 
 
 
 
 
 
 
// end editing here --------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////
}// <combo activation> end
 
 
 
 
 
 
 
 
 
 
}//<main> block end
}
// 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() {
b = dbyte(i); i = i + 1;
if(b > 5) return(FALSE);
 
if(b >= 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(b >= 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(b >= 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(b >= 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(b >= 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;
else if(wait_time > 2530) wait_time = 2530;
 
return(TRUE);
}
 
// If the step has FORWARD and BACK buttons, set the correct value.
function convert_back_forward(button) {
if(button == FORWARD) {
return(forward);
} else if(button == BACK) {
return(back);
}
return(button);
}
 
// Set the buttons and values, function used on the combos.
function set_buttons_values() {
if(button_1 != -1) set_val(button_1, value_1);
if(button_2 != -1) set_val(button_2, value_2);
if(button_3 != -1) set_val(button_3, value_3);
if(button_4 != -1) set_val(button_4, value_4);
if(button_5 != -1) set_val(button_5, value_5);
 
 
}
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 17648
Joined: Tue Mar 18, 2014 1:39 pm

Previous

Return to GPC Script Programming (Titan Two)

Who is online

Users browsing this forum: No registered users and 19 guests