Script request: PS4 swipe NSWE (Ghost of Tsushima)

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

Script request: PS4 swipe NSWE (Ghost of Tsushima)

Postby Sando » Fri Jul 17, 2020 5:22 pm

Hi there,

Would someone be able to make a script that swipes up, down, left and right when pressing extra button 1, 2 etc...?
Would really help me out!
Thanks in advance! :innocent_smile_1:
User avatar
Sando
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Fri Jul 21, 2017 9:44 pm

Re: Script request: PS4 swipe NSWE (Ghost of Tsushima)

Postby DontAtMe » Fri Jul 17, 2020 5:37 pm

Please provide more detail,

You are welcome in advanced :smile0517:
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Script request: PS4 swipe NSWE (Ghost of Tsushima)

Postby Sando » Fri Jul 17, 2020 5:43 pm

For example, if I press extra button 1, the titan one should send a swipe up from the touchpad. if I press extra button 2, the titan one should send a swipe down from the touchpad. if I press extra button 3, the titan one should send a swipe left from the touchpad. if I press extra button 4, the titan one should send a swipe right from the touchpad.
I hope you know what I mean now :)
User avatar
Sando
Staff Sergeant
Staff Sergeant
 
Posts: 13
Joined: Fri Jul 21, 2017 9:44 pm

Re: Script request: PS4 swipe NSWE (Ghost of Tsushima)

Postby J2Kbr » Wed Jul 29, 2020 2:22 pm

Here is an example on how emulate swipe actions with the Titan One:

Code: Select all
int valX, incX;
int valY, incY;
 
main {
    if(event_press(PS4_TRIANGLE)) {      // SWIPE UP
        valX = 0;
        incX = 0;
        valY = -100;
        incY = 10;
    } else if(event_press(PS4_CROSS)) {  // SWIPE DOWN
        valX = 0;
        incX = 0;
        valY = 100;
        incY = -10;
    } else if(event_press(PS4_SQUARE)) { // SWIPE LEFT
        valX = -100;
        incX = 10;
        valY = 0;
        incY = 0;
    } else if(event_press(PS4_CIRCLE)) { // SWIPE RIGHT
        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
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Script request: PS4 swipe NSWE (Ghost of Tsushima)

Postby antithesis » Thu Jul 30, 2020 9:58 pm

You learn something new every day :)

What would be the Titan Two (GPC2) equivalent of this code?

I can see a use for this in other games when pairing T2 with a XIM APEX, which doesn't support touchpad swipes.
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Script request: PS4 swipe NSWE (Ghost of Tsushima)

Postby J2Kbr » Mon Aug 31, 2020 8:08 pm

antithesis wrote:You learn something new every day :)

What would be the Titan Two (GPC2) equivalent of this code?

I can see a use for this in other games when pairing T2 with a XIM APEX, which doesn't support touchpad swipes.

With the Titan Two would be something like this:

Code: Select all
#include <ps4.gph>
 
fix32 valX, incX;
fix32 valY, incY;
 
main {
    if(event_active(PS4_TRIANGLE)) {      // SWIPE UP
        valX = 0.0;
        incX = 0.0;
        valY = -100.0;
        incY = 10.0;
    } else if(event_active(PS4_CROSS)) {  // SWIPE DOWN
        valX = 0.0;
        incX = 0.0;
        valY = 100.0;
        incY = -10.0;
    } else if(event_active(PS4_SQUARE)) { // SWIPE LEFT
        valX = -100.0;
        incX = 10.0;
        valY = 0.0;
        incY = 0.0;
    } else if(event_active(PS4_CIRCLE)) { // SWIPE RIGHT
        valX = 100.0;
        incX = -10.0;
        valY = 0.0;
        incY = 0.0;
    }
    if(incX || incY) {
        if(abs(valX) > 100.0 || abs(valY) > 100.0) {
            incX = 0.0;
            incY = 0.0;
        } else {
            combo_run(SwipeEmulator);
        }
    }
}
 
combo SwipeEmulator {
    set_val(POINT_1_X, valX);
    set_val(POINT_1_Y, valY);
    set_val(BUTTON_19, 100.0);
    wait(10);
    set_val(POINT_1_X, valX);
    set_val(POINT_1_Y, valY);
    set_val(BUTTON_19, 100.0);
    if(incX) valX = valX + incX;
    if(incY) valY = valY + incY;
}
 
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 45 guests