ID:146309
 
Code:
world.New()
while(timer)
set background = 1
if(gamestarted)
timer += 1
clock += 1
if(clock >= 300)
clock = 0
if(clock >= 0&&clock < 60)
time = 1
for(var/turf/T in world)
if(istype(T,/turf/Title_Screen))
continue
T.daytime(T)
if(clock >= 60&&clock < 180)
time = 2
for(var/turf/T in world)
if(istype(T,/turf/Title_Screen))
continue
T.daytime(T)
if(clock >= 180&&clock < 240)
time = 3
for(var/turf/T in world)
if(istype(T,/turf/Title_Screen))
continue
T.daytime(T)
if(clock >= 240&&clock <= 300)
time = 4
for(var/turf/T in world)
if(istype(T,/turf/Title_Screen))
continue
T.daytime(T)
turf
var
light = 0
proc
daytime(turf/T)
if(world.time == 1)
if(T.light != 1)
T.light = 1
T.icon -= rgb(5,5,5)
if(world.time == 2)
if(T.light != 2)
T.light = 2
T.icon += rgb(5,5,5)
if(world.time == 3)
if(T.light != 3)
T.light = 3
T.icon += rgb(10,0,0)
T.icon -= rgb(0,10,10)
if(world.time == 4)
if(T.light != 4)
T.light = 4
T.icon -= rgb(30,10,10)


Problem description:
That's not everything... but what happens, is when I start the game, it spams me with this error :
runtime error: type mismatch
proc name: daytime (/turf/proc/daytime)
usr: null
src: the turf (16,1,1) (/turf)
call stack:
the turf (16,1,1) (/turf): daytime(the turf (16,1,1) (/turf))
: New()


I can't figure out what that runtime means so I can actually fix it, but I have run through alot of ways of doing this... none of which have made much difference.

Try putting var/ in the daytime procedure's parenthesis so it looks like
daytime(var/turf/T)

I would have suggested that you make a proc that sets an area's luminosity to 0 then sleeps, then sets luminosity to 1, then sleeps, then calls itself. I can't test at the library, only place I have net access, so you'll just have to put it together. Oh, and replace the sleeps with your if statements regarding the system time.

But your way sounds so much cooler, so I'll watch this one instead.

Since it's looking for a usr somewhere, run the proc after the host mob logs in. call the proc from the host's mob, so usr isn't null.

I'm just a new coder, so test it but don't complain if it doesn't work.
In response to Steelhouse
I'm not making the Darkness light, i'm trying to get it to GO dark in the first place. I will be using that for lamps (i guess) and stuff...
In response to Officer Falcon
Doesn't make any difference whether I put that there or not, you know.(If it does, It didn't make ANY effect on the amount or type of runtimes, or the effect my code is supposed to have.)
In response to Steelhouse
or, he can just create a shade and have it gradually add/remove depending on his timer
In response to Cheetoz
If you mean an overlay, That's not what i'm looking for...

And if you mean RGB and icon arithmetic, that's what i'm trying to do.
In response to Hiddeknight
well, what good is a day time if your STILL ontop of it, that looks wack, your going to have to atleast darken everyones icon, which means logging out will mess them up, so the best way to go is a global overlay IMO...
In response to Cheetoz
_> You honestly think I have :
1) shown you all my code
2) finished all the rest of the code without stopping to fix this bug first
3) not though about that
?
I still need help.
Use #define DEBUG & get the exact line of the problem.
world.New()
world<<"test 1"
while(timer)
set background = 1
world<<"Test 2"
if(clock >= 300)
clock = 0
if(clock >= 0&&clock < 60&&time != 1)
time1()
if(clock >= 60&&clock < 180&&time != 2)
time2()
if(clock >= 180&&clock < 240&&time != 3)
time3()
if(clock >= 240&&clock <= 300&&time != 4)
time4()
sleep(300)


I got the other thing to work, it's just laggy as all hell.
THIS should work, but it isn't.