ID:148151
 
Alright i made this time code and it sort of works, every time seconds hit 60 it's supposed to gain a minute and seconds = 0 but, it's not working/

var
Hour = 1
Minute = 0
Second = 0

proc/Seconds()
Second += 1
sleep(1)
Seconds()
proc/Minutes()
if(Second >= 60)
Second = 0
Minute += 1
Minutes()
proc/Hours()
if(Minute >= 60)
if(Hour < 12)
Minute = 0
Second = 0
Hour += 1
Hours()
else
Minute = 0
Second = 0
Hour = 1
Hours()
Do You call the Minute Proc and Hour Proc?
Crashed wrote:
Alright i made this time code and it sort of works, every time seconds hit 60 it's supposed to gain a minute and seconds = 0 but, it's not working/

How isn't it working? Be specific.

One major thing you're doing wrong, though, is using recursion:
proc/Seconds()
Second += 1
sleep(1) // shouldn't that be 10, or is this just for a test?
Seconds() // BAD BAD BAD! NO NO NO!
Whenever a proc calls itself, it's called recursion; it waits for the new call to finish before the old one finishes. If you do that forever, you eventually end up with the stack piled high with calls to the same proc, and your game crashes.

What you need is a loop, not recursion. A while() loop is correct, or spawn() Seconds() will work too. The spawn() is important if you use that method, because then the current proc will be allowed to end before it's called again.

You also need to stop Minutes() and Hours() from calling themselves. They should never ever ever need to do that; you only need a loop in Seconds().

Now, the reason minutes aren't going up is that Seconds() isn't calling the Minutes() proc, which handles that. Likewise, Minutes() isn't calling Hours() when the minute goes up (it should do nothing if the minute stays the same), and Hours() handles the hour increment.

Lummox JR
In response to Piccolo-zt
You might not want to capitalize everything and yes i did call every proc as Lummox mensioned it was because of the proc calling itself without a while() sleep() spawn().