Help make this script loop for (x) amount of time, ASAP!
41 posts
• Page 2 of 5 • 1, 2, 3, 4, 5
Re: Help make this script loop for (x) amount of time, ASAP!
for me it seems to work fine. tested on t2 as I have no t1.
make sure to run the code I have posted. The last combo resets the timer and this will let the first combo run again.
make sure to run the code I have posted. The last combo resets the timer and this will let the first combo run again.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Help make this script loop for (x) amount of time, ASAP!
Scachi wrote:for me it seems to work fine. tested on t2 as I have no t1.
make sure to run the code I have posted. The last combo resets the timer and this will let the first combo run again.
Okay! So I tried it again, and it seems to be working fine?? I think it's okay now?
I'll let u know in a few minutes.
-
Ctuna2000 - Sergeant Major
- Posts: 84
- Joined: Tue Mar 09, 2021 10:09 pm
Re: Help make this script loop for (x) amount of time, ASAP!
Scachi wrote:for me it seems to work fine. tested on t2 as I have no t1.
make sure to run the code I have posted. The last combo resets the timer and this will let the first combo run again.
Okay, so here's the problem. I adjusted it a bit, so it waits 8 seconds to tap X.
- Code: Select all
int SMASH = FALSE;
int msecs, secs, mins, hours, days;
main {
msecs = msecs + get_rtime();
if(msecs >= 1000) {
msecs = msecs - 1000;
secs = secs + 1;
if(secs >= 60) {
secs = secs - 60;
mins = mins + 1;
if(mins >= 60) {
mins = mins - 60;
hours = hours + 1;
if(hours >= 24) {
hours = hours - 24;
days = days + 1;
}
}
}
}
if(event_press(XB1_DOWN)) {
SMASH = !SMASH;
msecs = 0; secs = 0; mins = 0; hours = 0; days = 0;
}
if (SMASH) {
if (mins < 7) combo_run(SMASH_X);
else {
combo_stop(SMASH_X);
combo_run(SMASH_Y);
}
}
}
combo SMASH_X {
set_val(XB1_RT,100);
set_val(XB1_A, 100);
wait(110);
set_val(XB1_RT,100);
set_val(XB1_A, 0);
wait(110);
set_val(XB1_RT,100);
}
combo SMASH_Y {
wait(4000);
wait(4000);
set_val(XB1_X,100)
wait(110);
msecs = 0; secs = 0; mins = 0; hours = 0; days = 0;
wait(10);
}
Like, the script did the first interval. Total time 7 minutes. But every single time after that took 6:52. See what I mean?
I thought you said it resets the timer after the last combo?
-
Ctuna2000 - Sergeant Major
- Posts: 84
- Joined: Tue Mar 09, 2021 10:09 pm
Re: Help make this script loop for (x) amount of time, ASAP!
When you do changes and the script stops working you changes may be the issue.
For me it works somewhat...
there is no pause between the X press and the restart of the combo.
this is what the graph of the device monitor of the T2 outputs when the scripts runs a cycle and restarts:
you may need an additional wait(40); after that set_val for the press of X to get a pause for releasing X before restarting the first combo again.
with your added wait(10); line after resetting the timers you get a 10ms difference for the following cycles.
my code had a wait(0); in there instead
For me it works somewhat...
there is no pause between the X press and the restart of the combo.
this is what the graph of the device monitor of the T2 outputs when the scripts runs a cycle and restarts:
you may need an additional wait(40); after that set_val for the press of X to get a pause for releasing X before restarting the first combo again.
with your added wait(10); line after resetting the timers you get a 10ms difference for the following cycles.
my code had a wait(0); in there instead
Last edited by Scachi on Sat Mar 27, 2021 9:37 pm, edited 1 time in total.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Help make this script loop for (x) amount of time, ASAP!
Scachi wrote:When you do changes and the script stops working you changes may be the issue.
For me it works somewhat...
there is no pause between the X press and the restart of the combo.
this is what the graph of the device monitor of the T2 outputs when the scripts runs a cycle and restarts:
Hmmm okay I see.
Also, I did edit my post. I think it's working good actually!
Just a question. How did you get the script to reset the timer after combo 2? Like, what code makes it do that?
Last edited by Ctuna2000 on Sat Mar 27, 2021 9:39 pm, edited 2 times in total.
-
Ctuna2000 - Sergeant Major
- Posts: 84
- Joined: Tue Mar 09, 2021 10:09 pm
Re: Help make this script loop for (x) amount of time, ASAP!
- Code: Select all
combo SMASH_Y {
wait(4000);
wait(4000);
set_val(XB1_X,100)
wait(110);
msecs = 0; secs = 0; mins = 0; hours = 0; days = 0; // <- this resets the time calculation
wait(0); // <- this should be 0, so it exits directly after resetting the time
}
as I said I don't have a T1 . I think the T1 run the code at an 10ms interval by default.
So I am not sure if that wait(0); will really exit directly after resetting the time or if this adds 10ms to the combo before it exits
Last edited by Scachi on Sat Mar 27, 2021 9:41 pm, edited 1 time in total.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Help make this script loop for (x) amount of time, ASAP!
Scachi wrote:
- Code: Select all
combo SMASH_Y {
wait(4000);
wait(4000);
set_val(XB1_X,100)
wait(110);
msecs = 0; secs = 0; mins = 0; hours = 0; days = 0; // <- this resets the time calculation
wait(0); // <- this should be 0, so it exits directly after resetting the time
}
Right okay I see! But I don't get it, how can I not have the time change of 10ms? (It has to be in a range of 10ms - 4000ms?) I had to change it to 10ms or I'd get an error?
-
Ctuna2000 - Sergeant Major
- Posts: 84
- Joined: Tue Mar 09, 2021 10:09 pm
Re: Help make this script loop for (x) amount of time, ASAP!
Ok, right. the T1 has a 10ms minimum.
try without the last wait, remove it , check if its still works correctly.
or you can try setting that secs to -10 instead of 0 to compensate for the 10ms.
try without the last wait, remove it , check if its still works correctly.
or you can try setting that secs to -10 instead of 0 to compensate for the 10ms.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Help make this script loop for (x) amount of time, ASAP!
Scachi wrote:Ok, right. the T1 has a 10ms minimum.
try without the last wait, remove it , check if its still works correctly.
or you can try setting that secs to -10 instead of 0 to compensate for the 10ms.
Actually yeah, it works with it removed. Why was it there in the first place?
Another issue, I tried changing the 7 minutes to seconds and it didn't work properly? Like, I noticed that any number from 1-60 seconds works fine. But after 60 seconds, it just runs combo 1 forever? Only intervals of 60 seconds work? (So, 60, 120, 180 etc work). But e.g, 137 doesn't work?
I wanted to set it for 414 seconds, (which is just below 7 minutes) and it just didn't work.
-
Ctuna2000 - Sergeant Major
- Posts: 84
- Joined: Tue Mar 09, 2021 10:09 pm
Re: Help make this script loop for (x) amount of time, ASAP!
that last wait was meant to make sure that it really runs the last code before exiting the combo.. there were issues at some time when the combo may not execute the last lines when they do not have a wait following. not sure if this was a bug that got fixed or only happens on specific cases.
the T1 runs at 10ms interval by default
so "msecs = msecs + get_rtime();" will add 10ms per each run
when you check for less then 10ms that time limit may also be reached at the start of the code or after one cycle before your combo is able to press any buttons.
the T1 runs at 10ms interval by default
so "msecs = msecs + get_rtime();" will add 10ms per each run
when you check for less then 10ms that time limit may also be reached at the start of the code or after one cycle before your combo is able to press any buttons.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
41 posts
• Page 2 of 5 • 1, 2, 3, 4, 5
Return to GPC1 Script Programming
Who is online
Users browsing this forum: No registered users and 70 guests