Faster than 40MS without random stops?
7 posts
• Page 1 of 1
Faster than 40MS without random stops?
Is is possible to go faster than the 40MS in this code
It works for about 10 seconds then cuts off for 4+ seconds before starting again. Anything higher than 40MS just seems to take forever.
- Code: Select all
int loop;
main {
if (event_press(PS4_DOWN)) {loop=!loop;}
if (loop) {
combo_run(SpendingTokens);
combo_run(disablebuttons);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
set_led(LED_4, 0);
}
if (!loop) {
combo_stop(SpendingTokens);
combo_stop(disablebuttons);
set_led(LED_1, 0);
set_led(LED_2, 1);
set_led(LED_3, 0);
set_led(LED_4, 0);
}
}
combo SpendingTokens {
set_val(PS4_CROSS, 1)
wait(40) ;
set_val(PS4_CROSS, 0);
}
combo disablebuttons {
set_val(PS4_PS, 0);
set_val(PS4_SHARE, 0);
set_val(PS4_OPTIONS, 0);
set_val(PS4_R1, 0);
set_val(PS4_R2, 0);
set_val(PS4_R3, 0);
set_val(PS4_L1, 0);
set_val(PS4_L2, 0);
set_val(PS4_L3, 0);
set_val(PS4_RX, 0);
set_val(PS4_RY, 0);
set_val(PS4_LY, 0);
set_val(PS4_LX, 0);
set_val(PS4_UP, 0);
// set_val(PS4_DOWN, 0);
set_val(PS4_LEFT, 0);
set_val(PS4_RIGHT, 0);
set_val(PS4_TRIANGLE, 0);
set_val(PS4_CIRCLE, 0);
// set_val(PS4_CROSS, 0);
set_val(PS4_SQUARE, 0);
set_val(PS4_TOUCH, 0);
}
It works for about 10 seconds then cuts off for 4+ seconds before starting again. Anything higher than 40MS just seems to take forever.
-
xcier - Private First Class
- Posts: 2
- Joined: Sat Sep 08, 2018 6:59 pm
Re: Faster than 40MS without random stops?
I don't remember if the T1 works fine when calling set_led on every loop run.
With the T2 this will cause trouble.
Try if this works better with your T1:
With the T2 this will cause trouble.
Try if this works better with your T1:
- Code: Select all
int loop;
main {
if (event_press(PS4_DOWN)) {
loop=!loop;
if (loop) {
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
set_led(LED_4, 0);
} else {
set_led(LED_1, 0);
set_led(LED_2, 1);
set_led(LED_3, 0);
set_led(LED_4, 0);
combo_stop(SpendingTokens);
combo_stop(disablebuttons);
}
}
if (loop) {
combo_run(SpendingTokens);
combo_run(disablebuttons);
}
}
combo SpendingTokens {
set_val(PS4_CROSS, 1);
wait(20);
set_val(PS4_CROSS, 0);
wait(20);
}
combo disablebuttons {
set_val(PS4_PS, 0);
set_val(PS4_SHARE, 0);
set_val(PS4_OPTIONS, 0);
set_val(PS4_R1, 0);
set_val(PS4_R2, 0);
set_val(PS4_R3, 0);
set_val(PS4_L1, 0);
set_val(PS4_L2, 0);
set_val(PS4_L3, 0);
set_val(PS4_RX, 0);
set_val(PS4_RY, 0);
set_val(PS4_LY, 0);
set_val(PS4_LX, 0);
set_val(PS4_UP, 0);
// set_val(PS4_DOWN, 0);
set_val(PS4_LEFT, 0);
set_val(PS4_RIGHT, 0);
set_val(PS4_TRIANGLE, 0);
set_val(PS4_CIRCLE, 0);
// set_val(PS4_CROSS, 0);
set_val(PS4_SQUARE, 0);
set_val(PS4_TOUCH, 0);
wait(40);
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Faster than 40MS without random stops?
not really sure why your combo was pausing every 10 seconds.
However I did make some changes to your script.
However I did make some changes to your script.
- Code: Select all
int i;
main {
if (event_press(PS4_DOWN)){
if (combo_running(SpendingTokens)) { combo_stop(SpendingTokens); set_led(LED_2, 1); set_led(LED_3, 0); }
else if (!combo_running(SpendingTokens)) { combo_run(SpendingTokens); set_led(LED_3, 1); set_led(LED_2, 0); }
}
if (combo_running(SpendingTokens)) block_all_inputs();
}
function block_all_inputs(){
i = 20;
while(i!=-1) { set_val(i, 0); i--; }
}
combo SpendingTokens {
set_val(PS4_CROSS, 100);
wait(40); wait(30);
combo_restart(SpendingTokens);
wait(10);
}
-
Sillyasskid - Captain
- Posts: 574
- Joined: Sat May 14, 2016 3:07 am
Re: Faster than 40MS without random stops?
Silly, is the "i' variable referring to the button index value parsed by the T1?
I understand it's the same as saying e.g { set_val (20, 0); }, but didn't realise we could use index values as shorthand. Does the same apply to T2?
I understand it's the same as saying e.g { set_val (20, 0); }, but didn't realise we could use index values as shorthand. Does the same apply to T2?
-
antithesis - Colonel
- Posts: 1912
- Joined: Sat May 28, 2016 10:45 pm
Re: Faster than 40MS without random stops?
Yes, for T2 BUTTON_4 is the same as number 3 , the BUTTON_ are in uint8 type.
the F1 GPC Input Reference shows the number for them..left most numbers/column.
the F1 GPC Input Reference shows the number for them..left most numbers/column.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Faster than 40MS without random stops?
I fixed it with this. Runs much smoother now Fastest I can get it without jitter.
- Code: Select all
int loop;
main {
if (event_press(PS4_R3)) {loop=!loop;}
if (loop) {
combo_run(SpendingTokens);
combo_run(disablebuttons);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1); //shows red on controller to show script not running
set_led(LED_4, 0);
}
if (!loop) {
combo_stop(SpendingTokens);
combo_stop(disablebuttons);
set_led(LED_1, 0);
set_led(LED_2, 1); // shows green on controller to show script is running
set_led(LED_3, 0);
set_led(LED_4, 0);
}
}
combo SpendingTokens {
set_val(PS4_CROSS, 1);
wait(11); // fastest possible time
set_val(PS4_CROSS, 0);
wait(10); // fastest possible time
set_val(PS4_CROSS, 0);
}
combo disablebuttons {
set_val(PS4_PS, 0);
set_val(PS4_SHARE, 0);
set_val(PS4_OPTIONS, 0);
set_val(PS4_R1, 0);
set_val(PS4_R2, 0);
set_val(PS4_R3, 0);
set_val(PS4_L1, 0);
set_val(PS4_L2, 0);
set_val(PS4_L3, 0);
set_val(PS4_RX, 0);
set_val(PS4_RY, 0);
set_val(PS4_LY, 0);
set_val(PS4_LX, 0);
set_val(PS4_UP, 0);
// set_val(PS4_DOWN, 0);
set_val(PS4_LEFT, 0);
set_val(PS4_RIGHT, 0);
set_val(PS4_TRIANGLE, 0);
set_val(PS4_CIRCLE, 0);
// set_val(PS4_CROSS, 0);
set_val(PS4_SQUARE, 0);
set_val(PS4_TOUCH, 0);
}
-
xcier - Private First Class
- Posts: 2
- Joined: Sat Sep 08, 2018 6:59 pm
Re: Faster than 40MS without random stops?
You still should move the led stuff to the loop toggle itself.
Doing that stuff all the time without being needed may introduce lag.
No need to set the led each time without it is changing
or to run combo_stop each time, you only need to stop it once when the loop variable changes to false.
This should work the same as yours while not calling that stuff all the time without state changes:
Doing that stuff all the time without being needed may introduce lag.
No need to set the led each time without it is changing
or to run combo_stop each time, you only need to stop it once when the loop variable changes to false.
This should work the same as yours while not calling that stuff all the time without state changes:
- Code: Select all
int loop;
main {
if (event_press(PS4_R3)) {
loop=!loop;
if (loop) { // changed to on
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1); //shows red on controller to show script not running
set_led(LED_4, 0);
} else { // changed to off
set_led(LED_1, 0);
set_led(LED_2, 1); // shows green on controller to show script is running
set_led(LED_3, 0);
set_led(LED_4, 0);
combo_stop(SpendingTokens);
combo_stop(disablebuttons);
}
}
if (loop) { // as long that is true/on run the combos
combo_run(SpendingTokens);
combo_run(disablebuttons);
}
}
combo SpendingTokens {
set_val(PS4_CROSS, 1);
wait(11); // fastest possible time
set_val(PS4_CROSS, 0);
wait(10); // fastest possible time
set_val(PS4_CROSS, 0);
}
combo disablebuttons {
set_val(PS4_PS, 0);
set_val(PS4_SHARE, 0);
set_val(PS4_OPTIONS, 0);
set_val(PS4_R1, 0);
set_val(PS4_R2, 0);
set_val(PS4_R3, 0);
set_val(PS4_L1, 0);
set_val(PS4_L2, 0);
set_val(PS4_L3, 0);
set_val(PS4_RX, 0);
set_val(PS4_RY, 0);
set_val(PS4_LY, 0);
set_val(PS4_LX, 0);
set_val(PS4_UP, 0);
// set_val(PS4_DOWN, 0);
set_val(PS4_LEFT, 0);
set_val(PS4_RIGHT, 0);
set_val(PS4_TRIANGLE, 0);
set_val(PS4_CIRCLE, 0);
// set_val(PS4_CROSS, 0);
set_val(PS4_SQUARE, 0);
set_val(PS4_TOUCH, 0);
wait(21);
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
7 posts
• Page 1 of 1
Return to GPC1 Script Programming
Who is online
Users browsing this forum: No registered users and 146 guests