How to run a combo based on time, eg. once every 60seconds
9 posts
• Page 1 of 1
How to run a combo based on time, eg. once every 60seconds
I'm guessing this can be done with get_rtime but I am unsure of the syntax
- creedkiller
- Lieutenant
- Posts: 293
- Joined: Fri Mar 17, 2017 4:08 pm
Re: How to run a combo based on time, eg. once every 60secon
T1 or T2 ? Don't you own a T2 ?
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: How to run a combo based on time, eg. once every 60secon
Scachi wrote:T1 or T2 ? Don't you own a T2 ?
I own both, but working on a script for a mate who only has the T1
- creedkiller
- Lieutenant
- Posts: 293
- Joined: Fri Mar 17, 2017 4:08 pm
Re: How to run a combo based on time, eg. once every 60secon
GTuner pro has some nice code examples in the integrated help, but it is available online too:
https://www.consoletuner.com/kbase/misc ... #get_rtime
If you want to extecute something every 60 secs you can place the code below that line: if(secs >= 60) {
https://www.consoletuner.com/kbase/misc ... #get_rtime
If you want to extecute something every 60 secs you can place the code below that line: if(secs >= 60) {
- Code: Select all
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;
}
}
}
}
set_val(TRACE_1, secs);
set_val(TRACE_2, mins);
set_val(TRACE_3, hours);
set_val(TRACE_4, days);
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: How to run a combo based on time, eg. once every 60secon
Scachi wrote:GTuner pro has some nice code examples in the integrated help, but it is available online too:
https://www.consoletuner.com/kbase/misc ... #get_rtime
If you want to extecute something every 60 secs you can place the code below that line: if(secs >= 60) {
- Code: Select all
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;
}
}
}
}
set_val(TRACE_1, secs);
set_val(TRACE_2, mins);
set_val(TRACE_3, hours);
set_val(TRACE_4, days);
}
Nice one mate, thank you.
- creedkiller
- Lieutenant
- Posts: 293
- Joined: Fri Mar 17, 2017 4:08 pm
Re: How to run a combo based on time, eg. once every 60secon
Scachi wrote:GTuner pro has some nice code examples in the integrated help, but it is available online too:
https://www.consoletuner.com/kbase/misc ... #get_rtime
If you want to extecute something every 60 secs you can place the code below that line: if(secs >= 60) {
- Code: Select all
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;
}
}
}
}
set_val(TRACE_1, secs);
set_val(TRACE_2, mins);
set_val(TRACE_3, hours);
set_val(TRACE_4, days);
}
Do you (or anyone else) know if overclocking the vm with vm_tctrl() changes get_rtime()?
- creedkiller
- Lieutenant
- Posts: 293
- Joined: Fri Mar 17, 2017 4:08 pm
Re: How to run a combo based on time, eg. once every 60secon
I haven't tested it but it shouldn't matter. The docs states:
"Returns the elapsed time, in milliseconds, between the current and the previous interaction of the main procedure."
"Returns the elapsed time, in milliseconds, between the current and the previous interaction of the main procedure."
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: How to run a combo based on time, eg. once every 60secon
Scachi wrote:I haven't tested it but it shouldn't matter. The docs states:
"Returns the elapsed time, in milliseconds, between the current and the previous interaction of the main procedure."
cheers for that, for my use it really doesnt matter if the 60 seconds is not accurate. I was just curious.
- creedkiller
- Lieutenant
- Posts: 293
- Joined: Fri Mar 17, 2017 4:08 pm
Re: How to run a combo based on time, eg. once every 60secon
creedkiller wrote:Do you (or anyone else) know if overclocking the vm with vm_tctrl() changes get_rtime()?
The get_rtime() returns the correct amount of milliseconds even if using vm_tctrl().
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
9 posts
• Page 1 of 1
Return to GPC1 Script Programming
Who is online
Users browsing this forum: No registered users and 65 guests