What i am going to do is create a graveyard code for my game. people can "Grave-rob" as a way to make money, get loot and sometimes have to fight zombies.. Lol it isnt a zombie game its just...a weird game.
Anyway I figured i would start with an in-game clock so people can only grave-rob from 12:00 AM to 3:00 AM in-game.
Why im here and showing this is i would like to ask you guys(and gals) to maybe look my code over and tell me if all is in order...like i said im new to DM programming and i do not want to create something that will make my game freak out lol.
Here is my in-game clock code. Complete with confusing notes! I understand them i dont know if others will..
/*
NOTES:
*Reason for "minutes1" and "minutes2" is
so my clock would read: 12:00 instead
of 12:0 when "minutes1" reaches 12:09 it will
add one number on to "minutes2" so the clock
will read 12:10.
*Clock likes to run two extra seconds.
Seconds : Set to 1 = 3 seconds.
Minutes1 : Set to 8 = 10 minutes
Minutes2 : Set to 6 = 8 minutes
*Minutes2 note:
The reason it turns 8 and not 9 to read "59" on my clock
is because hour doesn't switch over till one more loop after
12:59 it will read 1:00 and if its AM it switches to PM
*Hour note:
Each hour takes 2 min 55 seconds
*AM to PM cycle Note:
4200 seconds = 70 minutes for full day cycle.
AM to PM (12:00 PM to 12:00 AM)
*/
proc
get_time()
time = ("[hour]:[minutes2][minutes1] [ToD] - [seconds]")
var
seconds = 0
minutes1 = 0
minutes2 = 0
hour = 12
ToD = "PM"
time
world
New()
set background = 1
..()
spawn()
while (src)
sleep (10)
if (seconds <= 1)
seconds ++
else
seconds = 0
if (minutes1 <= 8)
minutes1 ++
else
minutes1 = 0
minutes2 ++
if (minutes2 >= 6)
hour ++
minutes2 = 0
if (hour >= 12)
hour = 1
if (hour >= 12)
switch(ToD)
if("AM")
ToD = "PM"
if("PM")
ToD = "AM"
get_time()