Trigger to analog stick remap for driving games
7 posts
• Page 1 of 1
Trigger to analog stick remap for driving games
I need to map ps4 controller r2 to left stick y axis 0 - -100 and l2 to left stick y axis 0 - 100. In other words, left analog up is throttle and left analog down is brake. Any ideas for scripting? Also could use a ~10 deadband.
-
berumsey - Corporal
- Posts: 4
- Joined: Fri Jun 13, 2014 8:33 pm
Re: Trigger to analog stick remap for driving games
Easy enough, you'd want to set up in the main, if LY is greater than 20 (deadzone) then press R2, otherwise press L2 etc.
Here's a section from my sixaxis remapper script that you should find useful, with a few tweaks it will work for you. ;)
(I'm sure you can figure out the rest).
Here's a section from my sixaxis remapper script that you should find useful, with a few tweaks it will work for you. ;)
(I'm sure you can figure out the rest).
- Code: Select all
if(get_val(PS3_LY) > 20) {
//down
set_val(PS3_ACCY, get_val(StickY));
set_val(PS3_LY, 0);
} else {
set_val(PS3_ACCY, get_val(StickY));
set_val(PS3_LY, 0);
}
-
CypherNova139 - Staff Sergeant
- Posts: 13
- Joined: Sat May 10, 2014 5:11 am
Re: Trigger to analog stick remap for driving games
Thank you for the tip!
My script is:
Works great!
My script is:
- Code: Select all
unmap PS4_RX;
unmap PS4_RY;
remap PS4_RX -> PS4_LX;
remap PS4_RY -> PS4_LY;
unmap PS4_ACCX;
unmap PS4_ACCY;
unmap PS4_ACCZ;
main {
//up
if(get_val(PS4_LY) > -10) {
set_val(PS4_R2, 0);
} else {
set_val(PS4_R2, inv(get_val(PS4_LY)));
}
//down
if(get_val(PS4_LY) < 10) {
set_val(PS4_L2, 0);
} else {
set_val(PS4_L2, get_val(PS4_LY));
}
}
Works great!
-
berumsey - Corporal
- Posts: 4
- Joined: Fri Jun 13, 2014 8:33 pm
Re: Trigger to analog stick remap for driving games
Nice! Glad to see ya figured out how to get it to work! But what is all the remap codes for?
Btw, You got me curious enough that I redid my sixaxis script after posting my first post on this thread, you might try this out too. Its a bit more complex but you can switch which stick is remapped on the fly.
Btw, You got me curious enough that I redid my sixaxis script after posting my first post on this thread, you might try this out too. Its a bit more complex but you can switch which stick is remapped on the fly.
-
CypherNova139 - Staff Sergeant
- Posts: 13
- Joined: Sat May 10, 2014 5:11 am
Re: Trigger to analog stick remap for driving games
Had to remap the controller right stick to work the left stick output. Not only does it give me steering on right stick in nfs rivals, but menu control since the left stick y axis is now R2-L2 "gas and brake". The unmap rx and ry makes it so right stick movement doesn't output both sticks. The acc* unmaps make it ignore gyroscope input, which I would assume makes the cpu load on the cm lower and therefore run "probably imperceptibly" cooler. Make sense?
-
berumsey - Corporal
- Posts: 4
- Joined: Fri Jun 13, 2014 8:33 pm
Re: Trigger to analog stick remap for driving games
Ah, didn't know you were using the right stick as well, makes sense now.
FYI:
Just tested in Device Monitor the CPU load of no scripts running, and a script with JUST the sixaxis unmaps. Both kept CPU load at 9%, no perceptible difference.
But I tested the same with your script, running it, then commenting out the unmaps, then running it again..
Without the comments (aka sixaxis disabled) I got the CPU load to randomly pop to 9% instead of the usual 10%. Commented version stayed at 10%.
As far as my scripts, they average 11-15%, going to 20% occasionally if you are running the customization features. After using those scripts the CM produces about as much heat as I'd expect from a little dongle with a CPU inside. So its up to you whether you believe there is a heat difference or not from CPU load.
FYI:
Just tested in Device Monitor the CPU load of no scripts running, and a script with JUST the sixaxis unmaps. Both kept CPU load at 9%, no perceptible difference.
But I tested the same with your script, running it, then commenting out the unmaps, then running it again..
Without the comments (aka sixaxis disabled) I got the CPU load to randomly pop to 9% instead of the usual 10%. Commented version stayed at 10%.
As far as my scripts, they average 11-15%, going to 20% occasionally if you are running the customization features. After using those scripts the CM produces about as much heat as I'd expect from a little dongle with a CPU inside. So its up to you whether you believe there is a heat difference or not from CPU load.
-
CypherNova139 - Staff Sergeant
- Posts: 13
- Joined: Sat May 10, 2014 5:11 am
Re: Trigger to analog stick remap for driving games
Is anyone able to do the reverse? I want the L2 and R2 buttons to function as the left (or right) analog stick. L2 being down and R2 being up, while retaining full analog functionality. My goal is to be able to have analog pedals for Nintendo Switch games and this is the only way to do so (Logictech USB steering wheel).
-
marioxb - Corporal
- Posts: 4
- Joined: Wed Feb 28, 2024 6:30 pm
7 posts
• Page 1 of 1
Return to GPC1 Script Programming
Who is online
Users browsing this forum: No registered users and 28 guests