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()
ID:148151
Jun 23 2003, 1:48 am
|
|
Jun 23 2003, 4:02 am
|
|
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() 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().
|