/////Automatically hold and release R1 in Dead Nation for easy headshots (Made using PS4, delays may vary for PS3)
////////Slide finger up on touchpad till LED becomes yellow to activate, slide finger up again to disable.
define DELAY = 1025; // Delay.
define BUTTON = PS4_R1; // Button
define TIME = 1000;
int hold_on = FALSE; //// hold_on is FALSE
/////////////////////////////////////////////////////////////
define Toptouchpad = 100; // You can change the 100s to your liking.
define Bottomtouchpad = 100;
define LED1 = 0;// You can change the LEDs to your liking.
define LED2 = 1;
define LED3 = 1;
define LED4 = 0;
int w = TRUE;
int x = FALSE;
int y = FALSE;
int z = FALSE;
/////////////////////////////////////////////////////////////
main {
////////////////////////// Special thanks to Token for lines 8 - 45
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1) && y && !z && !x && w)
{y = TRUE; z = TRUE; x = FALSE; hold_on = !hold_on; }
if(get_val(29) >= Toptouchpad*-1 && get_val(29) < -10 && ps4_touchpad(PS4T_P1) && y && z && x && w)
{y = FALSE; z = FALSE; x = FALSE; hold_on = !hold_on; reset_leds();}
// 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;}
if(y && z && !x && get_val(29) >= -100 && get_val(29) < 10 && ps4_touchpad(PS4T_P1)) {
set_led(LED_1, LED1);
set_led(LED_2, LED2);
set_led(LED_3, LED3);
set_led(LED_4, LED4);
}
// 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; }
//////////////////////////
if (!hold_on) {
combo_stop(held)
}
if (hold_on && get_val(BUTTON) > 99) {
combo_run(held);
}
if(hold_on) block(BUTTON,0);
if(!hold_on) block(BUTTON,TIME);
}
combo held {
set_val(PS4_R1, 100);
wait(DELAY);
set_val(PS4_R1, 0);
wait(100);
combo_restart(held);
}