Hi, i would like my game to have its own "in-game clock"
problem is i have no idea where to read how i would do something like that..
I have seen one Poke'mon game use its own in-game clock for catching poke'mon that only appear at night so i know its possible i just dont know where to learn how to do it..
ID:155003
Oct 12 2011, 10:03 pm
|
|
In response to Raimo
|
|
Ty :D
|
In response to NotS
|
|
Ok so um...i dont think this is what im looking for..
Im talking about creating my own in-game time...not a realtime clock, i think i should of said that...sorry I would like to make it so my game has its own in-game time separate from real time so say 12 midnight happens every 30 min is that possible? if so how would i learn to do it? |
In response to NotS
|
|
You can instead then create your own customized clock! var Obviously I hope by the example you can see it is possible to check for minutes, hours, how often this is updated by sleep(), and all that. :) |
In response to Speedro
|
|
:D i thought of using the sleep proc but since im so new to DM programming i didnt know where to start. thats a cool little code.
|
This is what my program K-DOS uses :
proc/get_time() Source : http://www.byond.com/developer/Kyle_ZX/KDOS Basically get_time() will return something like "0 : 0 : 0 : 22" which is used to display the time. So a loop that uses get_time() will keep it updated. core_time the variable will always give the exact time in seconds. It would equal something like 27473 and will increase every second the game is working. Get_Date is a little harder to use in the skin but you can. It will return a result like "21 Feburary 2011" and updates every 4 to 7 seconds. I use it like this : spawn() // Title All of this culminates to give : Hope this helps. |
In response to Kyle_ZX
|
|
Why exactly are you using an HTTP query to determine the date, instead of using BYOND's built-in realtime/time/timeofday variables in conjunction with time2text? This isn't something you should really be telling someone that's new to the language to do.
|
In response to Audeuro
|
|
Haha, not something I knew how to do. I just found that if I checked for the Date variable that's what I got.
|
In response to Kyle_ZX
|
|
The way you're doing it is a serious waste of bandwidth (Have you checked the size of BYOND's home page recently?) and you should probably change the way you do it. The proper way to work with time and date most of the time is to use world.realtime and world.timeofday. You can use world.timeofday to get a more precise time for minutes, seconds, and hours, and you can use world.realtime for the months, years, and days. You can also convert either of these variables to text strings using time2text.
|
timeofday var, realtime var and the time2text() proc.