Thank you!

GPC1 script programming for Titan One. Code examples, questions, requests.

Thank you!

Postby coolfedorabro » Sun Nov 15, 2020 3:58 am

Hi i need to have this convert to T1

thank you!

Code: Select all
*/
int MeterPosition = 19;
int Meter = 0;
int release = 21;
 
 
main
{
    if(get_rumble(RUMBLE_A) || get_rumble(RUMBLE_B)) {combo_run(wait_time);}
 
 
 
 
 
    if(get_val(PS4_OPTIONS)) //Hold Options
    {
        if(event_press(PS4_SQUARE)) //If Options is held and (PS4)Square/(XBOX)X is pressed, toggle Meter/No Meter Script
        {
            Meter=!Meter;
            set_val(PS4_SQUARE, 0);
            combo_run(RUMBLE);           
        }
    }
 
    if (Meter == 1) //If "Meter" script is active, run commands below
    { 
        if(get_val(PS4_R2))
        {   
            if(get_val(PS4_L1))
            {
                set_val(PS4_RX, MeterPosition);
                set_val(PS4_RY,100);
            }
        }
    }
 
    if (Meter == 0) //If "No Meter" script is active, run commands below
    { 
        if(get_val(PS4_L1))
        {
            set_val(PS4_RX, MeterPosition);
            set_val(PS4_RY,100);
        }
    }
 
 
    if(i > -1)
    {
        if(!combo_running(SET_BUTTON_VALUES))
        {   
            if(ButtonsVals())
            {
                combo_run(SET_BUTTON_VALUES);
            }
        }
    }
        else
        { 
            if((get_val(PS4_LX))<0 && event_press(PS4_L3))
            {
                i = FindID(QSLH);
            }
            if((get_val(PS4_LX))>0 && event_press(PS4_L3))
            {
                i = FindID(QSRH);
            }
        }
     }//--end activation
 
 
 
 
 
 
/*
============================================================================================================================
   Combo Labels
============================================================================================================================
*/

define QSLH              = 100;
define QSRH              = 101;
define EOC = 255;
/*
============================================================================================================================
   C_DATA[]
============================================================================================================================
*/

const int C_DATA[] = {
    //--Left Hand Half Spin
    QSLH,1,9,100,3,EOC,   
 
    //--Right Hand Half Spin
    QSRH,1,9,-100,3,EOC
};   
/*
============================================================================================================================
   Find Stick Position Name
============================================================================================================================
*/

int i = -1,v;
 
 
function FindID(arrayID) {
    i = 0;
    while(i < (sizeof(C_DATA) / sizeof(C_DATA[0]))) {
        v = C_DATA[i];
        if(v == arrayID) {
            return(i + 1);
        }
        while(v != EOC) { 
            i++;
            v = C_DATA[i];
        }
        i++;
    }
    return(-1);
}
/*
============================================================================================================================
   Buttons & Valuse
============================================================================================================================
*/

int bvCount,idx;
int button[4],value[4];
int bvWait;
 
 
function ButtonsVals() {
    InitializeButtons();
     if(C_DATA[i] == EOC) {
        i = -1;
        return FALSE;
    }
    bvCount = C_DATA[i];
    i++;
    for(idx = 0;idx <= 3;idx++) {
        if(idx < bvCount) {
            button[idx] = C_DATA[i]
            value[idx] = C_DATA[i + 1];
            i += 2;
        }
    }
    bvWait = C_DATA[i] * 10;
    i++;
    return TRUE;
}   
/*
============================================================================================================================
   SET BUTTON VALS
============================================================================================================================
*/

combo SET_BUTTON_VALUES {
   for(idx = 0; idx <= 3; idx++) {
        if(button[idx] > -1) {
            set_val(button[idx],value[idx])
        }
    }
    wait(bvWait);
}
/*
============================================================================================================================
   Initialize Buttons
============================================================================================================================
*/

function InitializeButtons() {
    for(idx = 0; idx <= 3; idx++) {
        button[idx] = -1;
    }
}
 
 
/*
============================================================================================================================
   Quick Combos
============================================================================================================================
*/

 
 
combo wait_time
{
    wait(release);
    set_val(PS4_L2, 100);
    set_val(PS4_SQUARE, 0):
    wait(100);
    set_val(PS4_L2, 0);
    wait(200):
}
 
 
combo RUMBLE
{
    set_rumble(RUMBLE_A, 100);
    wait(200);
    set_rumble(RUMBLE_A, 0);
}
Last edited by coolfedorabro on Wed Nov 18, 2020 2:08 am, edited 1 time in total.
User avatar
coolfedorabro
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Mon Oct 05, 2020 6:14 am

Re: Help convert to T1

Postby J2Kbr » Sun Nov 15, 2020 3:57 pm

Converted:
Code: Select all
//#include <titanone.gph>
 
/*
============================================================================================================================
Combo Labels
============================================================================================================================
*/

define QSLH = 100;
define QSRH = 101;
define EOC  = 255;
/*
============================================================================================================================
C_DATA[]
============================================================================================================================
*/

data(
    //--Left Hand Half Spin
    QSLH,1,9,100,3,EOC,   
 
    //--Right Hand Half Spin
    QSRH,1,9,-100,3,EOC
);   
 
int MeterPosition = 19;
int Meter = 0;
int release = 21;
 
int i = -1,v;
 
int bvCount,idx;
int button, button_1, button_2, button_3;
int value, value_1, value_2, value_3;
int bvWait; 
 
main
{
    if(get_rumble(RUMBLE_A) || get_rumble(RUMBLE_B)) {combo_run(wait_time);}
 
    if(get_val(PS4_OPTIONS)) //Hold Options
    {
        if(event_press(PS4_SQUARE)) //If Options is held and (PS4)Square/(XBOX)X is pressed, toggle Meter/No Meter Script
        {
            Meter=!Meter;
            set_val(PS4_SQUARE, 0);
            combo_run(RUMBLE);           
        }
    }
 
    if (Meter == 1) //If "Meter" script is active, run commands below
    { 
        if(get_val(PS4_R2))
        {   
            if(get_val(PS4_L1))
            {
                set_val(PS4_RX, MeterPosition);
                set_val(PS4_RY,100);
            }
        }
    }
 
    if (Meter == 0) //If "No Meter" script is active, run commands below
    { 
        if(get_val(PS4_L1))
        {
            set_val(PS4_RX, MeterPosition);
            set_val(PS4_RY,100);
        }
    }
 
 
    if(i > -1)
    {
        if(!combo_running(SET_BUTTON_VALUES))
        {   
            if(ButtonsVals())
            {
                combo_run(SET_BUTTON_VALUES);
            }
        }
    }
    else
    { 
        if((get_val(PS4_LX))<0 && event_press(PS4_L3))
        {
            i = FindID(QSLH);
        }
        if((get_val(PS4_LX))>0 && event_press(PS4_L3))
        {
            i = FindID(QSRH);
        }
    }
}//--end activation
 
/*
============================================================================================================================
SET BUTTON VALS
============================================================================================================================
*/

combo SET_BUTTON_VALUES {
    idx = 0;
    while(idx <= 3) {
        if(button[idx] > -1) {
            set_val(button[idx],value[idx]);
        }
        idx++;
    }
    wait(bvWait);
}
 
/*
============================================================================================================================
Quick Combos
============================================================================================================================
*/

combo wait_time
{
    wait(release);
    set_val(PS4_L2, 100);
    set_val(PS4_SQUARE, 0);
    wait(100);
    set_val(PS4_L2, 0);
    wait(200);
}
 
 
combo RUMBLE
{
    set_rumble(RUMBLE_A, 100);
    wait(200);
    set_rumble(RUMBLE_A, 0);
}
 
/*
============================================================================================================================
Find Stick Position Name
============================================================================================================================
*/

function FindID(arrayID) {
    i = 0;
    while(i < 12) {
        v = dchar(i);
        if(v == arrayID) {
            return(i + 1);
        }
        while(v != EOC) { 
            i++;
            v = dchar(i);
        }
        i++;
    }
    return(-1);
}
 
/*
============================================================================================================================
Initialize Buttons
============================================================================================================================
*/

function InitializeButtons() {
    idx = 0;
    while(idx <= 3) {
        button[idx] = -1;
        idx++;
    }
}
 
/*
============================================================================================================================
Buttons & Valuse
============================================================================================================================
*/

function ButtonsVals() {
    InitializeButtons();
    if(dchar(i) == EOC) {
        i = -1;
        return(FALSE);
    }
    bvCount = dchar(i);
    i++;
    idx = 0;
    while(idx <= 3) {
        if(idx < bvCount) {
            button[idx] = dchar(i)
            value[idx] = dchar(i + 1);
            i = i + 2;
        }
        idx++;
    }
    bvWait = dchar(i) * 10;
    i++;
    return(TRUE);
}   
 
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 40 guests