[Plugin] TR_ClockParser

Post your completed addons to share with the community

Post » Tue May 16, 2017 4:40 pm

Timer is a common feature especially in casual games. I use it a lot as well so I decided to make a plugin to make timer display more comfortable.

TR_ClockParser simply converts number of seconds to clock-string. There are few expressions to use.

Downloads:
[C2 plugin v 1.2]
[C3 plugin v 1.2]
[capx]

Deprecated: [C2 plugin v 1.0]

Plugin icon by @totoe - thanks! ;)

TR_ClockParser.Minimal(seconds) - Return the smallest possible clock string.
Examples:
TR_ClockParser.Minimal(30) -> "30"
TR_ClockParser.Minimal(90) -> "01:30",
TR_ClockParser.Minimal(4830) -> "01:20:30"

TR_ClockParser.MMSS(seconds) - Return the "MM:SS" clock string.
Examples:
TR_ClockParser.MMSS(30) -> "00:30"
TR_ClockParser.MMSS(90) -> "01:30"
TR_ClockParser.MMSS(4830) -> "80:30"

TR_ClockParser.HHMMSS(seconds) - Return the "HH:MM:SS" clock string.
Examples:
TR_ClockParser.HHMMSS(30) -> "00:00:30"
TR_ClockParser.HHMMSS(90) -> "00:01:30"
TR_ClockParser.HHMMSS(4830) -> "01:20:30"

TR_ClockParser.ToSeconds(timeString) - Converts the specified clock string to seconds.
Examples:
TR_ClockParser.ToSeconds("01:03:30" ) -> 3810
TR_ClockParser.ToSeconds("15:30") -> 930
TR_ClockParser.ToSeconds("30") -> 30
Last edited by BackendFreak on Wed Sep 20, 2017 8:41 pm, edited 5 times in total.
ImageImageImage
B
28
S
17
G
82
Posts: 1,033
Reputation: 45,910

Post » Tue May 16, 2017 4:51 pm

Milliseconds to hours, minutes, seconds is quite annoying to set up.
Thanks!
Image ImageImage
B
171
S
50
G
180
Posts: 8,396
Reputation: 113,986

Post » Tue May 16, 2017 6:37 pm

Handy, Thanks!
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 35,968

Post » Thu May 18, 2017 4:13 pm

So useful. Thanks...
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
65
S
21
G
90
Posts: 1,124
Reputation: 59,862

Post » Wed May 31, 2017 6:34 pm

I've just uploaded version 1.1. The previous version was expecting a string as a param for expressions. It worked well with numeric variables but could bring problems with various other attempts like using other expression (that returns int) as a param.

Even though it's a super small fix I couldn't get it working (backward compatible) by setting the old expressions as deprecated for some reason so I had to make it as non-fully-backward compatible (still the link to the old version is available).

If you used this plugin in your project and provided a string as a parameter for expression, then you will have to remove that line from C2, update the plugin, restart C2 and add it again.

If you haven't used a string earlier then you can simply update the plugin. Sorry for this issue, I just missed this detail somehow.
ImageImageImage
B
28
S
17
G
82
Posts: 1,033
Reputation: 45,910

Post » Sat Aug 12, 2017 4:06 pm

TR_ClockParser is now available for C3 as well. Updated links in the first post here.
ImageImageImage
B
28
S
17
G
82
Posts: 1,033
Reputation: 45,910

Post » Wed Sep 20, 2017 8:43 pm

Updated to version 1.2, added "ToString" expression.

TR_ClockParser.ToSeconds(timeString) - Converts the specified clock string to seconds.
Examples:
TR_ClockParser.ToSeconds("01:03:30" ) -> 3810
TR_ClockParser.ToSeconds("15:30") -> 930
TR_ClockParser.ToSeconds("30") -> 30
ImageImageImage
B
28
S
17
G
82
Posts: 1,033
Reputation: 45,910

Post » Sun Oct 15, 2017 11:36 pm

Thanks for this useful plugin.
B
60
S
19
G
5
Posts: 32
Reputation: 5,692


Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests