Help make this script loop for (x) amount of time, ASAP!
41 posts
• Page 3 of 5 • 1, 2, 3, 4, 5
Re: Help make this script loop for (x) amount of time, ASAP!
Scachi wrote: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.
Okay, thanks for the explanation! So even though I took out the last line, would I still have to do something about the 10ms?
So, I edited my last message, how come I can't set the seconds for something random like 153 seconds?
-
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!
seconds will only be in the range of 0 .. 50ms under normal circumstances in that code:
secs = secs + 1;
if(secs >= 60) {
secs = secs - 60;
secs = secs + 1;
if(secs >= 60) {
secs = secs - 60;
-
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:seconds will only be in the range of 0 .. 50ms under normal circumstances in that code:
secs = secs + 1;
if(secs >= 60) {
secs = secs - 60;
I don't really understand what you're saying? So how can I set it for 153 seconds?
Also, how come I can't set negative wait times like -10ms or something. It errors.
-
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!
there are limits to functions because of how the functions are designed...
what should a negative wait time do ?
wait(-10) ? ...that makes no sense.
wait repeats the lines in the combo above that wait line for that amount of ms of the value of that wait time.
so :
set_val(PS4_CIRCLE,100);
wait(100);
will press the circle button for 100ms...
what should pressing a button for -10ms do ?
that time function is math..
when the secs value gets to 60 ir get reduced by -60 and the mins values gets increased by 1..
60 seconds gets 1 minute.. there is no 70 seconds in that code..no secs 70 value possible during normal run.
what should a negative wait time do ?
wait(-10) ? ...that makes no sense.
wait repeats the lines in the combo above that wait line for that amount of ms of the value of that wait time.
so :
set_val(PS4_CIRCLE,100);
wait(100);
will press the circle button for 100ms...
what should pressing a button for -10ms do ?
that time function is math..
when the secs value gets to 60 ir get reduced by -60 and the mins values gets increased by 1..
60 seconds gets 1 minute.. there is no 70 seconds in that code..no secs 70 value possible during normal run.
-
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.
Well, you said that I can set it to -10 here.
Scachi wrote:there are limits to functions because of how the functions are designed...
what should a negative wait time do ?
wait(-10) ? ...that makes no sense.
wait repeats the lines in the combo above that wait line for that amount of ms of the value of that wait time.
so :
set_val(PS4_CIRCLE,100);
wait(100);
will press the circle button for 100ms...
what should pressing a button for -10ms do ?
that time function is math..
when the secs value gets to 60 ir get reduced by -60 and the mins values gets increased by 1..
60 seconds gets 1 minute.. there is no 70 seconds in that code..no secs 70 value possible during normal run.
Wait, I thought this was a wait time? Like, how long the first combo would loop for?
- Code: Select all
if (mins < 7) combo_run(SMASH_X);
I see what ur saying about that function being the math of the script.
How can I set it to loop the first combo for an odd time like 153 seconds?
I was hoping that a negative wait time could be in place to make it a few seconds under 7 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!
ok.. sorry.. I though you talked about the wait() stuff
well 153 seconds .. translate it to minutes and seconds and check for that in the if statement
well 153 seconds .. translate it to minutes and seconds and check for that in the if statement
-
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.. sorry.. I though you talked about the wait() stuff
well 153 seconds .. translate it to minutes and seconds and check for that in the if statement
Okay I see, how do I do that?
-
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!
something like that:
if (mins*60 + secs < 153) combo_run(SMASH_X);
if (mins*60 + secs < 153) combo_run(SMASH_X);
-
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:something like that:
if (mins*60 + secs < 153) combo_run(SMASH_X);
Hmmm okay. So while I was typing, I just set the seconds bit to + and + 600. (So I can select any number between 0 and 600?)
- Code: Select all
main {
msecs = msecs + get_rtime();
if(msecs >= 1000) {
msecs = msecs - 1000;
secs = secs + 1;
if(secs >= 600) {
secs = secs - 600;
mins = mins + 1;
if(mins >= 60) {
mins = mins - 60;
hours = hours + 1;
if(hours >= 24) {
hours = hours - 24;
days = days + 1;
}
}
}
}
It seems to work, but have I just messed up a function of the script? Like, would it just break or something? I don't really understand what I've done lol.
-
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!
you are breaking the time tracking for minutes that way but as long as you don't use the minutes you don't need to count them at all, same for hours and days..
so that may work for you:
but here is a maximum limit to that "secs" variable
it s valid range is limited to −32,768 to 32,767
as long as you don't need more than 32767 seconds to track you are fine with the above few lines of code.
there are always multiple ways to solve something.
so that may work for you:
- Code: Select all
msecs = msecs + get_rtime();
if(msecs >= 1000) {
msecs = msecs - 1000;
secs = secs + 1;
}
but here is a maximum limit to that "secs" variable
it s valid range is limited to −32,768 to 32,767
as long as you don't need more than 32767 seconds to track you are fine with the above few lines of code.
there are always multiple ways to solve something.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
41 posts
• Page 3 of 5 • 1, 2, 3, 4, 5
Return to GPC1 Script Programming
Who is online
Users browsing this forum: No registered users and 104 guests