Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ace_Gamer on Wed 12/10/2005 15:17:13

Title: Creating An In Game Clock
Post by: Ace_Gamer on Wed 12/10/2005 15:17:13
is there any way to create a clock that appears in game that is in sync with the desktop clock on your computer? 

i want the clock to appear in 1 or two rooms only, NOT every room.
Title: Re: Creating An In Game Clock
Post by: Ashen on Wed 12/10/2005 15:24:08
DateTime.Now:
Quote from: The Manual
Now property
(Formerly known as GetTime, which is now obsolete)

readonly static DateTime* DateTime.Now;

Gets the current system time. You could use this for timing a loop, or for effects like telling the player to go to bed, and so on.
A DateTime object is returned, which contains various properties that you can use.

Note that the DateTime object that you get will not be kept up to date with the current time; it will remain static with the time at which you called DateTime.Now.

Example:

DateTime *dt = DateTime.Now;
Display("The date is: %02d/%02d/%04d", dt.DayOfMonth, dt.Month, dt.Year);
Display("The time is: %02d:%02d:%02d", dt.Hour, dt.Minute, dt.Second);

will display the current date and time in 24-hour format

As for only having it in one or 2 rooms, it depends on how you want it to be displayed. Just turning the relevant GUI on only in those rooms should work.

EDIT:
A search for DateTime, GetTime, or just clock should turn up some other options.
Title: Re: Creating An In Game Clock
Post by: Ace_Gamer on Wed 12/10/2005 15:45:54
i want the clock to appear on a clock tower or tv or characters watch etc...
Title: Re: Creating An In Game Clock
Post by: Ashen on Wed 12/10/2005 16:26:17
As in, you want the clock face to show the time (like here (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=16200.0), except newer functions make it even easier or here (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=21745.0), if you prefer digital clocks) or just look at it, and it says "The time is ..." (as in the example code above)?

Again, try a forum search, and if you still can't find what you want, ask a more specific question.
Title: Re: Creating An In Game Clock
Post by: Gilbert on Thu 13/10/2005 02:33:56
Well if you don't mind the clock to be drawn just on the background, you can try using Raw Draw functions (http://www.2dadventure.com/ags/agsclocksrc1.zip).
:=
Title: Re: Creating An In Game Clock
Post by: Ace_Gamer on Thu 13/10/2005 12:15:57
the 'raw draw' file won't unzipp! something about an unknown compression method ???
Title: Re: Creating An In Game Clock
Post by: Gilbert on Thu 13/10/2005 12:48:52
What did you use to unzip it? works for me.
Title: Re: Creating An In Game Clock
Post by: Ashen on Thu 13/10/2005 18:46:07
Doesn't work for me either - using WinRar, and Explorer itself.
Can you re-upload?
Title: Re: Creating An In Game Clock
Post by: Candle on Thu 13/10/2005 20:34:19
Try this one . I unzip it with winrar and rezip it.
http://www.mytempdir.com/205521
Title: Re: Creating An In Game Clock
Post by: Gilbert on Fri 14/10/2005 02:00:34
Well, or try this (http://www.2dadventure.com/ags/agsclocksrc1a.zip).