//////////////////////////////////////////////////////////////////////////
// //
// ALTERNATING FIRE INDEX VERSION //
// Version 2.1 Revision date 12/20/2015 //
// //
//-----------------------DEFAULT ACTIVATION TRIGGERS--------------------//
// ALTERNATING_FIRE == Hold and press //
// ***This is set on LINE 53 and 54 //
// RE-AUTHORIZATION == Hold //
// and press //
// ***This is set on LINE 81 and 85 //
// SHARE (WHEN USING A NON DUAL SHOCK 4) //
// == Hold and press //
// ***This is set on LINE 93 and 97 //
//----------------------------------------------------------------------//
// *Use one button to rapidfire alternating buttons //
// *Also includes an auxilary rapidfire button //
// *Mode is activated using button defined as //
// *LED cycles counterclockwise during active mode rate of //
// which can be adjusted //
// *Has rumble during rapidfire activation which can be turned //
// off in "define" section //
// *Dual Shock Touch Pad options (see revision history for details)//
// *Implemented PS4 Re-Authorization codec for manual activation //
// //
//////////////////////////////////////////////////////////////////////////
// REVISION HISTORY //
// V2.1 (12/20/2015) //
// Updated DualShock 4 universal compatibility to be automatic //
// Added defualt activation in header for ease of use //
// V2.0 (12/16/2015) //
// Added universal scriptlines for Dualshock 4 support //
// While using a Dualshock 4 left side of touchpad is set //
// for "select" and right side is set for "start" //
// While using a non Dualshock 4 controller on PS4 full //
// support for Touchpad and Share button is enabled //
// PS4 Re-Authorization enabled manually //
// Restructured REVISION HISTORY section //
// //
// V1.1 (12/12/2015) //
// Added option to use Dual Shock 4 //
// TouchPad Button as "Select" //
// //
// V1.0 (12/02/2015) //
// First version of script based off original //
// Alternating Fire 1.2 //
//////////////////////////////////////////////////////////////////////////
// Questions about script can be addressed at //
// [email protected] //
//////////////////////////////////////////////////////////////////////////
define ON = 100; // Defines ON state of buttons / rumble //
define OFF = 0; // Defines OFF stat of buttons / rumble //
define ACTIVATOR_HOLD = 8; // Sets button to activate script //
define ACTIVATOR_TRIG = 2; // Sets button to activate script //
// To enable one button activation //
// set both to same value or use //
// two values to do button a //
// combination activation //
define TRIGGER = 20; // AlternatingFire Trigger //
define ALTFIRE = 17; // Button that alternates with Trigger //
// when trigger is held down //
define RAPIDAUX = 6; // Auxilary Rapidfire button //
define ALT_DELAY = 45; // Delay of Alternating Fire //
define AUX_DELAY = 40; // Delay of Auxilary Rapidfire //
define WLED = 75; // Wait time for LED cycling //
define RUMBLE = ON; // Set: ON / OFF / STRENGTH (#VALUE) //
define RUMBLE_TYPE = RUMBLE_A; // Set to: RUMBLE_A (strong) //
// RUMBLE_B (weak) //
define INITIAL_STATE = FALSE; // Initial State of controller //
//////////////////////////////////////////////////////////////////////////
int alternating_fire_on = INITIAL_STATE;
//////////////////////////////////////////////////////////////////////////
// DUAL SHOCK 4 COMPATIBILITY (AUTO) //
//////////////////////////////////////////////////////////////////////////
// //
//----------------------------------------------------------------------//
//---------------------PS4 RE-AUTHORIZATION SET UP----------------------//
//----------------------------------------------------------------------//
define REAUTH_HOLD = 2; /*--ASSIGN THIS TO THE BUTTON TO HOLD //
WHILE PRESSING TO //
ACTIVATE REAUTHORIZATION //
*/
define REAUTH_TRIG = 0; /*--ASSIGN THIS TO THE BUTTON USED TO //
TRIGGER RE-AUTHORIZATION WHILE //
HOLDING //
*/
//----------------------------------------------------------------------//
// CURRENTLY SET FOR HOLD "START" AND PRESS PS/XB BUTTON //
//----------------------------------------------------------------------//
// //
define SHARE_HOLD = 2; /*--ASSIGN THIS TO THE BUTTON TO HOLD //
WHILE PRESSING (SHARE_TRIG) TO ACTIVATE //
"SHARE" //
*/
define SHARE_TRIG = 13; /*--ASSIGN THIS TO THE BUTTON TO //
ACTIVATE "SHARE" HOLDING //
*/
//----------------------------------------------------------------------//
// "SHARE" CURRENTLY SET FOR HOLD "START" THEN PRESS PRESS UP //
//----------------------------------------------------------------------//
//////////////////////////////////////////////////////////////////////////
main {
set_rumble(RUMBLE_TYPE, OFF);
if(get_val(ACTIVATOR_HOLD) && get_val (ACTIVATOR_TRIG)) {
alternating_fire_on = !alternating_fire_on;
}
if(alternating_fire_on) {
combo_run(CycleLED);
}
if(alternating_fire_on && get_val(TRIGGER) > 99 ){
combo_stop(CycleLED);
combo_run(AlternatingFire);
} else if(combo_running(AlternatingFire)) {
combo_stop(AlternatingFire);
}
if(alternating_fire_on && get_val(RAPIDAUX) > 99 ){
combo_run(RapidAux);
} else if(combo_running(RapidAux)) {
combo_stop(RapidAux);
}
if(!alternating_fire_on) {
reset_leds();
}
//////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------//
//-------THIS IS FOR MANUAL REAUTHENTICATION WHEN USING T1 ON PS4-------//
if (get_val(REAUTH_HOLD) && event_press(REAUTH_TRIG)) { //
output_reconnection();} //
//----------------------------------------------------------------------//
// //
//-------THIS SECTION IS FOR WHEN USING NON DUAL SHOCK 4 ON A PS4-------//
if (get_console() == PIO_PS4 && get_controller() != PIO_PS4) { //
swap (27,1); //
if (get_val (SHARE_HOLD) && get_val(SHARE_TRIG)) { //
block (SHARE_HOLD,500); //
block (SHARE_TRIG,500); //
set_val (1,100); //
} //
} //
//----------------------------------------------------------------------//
// //
//-------THIS SECTION IS FOR WHEN USING DUAL SHOCK 4 ON ANY SYSTEM------//
if (get_console() != PIO_PS4 && get_controller() == PIO_PS4) { //
if (get_val(PS4_TOUCHX) < 0 && get_val(27)) { //
block (27,500); //
set_val(1,100); //
} //
if (get_val(PS4_TOUCHX) > 0 && get_val(27)) { //
block (27,500); //
set_val(2,100); //
} //
} //
//----------------------------------------------------------------------//
//////////////////////////////////////////////////////////////////////////
}
combo AlternatingFire {
set_val(TRIGGER, ON);
set_rumble(RUMBLE_TYPE, RUMBLE);
combo_run(led_ring_left);
wait(ALT_DELAY);
set_val(TRIGGER, OFF);
set_rumble(RUMBLE_TYPE, OFF);
set_val(ALTFIRE, ON);
set_rumble(RUMBLE_TYPE, RUMBLE);
combo_run(led_ring_right);
wait(ALT_DELAY);
set_val(ALTFIRE, OFF);
set_rumble(RUMBLE_TYPE, OFF);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 0);
set_led(LED_4, 0);
wait(ALT_DELAY);
}
combo RapidAux {
set_val(RAPIDAUX, ON);
wait(AUX_DELAY);
set_val(RAPIDAUX, OFF);
wait(AUX_DELAY);
}
combo CycleLED {
set_led(LED_1, 1);
set_led(LED_2, 0);
set_led(LED_3, 0);
set_led(LED_4, 0);
wait(WLED);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
set_led(LED_4, 0);
wait(WLED);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 0);
set_led(LED_4, 1);
wait(WLED);
set_led(LED_1, 0);
set_led(LED_2, 1);
set_led(LED_3, 0);
set_led(LED_4, 0);
wait(WLED);
}
combo led_ring_left {
set_led(LED_1, 1);
set_led(LED_2, 0);
set_led(LED_3, 0);
set_led(LED_4, 0);
wait(0);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
set_led(LED_4, 0);
wait(0);
}
combo led_ring_right {
set_led(LED_1, 0);
set_led(LED_2, 1);
set_led(LED_3, 0);
set_led(LED_4, 0);
wait(0);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 0);
set_led(LED_4, 1);
wait(0);
}