# playMaker

### Author Topic: [SOLVED] How to make a timer count to 60 rather than 100  (Read 3458 times)

#### MrMitch

• Full Member
• Posts: 131
##### [SOLVED] How to make a timer count to 60 rather than 100
« on: June 04, 2012, 10:07:25 AM »
I've noticed when using float values to make a timer that it counts to 100 then adds a 1 to the timer, if you look in the attached picture you'll see how i'm formatting it with the convert.

How would i go about making it count to 60 to add the 1 rather than 100?
« Last Edit: June 06, 2012, 02:13:52 PM by Alex Chouls »

#### kiriri

• Hero Member
• Posts: 506
##### Re: How to make a timer count to 60 rather than 100
« Reply #1 on: June 04, 2012, 10:33:38 AM »
do it manually. add 1 to seconds(int) , check if int = 60, then wait 1 sec if seconds is not 60 and then send an event to a state which converts int to string and then builds a string from seconds and minutes. If it is 60, send another event to another state. Have that state add 1 to minutes(int) and set seconds to 0. Then return to the first state .

Quite simple , really, just hard to explain since it involves multiple states
Best,
Sven

#### MrMitch

• Full Member
• Posts: 131
##### Re: How to make a timer count to 60 rather than 100
« Reply #2 on: June 04, 2012, 02:14:52 PM »
do it manually. add 1 to seconds(int) , check if int = 60, then wait 1 sec if seconds is not 60 and then send an event to a state which converts int to string and then builds a string from seconds and minutes. If it is 60, send another event to another state. Have that state add 1 to minutes(int) and set seconds to 0. Then return to the first state .

Quite simple , really, just hard to explain since it involves multiple states

Thanks for the brief on how it's done but i still don't know where to start.

Time is one of the things that gives me the biggest headache, for some reason the way things are worked often makes no sense to me at first.

EDIT - After an evening away from thinking about the problem and some sleep i think i should be able to figure things out, thanks again for the brief
« Last Edit: June 05, 2012, 10:10:33 AM by MrMitch »

#### jeanfabre

• Hero Member
• Posts: 14213
• Official Playmaker Support
##### Re: How to make a timer count to 60 rather than 100
« Reply #3 on: June 06, 2012, 12:20:17 AM »
Hi,

have you found the solution? let me know if not, I'll do a working example ( don't hesitate to share a package if you feel that could help)

Bye,

Jean

#### MrMitch

• Full Member
• Posts: 131
##### Re: How to make a timer count to 60 rather than 100
« Reply #4 on: June 06, 2012, 10:25:37 AM »
No i've not found the solution as of yet, a working example would be greatly appreciated Jean

#### jeanfabre

• Hero Member
• Posts: 14213
• Official Playmaker Support
##### Re: How to make a timer count to 60 rather than 100
« Reply #5 on: June 06, 2012, 12:06:17 PM »
Hi,

Ok, here we go. your misunderstanding of the situation is the following:

a float is treated as a base 100 as default, because this is the way we count. If you want to think as a float representing the number of seconds of a time span, then you need to use specific function ( hours are base 24, minutes and seconds are base 60. While you can compute that yourself with simply math trick, c# has it all figured out for you already.

So I made an action that wrap all this:

http://hutonggames.com/playmakerforum/index.php?topic=1711.0

In your case, the format you want to set is the following:

{1:D1}:{2:D2}:{3:D2}

and that will really show a time as we understand it ( seconds counting to 60 to increment 1 minute)

If you have difficulty with this formating concept, visit and msdn help ( in the thread above)

Bye,

Jean

#### MrMitch

• Full Member
• Posts: 131
##### Re: How to make a timer count to 60 rather than 100
« Reply #6 on: June 06, 2012, 12:39:48 PM »
Thank you very much Jean, it works perfectly

This should be really helpful for others as well.

Also thanks for explaining how each value is looked at within unity