ID:153672
 
Ok, I'm taking an approach of a real-time clock on my game. But, what way should I do this? I have all the current procs set up...as follows, but I can only see one way to start it up truthfully, by using world/New(). But, I also have it save that variables...but, I know these procs would greatly lag the game eventually to the point of crashing...

proc
World_Year()
if(worldmonth>=12)
worldmonth-=11
worldyear++
return 0
World_Month()
if(worldday>=30)
worldday-=30
worldmonth++
spawn() World_Year()
return 0
World_Day()
if(worldhour>=24)
worldhour-=24
worldmonth++
spawn() World_Month()
return 0
World_Hour()
if(worldminute>=60)
worldminute-=60
worldhour++
if(worldhour>=12)
worldnight_day=(worldnight_day.len)+1
spawn() World_Day()
return 0
World_Minute()
if(worldsecond>=60)
worldsecond-=60
worldminute++
spawn() World_Day()
return 0
World_Second()
while(world)
sleep(10)
worldsecond++
spawn() World_Minute()


Anyone have a better solution, and or approach to this ordeal? If so, please post...
You could use world.time to get the number of seconds the world has been up, and calculate the current game time from that. Or you could link it to real-world time by using world.realtime.
In response to Crispy (#1)
World.realtime returns a ridiculously large number, because it's 10'ths of seconds since the year 2000.

Normally returns about (at time of typing) *ahem* 1.07681*10^9. That's about 1076810000.
In response to Hazman (#2)
Well, the problem with the real time proc is that the games takes place in the mid '80s 1987 to be exact, lol...
In response to Goku72 (#3)
Then subtract a few years from the number before you use it. =)
In response to Crispy (#4)
Oh sure...take the EASY way!!!
In response to Goku72 (#5)
Actually, now I think of it, I'm not sure whether negative numbers would mess you up. Best to calculate the current time from world.realtime, THEN subtract a few years. =)
In response to Crispy (#6)
I don't know...that sounded like an insult to me =p
In response to Goku72 (#7)
It wasn't intended to be. =)

I meant that I'm not sure whether working with negative world.realtime values would be as easy to calculate from. It probably is but it's best to be on the safe side, no?
In response to Crispy (#8)
I know, I was just joking...lol, because clearly, it could be taken either way =p
In response to Goku72 (#9)
Dont forget the time2text() proc. Make that huge number readable once you're done with it =P