Combining Titan 1 and Titan 2 script

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

Combining Titan 1 and Titan 2 script

Postby gman1212 » Wed Sep 09, 2020 8:23 pm

I had these two scripts I've been using since I got this device and I was trying to merge them just to have an all around problem solving script for what I need. I was reading you can't have two main scripts and I need to place one code inside the other. I did that and I managed to only get one error but I have no idea how to solve it. I've seen other posts like this and everybody says to post the script so they can see what's going on so that's what I'm doing :innocent_smile_1: it's probably a simple fix but one script is from Titan 2 and the other is for Titan one so I read that could cause some trouble. Anyway, any help would be appreciated. Thanks
Code: Select all
main {
 
    if(get_val(BUTTON_21)) {
        set_val(STICK_1_X, 0);
        set_val(STICK_1_Y, 0);
 
    }
}

Code: Select all
#include <titanone.gph>
 
int valX, incX;
int valY, incY;
 
main {
    if(event_press(PS4_ACCX)) {      // SWIPE DOWN
        valX = 0;
        incX = 0;
        valY = -100;
        incY = 10;
    } else if(event_press(PS4_ACCY)) {  // SWIPE UP
        valX = 0;
        incX = 0;
        valY = 100;
        incY = -10;
    } else if(event_press(PS4_ACCZ)) { // SWIPE RIGHT
        valX = -100;
        incX = 10;
        valY = 0;
        incY = 0;
    } else if(event_press(PS4_GYROX)) { // SWIPE LEFT
        valX = 100;
        incX = -10;
        valY = 0;
        incY = 0;
    }
    if(incX || incY) {
        if(abs(valX) > 100 || abs(valY) > 100) {
            incX = 0;
            incY = 0;
        } else {
            combo_run(SwipeEmulator);
        }
    }
}
 
combo SwipeEmulator {
    ps4_set_touchpad(valX, valY);
    wait(10);
    ps4_set_touchpad(valX, valY);
    if(incX) valX = valX + incX;
    if(incY) valY = valY + incY;
 
 
}
 
User avatar
gman1212
First Sergeant
First Sergeant
 
Posts: 44
Joined: Sat Apr 11, 2020 4:14 pm

Re: Combining Titan 1 and Titan 2 script

Postby Mad » Wed Sep 09, 2020 8:34 pm

Based on your other posts you have a Titan Two? (this is the titan one scripting section)
Here it is for titan two:
Code: Select all
#include <titanone.gph>
 
int valX, incX;
int valY, incY;
 
main {
    if(get_val(BUTTON_21)) {
        set_val(STICK_1_X, 0);
        set_val(STICK_1_Y, 0);
    }
 
    if(event_press(PS4_ACCX)) {      // SWIPE DOWN
        valX = 0;
        incX = 0;
        valY = -100;
        incY = 10;
    } else if(event_press(PS4_ACCY)) {  // SWIPE UP
        valX = 0;
        incX = 0;
        valY = 100;
        incY = -10;
    } else if(event_press(PS4_ACCZ)) { // SWIPE RIGHT
        valX = -100;
        incX = 10;
        valY = 0;
        incY = 0;
    } else if(event_press(PS4_GYROX)) { // SWIPE LEFT
        valX = 100;
        incX = -10;
        valY = 0;
        incY = 0;
    }
    if(incX || incY) {
        if(abs(valX) > 100 || abs(valY) > 100) {
            incX = 0;
            incY = 0;
        } else {
            combo_run(SwipeEmulator);
        }
    }
}
combo SwipeEmulator {
    ps4_set_touchpad(valX, valY);
    wait(10);
    ps4_set_touchpad(valX, valY);
    if(incX) valX = valX + incX;
    if(incY) valY = valY + incY;
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: Combining Titan 1 and Titan 2 script

Postby gman1212 » Wed Sep 09, 2020 9:10 pm

Awesome! Thank you very much! yeah, i have the titan 2(i should have included that in my topic...).Sorry about posting in the wrong section, I was reading through the forums looking for a solution and assumed I was in the Titan 2 scripting section when I clicked a new topic.
User avatar
gman1212
First Sergeant
First Sergeant
 
Posts: 44
Joined: Sat Apr 11, 2020 4:14 pm

Re: Combining Titan 1 and Titan 2 script

Postby Mad » Wed Sep 09, 2020 9:29 pm

No problem. :smile0517:
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: Combining Titan 1 and Titan 2 script

Postby gman1212 » Wed Apr 14, 2021 11:44 pm

update:I got the PlayStation five and I was using this script and I noticed it seems to be malfunctioning a little bit,It worked perfectly fine on PlayStation 4. The top script which locks the right stick doesn't seem to function when these scripts are combined(swiping works though). If I use it on its own without being combined with the swiping script it works fine. Is there something about the PlayStation five which could have broken the script in any way? Any help to fix it I would appreciate, thanks
User avatar
gman1212
First Sergeant
First Sergeant
 
Posts: 44
Joined: Sat Apr 11, 2020 4:14 pm


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 72 guests