Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Fri 05/09/2003 04:35:20

Title: remember KGB/Conspiracy? Help me make a clock in AGS, please
Post by: on Fri 05/09/2003 04:35:20
Dear Forum,

I am attempting to make a "KGB"-like interface, clock and all.  Is it possible to make a clock, that runs, like on a global variable or something in AGS?  If you can me at all, I will be indebted.

Your ob'dt serv't,
Horatio Hornblower, R.N.
Title: Re:remember KGB/Conspiracy? Help me make a clock in AGS, please
Post by: Gilbert on Fri 05/09/2003 04:46:53
Making a clock is easy, for example there was a clock in my old demo.

I never played KGB, so I don't know how it is.
Do you want to make a real-time clock or some pseudo ingame clock by counting game loops?

For real-time clocks, just look at the following script functions from the manual:
GetTime()
GetRawTime()


For pseudo ingame clock, just do in global script:
on top:
int day,hour,minute,second,secloop;

in rep. exec:

secloop++;
if (secloop==2){ //say, advance a second every 2 game loops
 secloop=0;
 second++;
 if (second==60){
    second=0;
    minute++;
    if (minute==60){
       minute=0;
       hour++;
       if (hour==24){
          hour=0;
          day++}
       }
    }
}


You can then access those day, hour, etc. variable to get the time in the game.