ID:261669
 
I want to make a code for time like after 1 minute it goes from 11:00 am to 12:00pm and such for all the hours but at the hours of 8:00pm to 6:00 am its night time and the rest its morning
ok...set up a ticker that goes off once a minute...when the ticker goes off, call the function that implements the hour-change and tests for night..

something like this:

spawn()
while(1)
sleep(600)
Do_Day_Stuff()
(called at creation)

proc/Do_Day_Stuff()
time+=1
if(time > 23) time = 0
if (time == 8)
//morning code
if (time == 18)
//evening code
In response to Abraxas
that ticker is somewhat inaccurate...it's accurate to within a fraction of a second in most occasions..you COULD spawn the Do_Day_Time() function to try to gain some on accuracy...assuming the function itself can run in less than 1 minute..if not, you're in trouble
In response to Abraxas
i have no idea where to put that or how to set that up lol
In response to Sage_Turak
He said upon creation

world/New()
spawn()
while(1)
sleep(600)
Do_Day_Stuff()
In response to Koshigia
ya im stumped on the part after that like what do i do to set a certain variable for time and stuff
In response to Sage_Turak
You create a global variable...

var/time = 0

then you can touch time in any proc anywhere...
be careful with globals...

If that's not enough, maybe you should re-address the question in the newbie forum.