PS4 Touchpad Vertical Swipe Action Trigger

This script is for Anoptimis. I tested it and it works. Swipe up for dpad up and swipe down for dpad down. It doesn't register if you don't swipe all the way and it doesn't register if you don't keep your finger on the touchpad while swiping. I provided comments for changing the script's actions. Please enjoy. - Token
Version1.00
Authortoken
Publish DateFri, 2 May 2014 - 04:28
Last UpdateFri, 2 May 2014 - 04:28
Downloads54
RATE


0

0

Code: Select all
define Toptouchpad = 100; 
define Bottomtouchpad = 100;
define Up = PS4_UP;// Change this if you want a different action for swipe up.
define Bottom = PS4_DOWN;// Change this if you want a different action for swipe down.
int w = TRUE;
int x = FALSE;
int y = FALSE;
int z = FALSE;
int a = TRUE;
int b = FALSE;
int c = FALSE;
int d = FALSE;
main {
// The below statements looks for a finger slide from the bottom touchpad to the top touchpad.
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1) && y && !z && !x && w) {y = TRUE; z = TRUE; x = FALSE; }
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1) && y && z && x && w) {y = FALSE; z = FALSE; x = FALSE;}
 
// The below statements checks if you're swiping from bottom touchpad to top touchpad.
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1) == 0 ) {w = TRUE;}
if(get_val(29) <= Bottomtouchpad && get_val(29) > 10 && ps4_touchpad(PS4T_P1) == 0 ) {w = FALSE;}
if(get_val(29) <= Bottomtouchpad && get_val(29) > 10 && ps4_touchpad(PS4T_P1)) {w = TRUE;}
 
// The below statements looks for a finger slide from the top touchpad to the bottom touchpad.
if(get_val(29) <= Bottomtouchpad && get_val(29) > 10 && ps4_touchpad(PS4T_P1) && c && !d && !b && a) {c = TRUE; d = TRUE; b = FALSE; }
if(get_val(29) <= Bottomtouchpad && get_val(29) > 10 && ps4_touchpad(PS4T_P1) && c && d && b && a) {c = FALSE; d = FALSE; b = FALSE;}
 
// The below statements checks if you're swiping from top touchpad to bottom touchpad.
if(get_val(29) <= Bottomtouchpad && get_val(29) > 10 && ps4_touchpad(PS4T_P1) == 0 ) {a = TRUE;}
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1) == 0 ) {a = FALSE;}
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1)) {a = TRUE;}
 
if(y && z && !x && get_val(29) >= -100 && get_val(29) < 10 && ps4_touchpad(PS4T_P1)) {
 
    set_val(Up, 100);y = FALSE; z = FALSE; x = FALSE;
 
}
 
if(c && d && !b && get_val(29) <= 100 && get_val(29) > -10 && ps4_touchpad(PS4T_P1)) {
 
    set_val(Bottom, 100);c = FALSE; d = FALSE; b = FALSE;
 
}
 
// These statements are for checking a second finger slide up. The cycle restarts from here.
if(get_val(29) <= Bottomtouchpad && get_val(29) > 10 && ps4_touchpad(PS4T_P1) && y && z && !x && w) {y = TRUE; z = TRUE; x = TRUE; }
if(get_val(29) <= Bottomtouchpad && get_val(29) > 10 && ps4_touchpad(PS4T_P1) && !y && !z && !x && w) {y = TRUE; z = FALSE; x = FALSE; }
 
// These statements are for checking a second finger slide down. The cycle restarts from here.
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1) && c && d && !b && a) {c = TRUE; d = TRUE; b = TRUE; }
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1) && !c && !d && !b && a) {c = TRUE; d = FALSE; b = FALSE; }
}