Accessibility: Swap Sticks

Tap VIEW / TOUCH-CLICK / SELECT / BACK / MINUS to swap the sticks. BLUE-LED = NORMAL RED-LED = SWAPPED STICKS (including L3 and R3) To access the lost button function press VIEW + MENU (the two main menu buttons).
Version1.0
AuthorSpecialEffect
Publish DateTue, 26 Jul 2022 - 09:30
Last UpdateTue, 26 Jul 2022 - 09:30
Downloads12
RATE


0

0

Release Notes: Search "accessibility" for more scripts on repurposing the sticks. Contact [email protected] for more help. See www.specialeffect.org.uk
Code: Select all
// 19-07-2022 [email protected]
// SWAP STICKS = TAP VIEW/TOUCH-CLICK/SELECT/BACK (blue LED = left-stick / red LED = right-stick)
// PRESS BOTH MENU BUTTONS FOR VIEW/TOUCH-CLICK/SELECT/BACK (e.g. VIEW+MENU / SELECT+START / TOUCH-CLICK+OPTIONS)
 
 
 
// JOYSTICK SENSITIVITY ADJUSTMENT
define SENSITIVITY = 100; // SENSITIVITY % (DEFAULT=100 - MAX=327).
define MID_POINT = 50; // INPUT MIDPOINT IS (DEFAULT=50  - MORE SENSITIVE=25).
define JOY_DEADZONE = 20; // (DEFAULT=20 - MAX=99 - FOR SENSITIVE TRY 35).
 
define TWEAK = 20; // will add to JOY-DEADZONE - normally useful for one-stick steering
define JOY_BUTTONS_DEADZONE = 80; // JOYSTICK ACTING AS BUTTONS - NEEDS A BIGGER DEADZONE TO AVOID ACCIDENTAL PRESSES
define Z_DEADZONE = 5; // TRIGGERS
define LSTICK_MAX = 100; // ANALOGUE CONTROLS MAXIMUM OUPUT (0-100%)
define RSTICK_MAX = 100;
define TRIGGERS_MAX = 100;
 
 
// MODES
define CLEAR_LED = 9;
define LEFTSTICK = 0;
define RIGHTSTICK = 2;
 
int profile = CLEAR_LED;
int StickToggle = TRUE; //  STARTING STICK - TRUE = STANDARD / FALSE = SWAPPED STICKS
 
 
main {
 
// INITIALISE
        if(profile == CLEAR_LED) {profile = LEFTSTICK; colorled(1,0,0,0);}
 
// SET SENSITIVITY
deadzone(PS3_LX, PS3_LY, DZ_CIRCLE, 0); sensitivity (PS3_LX, MID_POINT, SENSITIVITY);sensitivity (PS3_LY, MID_POINT, SENSITIVITY);
deadzone(PS3_RX, PS3_RY, DZ_CIRCLE, 0); sensitivity (PS3_RX, MID_POINT, SENSITIVITY);sensitivity (PS3_RY, MID_POINT, SENSITIVITY);
 
 
// IF "SELECT" HELD...
 
 
  if (event_press(PS3_SELECT)) {StickToggle = !StickToggle;set_val(PS3_SELECT,0);} // Toggles between left and right movements
  if (StickToggle) { profile = LEFTSTICK; colorled(1,0,0,0); }
  if (!StickToggle) { profile = RIGHTSTICK; colorled(0,1,0,0); }
 
  if ((get_val(PS3_SELECT) == 100) && (get_val(PS3_START) == 100)) {set_val(PS3_SELECT,100);set_val(PS3_START,0);} else set_val(PS3_SELECT,0);
 
 
 
 
 
 
// LEFT-STICK MODE (BLUE)
 
        if(profile == LEFTSTICK) {
 
        if(get_val(PS3_LX) <= JOY_DEADZONE && get_val(PS3_LX) >= JOY_DEADZONE*-1) set_val(PS3_LX,0); // DEAD-ZONE FILTER
        if(get_val(PS3_LY) <= JOY_DEADZONE && get_val(PS3_LY) >= JOY_DEADZONE*-1) set_val(PS3_LY,0);
        if(get_val(PS3_L2) <= Z_DEADZONE && get_val(PS3_L2) >= Z_DEADZONE*-1) set_val(PS3_L2,0);
 
        if(get_val(PS3_LX) >= LSTICK_MAX) {set_val(PS3_LX, LSTICK_MAX);} // MAXIMUM STRENGTH LIMITER
        if(get_val(PS3_LX) <= -LSTICK_MAX) {set_val(PS3_LX, -LSTICK_MAX);}
        if(get_val(PS3_LY) >= LSTICK_MAX) {set_val(PS3_LY, LSTICK_MAX);}
        if(get_val(PS3_LY) <= -LSTICK_MAX) {set_val(PS3_LY, -LSTICK_MAX);}
        if(get_val(PS3_L2) >= TRIGGERS_MAX) {set_val(PS3_L2, TRIGGERS_MAX);}
        }
 
 
 
// RIGHT-STICK MODE (RED)
 
        else if(profile == RIGHTSTICK) {
        swap(PS3_LX, PS3_RX); swap(PS3_LY, PS3_RY); // REMAPPING
 
        if(get_val(PS3_RX) <= JOY_DEADZONE && get_val(PS3_RX) >= JOY_DEADZONE*-1) set_val(PS3_RX,0); // DEAD-ZONE FILTER
        if(get_val(PS3_RY) <= JOY_DEADZONE && get_val(PS3_RY) >= JOY_DEADZONE*-1) set_val(PS3_RY,0);
        if(get_val(PS3_R2) <= Z_DEADZONE && get_val(PS3_R2) >= Z_DEADZONE*-1) set_val(PS3_R2,0);
 
        if(get_val(PS3_RX) >= RSTICK_MAX) {set_val(PS3_RX, RSTICK_MAX);} // MAXIMUM STRENGTH LIMITER
        if(get_val(PS3_RX) <= -RSTICK_MAX) {set_val(PS3_RX, -RSTICK_MAX);}
        if(get_val(PS3_RY) >= RSTICK_MAX) {set_val(PS3_RY, RSTICK_MAX);}
        if(get_val(PS3_RY) <= -RSTICK_MAX) {set_val(PS3_RY, -RSTICK_MAX);}
        if(get_val(PS3_L2) >= TRIGGERS_MAX) {set_val(PS3_L2, TRIGGERS_MAX);}
        if(get_val(PS3_L2) >= TRIGGERS_MAX) {set_val(PS3_L2, TRIGGERS_MAX);}
        swap(PS3_L3, PS3_R3); // REMAPPING
        }
 
 
}
 
 
 
 
// COLOR LED INDICATION for PS4 *NO NEED TO EDIT BELOW*
//--------------------------------------------------------------
function colorled(a,b,c,d) {
set_led(LED_1,a);
set_led(LED_2,b);
set_led(LED_3,c);
set_led(LED_4,d);
}
 
// colorled(0,0,0,0); // Off / No LED light
// colorled(1,0,0,0); // Dim Blue
// colorled(0,1,0,0); // Dim Red
// colorled(0,0,1,0); // Dim Lime/Green
// colorled(0,0,0,1); // Dim Fuchsia/Pink
// colorled(1,0,1,0); // Dim SkyBlue
// colorled(0,1,1,0); // Dim Yellow
// colorled(1,1,1,1); // Dim White
// colorled(2,0,0,0); // Blue 
// colorled(0,2,0,0); // Red
// colorled(0,0,2,0); // Lime/Green
// colorled(0,0,0,2); // Fuchsia/Pink
// colorled(2,0,2,0); // SkyBlue
// colorled(0,2,2,0); // Yellow
// colorled(2,2,2,2); // White
// colorled(3,0,0,0); // Bright Blue
// colorled(0,3,0,0); // Bright Red
// colorled(0,0,3,0); // Bright Lime/Green
// colorled(0,0,0,3); // Bright Fuchsia/Pink
// colorled(3,0,3,0); // Bright SkyBlue
// colorled(0,3,3,0); // Bright Yellow
// colorled(3,3,3,3); // Bright white
// ColorLed (1) Dim light
// ColorLed (2) LEFTSTICK/Medium
// ColorLed (3) Bright light