Request:Remap sticks when pressed R2 and L2 together

GPC2 script programming for Titan Two. Code examples, questions, requests.

Request:Remap sticks when pressed R2 and L2 together

Postby unisistar » Sat Dec 07, 2019 11:52 am

please help with scrip on T2.

I have PS4 and want to remap/swap ps dualshock4 controllers' rigt stick with left stik only when L2 and R2 buttons are pushed and being hold pressed togehter. When one of L2 or R2 button is released, the right stick and left stick changes back ( means rigts stick is right, left is left again)

I am new at scripting. please help. Thank you.
User avatar
unisistar
Private
Private
 
Posts: 1
Joined: Sun Sep 29, 2019 6:33 pm

Re: Request:Remap sticks when pressed R2 and L2 together

Postby DontAtMe » Sat Dec 07, 2019 2:26 pm

Code: Select all
#include <ps4.gph>
 
main {
  if(is_active(PS4_R2) && is_active(PS4_L2)){
    swap_inputs(PS4_RX, PS4_LX);
    swap_inputs(PS4_RY, PS4_LY);
  }
}
 
void swap_inputs(uint8 input_one, uint8 input_two){
  fix32 temp = get_val(input_one);
  set_val(input_one, get_val(input_two));
  set_val(input_two, temp);
}
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 100 guests