// ___
// |_ _|_ ____ _____ _ __ ___ _ ___ _ __
// | || '_ \ \ / / _ \ '__/ __| |/ _ \| '_ \
// | || | | \ V / __/ | \__ \ | (_) | | | |
// |___|_| |_|\_/ \___|_| |___/_|\___/|_| |_|
// (_)
//For me at least, whether I play with the camera controls 'Inverted' or not depends on 1st or 3rd person field of view. This can get dicey when playing a 3rd person game 'inverted', then scoping in on a target (which is 'normal' controls to me when using 1st person).
//Sometime the game developers get my style of camera controls down, others invert all or nothing, which the latter is getting increasingly common with new games these days, so....
//This script allows you to change normal/inverted camera settings without continually modfying the game's camera options,
// allowing for quick changes of camera controls to your liking.
//Controls:
// R3 (or 'triggerkey', defined below): Switch profiles on the fly. Useful if you are in the middle of a game.
// Select (hold): Options menu. LEDs will indicate what axises are inverted. (LED on = Inverted)
//LED 4 / L1 = LY (left up/down)
//LED 3 / L2 = LX (left left/right)
//LED 2 / R1 = RY (right up/down)
//LED 1 / R2 = RX (right left/right)
//While holding Select:
// L1,L2,R1,R2: Invert/normalize left or right stick axises. These changes are live and available for use immediately.
// L3: Save Profile #1 to current settings. (A rumble will indicate success)
// R3: Save Profile #2 to current settings. (A rumble will indicate success)
// Start: View / Switch profile settings on the LEDs. (Press again to switch which profile is viewed. A rumble will indicate which profile is selected. Changes are live immediately.)
//"TRACEs" (notifications, view in Device Monitor while your device is hooked up to your PC)
//TRACE_1-4: Same as controller LEDs to indicate inversion status. 0 = off, 1 = on. Update status by holding Select. This is a workaround for 360 controller LEDs.
//TRACE_5: Counter of triggerkey presses
//TRACE_6: Which profile is running, 1 or 2
//While holding Select:
//TRACE_6: Status of profiles: 1 or 2 = current profile you are viewing, 3 = profile 1 saved, 4 = profile 2 saved
int invertLY, invertLX, invertRY, invertRX, triggerkey, profile, buttonpress;
init {
// Activate profiles: 0 = disable, 1 = enable.
profile = 1
// Profile trigger key: When this button is pressed, the script will switch 'profiles'.
// It would be useful to map this to your weapon's scope button, or the button to use binoculars;
// aka something that you need to quickly invert the camera controls when you are using this object.
triggerkey = PS3_R3
// There is no need to change anything else!
//This script will start by not inverting anything.
invertLY = 0
invertLX = 0
invertRY = 0
invertRX = 0
}
main {
//Reset leds after customizing script
if(get_val(PS3_SELECT) != 100) {
set_led(0,0);
set_led(1,0);
set_led(2,0);
set_led(3,0);
reset_leds();
}
buttonpress = get_ptime(PS3_SELECT);
// press - send to console
if(event_release(PS3_SELECT) && get_ptime(PS3_SELECT) < 140) {
combo_run(cpress);
}
// hold - customize part of script
if(get_val(PS3_SELECT) && get_ptime(PS3_SELECT) > 140) {
combo_run(customize);
}
// Completely block output to console from the controller. If button was pressed, then the press is recreated.
if(get_val(PS3_SELECT)) {
set_val(PS3_SELECT,0);
}
//Triggerkey: switches profiles on the fly
if(event_press(triggerkey) && !combo_running(customize)) {
set_val(TRACE_5, get_val(TRACE_5) + 1);
if(profile == 1) {
//Profile #2
set_val(TRACE_6, 2);
profile = 2;
combo_run(Rumble2);
invertLY = get_pvar(SPVAR_5, 0, 2, 0);
invertLX = get_pvar(SPVAR_6, 0, 2, 0);
invertRY = get_pvar(SPVAR_7, 0, 2, 0);
invertRX = get_pvar(SPVAR_8, 0, 2, 0);
} else if(profile == 2) {
set_val(TRACE_6, 1);
profile = 1;
combo_run(Rumble1);
invertLY = get_pvar(SPVAR_1, 0, 2, 0);
invertLX = get_pvar(SPVAR_2, 0, 2, 0);
invertRY = get_pvar(SPVAR_3, 0, 2, 0);
invertRX = get_pvar(SPVAR_4, 0, 2, 0);
}
}
//The actual inversions!!!
//LY (left stick up/down)
if(invertLY == 1) {
if(get_val(PS3_LY) > 20) {
//down
set_val(PS3_LY, get_val(PS3_LY) * -1);
} else {
set_val(PS3_LY, get_val(PS3_LY) * -1);
}
}
//LX (left stick left/right)
if(invertLX == 1) {
if(get_val(PS3_LX) > 20) {
//right
set_val(PS3_LX, get_val(PS3_LX) * -1);
} else {
set_val(PS3_LX, get_val(PS3_LX) * -1);
}
}
//RY (right stick up/down)
if(invertRY == 1) {
if(get_val(PS3_RY) > 20) {
//down
set_val(PS3_RY, get_val(PS3_RY) * -1);
} else {
set_val(PS3_RY, get_val(PS3_RY) * -1);
}
}
//RX (right stick left/right)
if(invertRX == 1) {
if(get_val(PS3_RX) > 20) {
//right
set_val(PS3_RX, get_val(PS3_RX) * -1);
} else {
set_val(PS3_RX, get_val(PS3_RX) * -1);
}
}
}
combo Rumble1 {
// 1 short rumble
set_rumble(RUMBLE_B, 100);
wait(200);
set_rumble(RUMBLE_B, 0);
}
combo Rumble11 {
// 1 short rumble, 1 long rumble
set_rumble(RUMBLE_B, 100);
wait(200);
set_rumble(RUMBLE_B, 0);
wait(250);
set_rumble(RUMBLE_B, 100);
wait(400);
set_rumble(RUMBLE_B, 0);
}
combo Rumble2 {
// 2 short rumbles
set_rumble(RUMBLE_B, 100);
wait(200);
set_rumble(RUMBLE_B, 0);
wait(200);
set_rumble(RUMBLE_B, 100);
wait(200);
set_rumble(RUMBLE_B, 0);
}
combo Rumble22 {
// 2 short rumbles, 1 long rumble
set_rumble(RUMBLE_B, 100);
wait(200);
set_rumble(RUMBLE_B, 0);
wait(200);
set_rumble(RUMBLE_B, 100);
wait(200);
set_rumble(RUMBLE_B, 0);
wait(250);
set_rumble(RUMBLE_B, 100);
wait(400);
set_rumble(RUMBLE_B, 0);
}
combo customize {
//Press Start to view profile inversion settings.
if(event_press(PS3_START)) {
if(profile == 1) {
//Profile #2
set_val(TRACE_6, 2);
profile = 2;
combo_run(Rumble2);
invertLY = get_pvar(SPVAR_5, 0, 2, 0);
invertLX = get_pvar(SPVAR_6, 0, 2, 0);
invertRY = get_pvar(SPVAR_7, 0, 2, 0);
invertRX = get_pvar(SPVAR_8, 0, 2, 0);
} else if(profile == 2) {
set_val(TRACE_6, 1);
profile = 1;
combo_run(Rumble1);
invertLY = get_pvar(SPVAR_1, 0, 2, 0);
invertLX = get_pvar(SPVAR_2, 0, 2, 0);
invertRY = get_pvar(SPVAR_3, 0, 2, 0);
invertRX = get_pvar(SPVAR_4, 0, 2, 0);
}
}
//LED notifications on what inversions are enabled
//4 / L1 = LY
//3 / L2 = LX
//2 / R1 = RY
//1 / R2 = RX
// set_led(0,0);
// set_led(1,0);
// set_led(2,0);
// set_led(3,0);
if(invertLY == 1) {
set_led(3, 1);
set_val(TRACE_1, 1);
} else {
set_led(3, 0);
set_val(TRACE_1, 0);
}
if(invertLX == 1) {
set_led(2, 1);
set_val(TRACE_2, 1);
} else {
set_led(2, 0);
set_val(TRACE_2, 0);
}
if(invertRY == 1) {
set_led(1, 1);
set_val(TRACE_3, 1);
} else {
set_led(1, 0);
set_val(TRACE_3, 0);
}
if(invertRX == 1) {
set_led(0, 1);
set_val(TRACE_4, 1);
} else {
set_led(0, 0);
set_val(TRACE_4, 0);
}
//LY
if(event_press(PS3_L1)) {
if(invertLY == 1) {
invertLY = 0
set_led(3, 1);
} else {
invertLY = 1
set_led(3, 0);
}
}
//LX
if(event_press(PS3_L2)) {
if(invertLX == 1) {
invertLX = 0
set_led(2, 1);
} else {
invertLX = 1
set_led(2, 0);
}
}
//RY
if(event_press(PS3_R1)) {
if(invertRY == 1) {
invertRY = 0
set_led(1, 1);
} else {
invertRY = 1
set_led(1, 0);
}
}
//RX
if(event_press(PS3_R2)) {
if(invertRX == 1) {
invertRX = 0
set_led(0, 1);
} else {
invertRX = 1
set_led(0, 0);
}
}
// Profile save
if(event_press(PS3_L3)) {
combo_run(Rumble11);
set_val(TRACE_6, 3);
set_pvar(SPVAR_1, invertLY);
set_pvar(SPVAR_2, invertLX);
set_pvar(SPVAR_3, invertRY);
set_pvar(SPVAR_4, invertRX);
}
if(event_press(PS3_R3)) {
combo_run(Rumble22);
set_val(TRACE_6, 4);
set_pvar(SPVAR_5, invertLY);
set_pvar(SPVAR_6, invertLX);
set_pvar(SPVAR_7, invertRY);
set_pvar(SPVAR_8, invertRX);
}
//Disable commands to console while selecting script options
set_val(PS3_L1, 0);
set_val(PS3_L2, 0);
set_val(PS3_R1, 0);
set_val(PS3_R2, 0);
set_val(PS3_L3, 0);
set_val(PS3_R3, 0);
set_val(PS3_START, 0);
}
combo cpress {
set_val(TRACE_3, buttonpress);
set_val(PS3_SELECT, 100);
wait(buttonpress);
set_val(PS3_SELECT, 0);
}