Help with deadzones
8 posts
• Page 1 of 1
Help with deadzones
I have the following code:
And the bottom part (else) triggers when I let go of the stick. It used to work perfectly but now that I've had deadzones develop, it's become very inconsistent. Is there anyway to improve the reliability of this now that I have bad deadzones?
- Code: Select all
if(get_val(LS_Y) <= sprint_threshold) {
run_flag = !run_flag;
} else if(event_release(LS_Y) > sprint_threshold_int) {
run_flag = !run_flag;
last_button_pressed_jump = FALSE;
last_button_pressed_crouch = FALSE;
}
And the bottom part (else) triggers when I let go of the stick. It used to work perfectly but now that I've had deadzones develop, it's become very inconsistent. Is there anyway to improve the reliability of this now that I have bad deadzones?
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR
My R6 script: https://youtu.be/x-9NtxyySVM
My R6 script: https://youtu.be/x-9NtxyySVM
-
pablosscripts - Brigadier General
- Posts: 1976
- Joined: Tue Nov 24, 2015 6:27 am
Re: Help with deadzones
The event_release() with sticks is triggered when the value cross the 20% mark, going to the rest position. Please give more details about the deadzone adjustments you are doing.
Also, the first conditional if(get_val(LS_Y) <= sprint_threshold) evaluates as TRUE whenever the LS_Y value is lower then sprint_threshold, which would make run_flag to toggle over and over. Maybe the inconsistency you are experiencing is related to this.
Also, the first conditional if(get_val(LS_Y) <= sprint_threshold) evaluates as TRUE whenever the LS_Y value is lower then sprint_threshold, which would make run_flag to toggle over and over. Maybe the inconsistency you are experiencing is related to this.
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Help with deadzones
I'm not even sure if it's the deadzone, but I just have a strong feeling it is. The reason is I'm using the Nintendo Joy-Cons which are known for having really bad deadzones, and it was working fine yesterday but now it's acting very inconsistent so that leads me to think it's somehow deadzone related.
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR
My R6 script: https://youtu.be/x-9NtxyySVM
My R6 script: https://youtu.be/x-9NtxyySVM
-
pablosscripts - Brigadier General
- Posts: 1976
- Joined: Tue Nov 24, 2015 6:27 am
Re: Help with deadzones
I solved it, but I still don't know how...
The variable sprint_threshold_int is set to 50. This is really inconsistent. It never works reliably.
But when I change it from a variable to a hardcoded value it works perfectly, so changing it from this:
To this:
Seemed to fix it. I've been testing it a lot and it seems rock solid now. Any idea why?
The variable sprint_threshold_int is set to 50. This is really inconsistent. It never works reliably.
But when I change it from a variable to a hardcoded value it works perfectly, so changing it from this:
- Code: Select all
if(get_val(LS_Y) <= sprint_threshold) {
run_flag = !run_flag;
} else if(event_release(LS_Y) > sprint_threshold_int) {
run_flag = !run_flag;
last_button_pressed_jump = FALSE;
last_button_pressed_crouch = FALSE;
}
To this:
- Code: Select all
if(get_val(LS_Y) <= sprint_threshold) {
run_flag = !run_flag;
} else if(event_release(LS_Y) > 50) {
run_flag = !run_flag;
last_button_pressed_jump = FALSE;
last_button_pressed_crouch = FALSE;
}
Seemed to fix it. I've been testing it a lot and it seems rock solid now. Any idea why?
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR
My R6 script: https://youtu.be/x-9NtxyySVM
My R6 script: https://youtu.be/x-9NtxyySVM
-
pablosscripts - Brigadier General
- Posts: 1976
- Joined: Tue Nov 24, 2015 6:27 am
Re: Help with deadzones
pablosscripts wrote:Any idea why?
I just noticed something I missed when replied you yesterday, this part
- Code: Select all
} else if(event_release(LS_Y) > 50) {
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Help with deadzones
Hum interesting, ok so the correct way to code this would be:
Is that right?
And is this the same as GPC1? I simply ported some T1 code over, or was the original code flawed as well?
- Code: Select all
} else if(event_release(LS_Y) == TRUE) {
or I guess this is the same:
} else if(event_release(LS_Y)) {
Is that right?
And is this the same as GPC1? I simply ported some T1 code over, or was the original code flawed as well?
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR
My R6 script: https://youtu.be/x-9NtxyySVM
My R6 script: https://youtu.be/x-9NtxyySVM
-
pablosscripts - Brigadier General
- Posts: 1976
- Joined: Tue Nov 24, 2015 6:27 am
Re: Help with deadzones
both options are correct, but the second one
- Code: Select all
} else if(event_release(LS_Y)) {
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Help with deadzones
awesome thank you
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR
My R6 script: https://youtu.be/x-9NtxyySVM
My R6 script: https://youtu.be/x-9NtxyySVM
-
pablosscripts - Brigadier General
- Posts: 1976
- Joined: Tue Nov 24, 2015 6:27 am
8 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 49 guests