Time...?


Thu, 6 Jul 95 14:38:00 -0500

CC= I can't figure out how to have the game keep track of the time. I
CC= want it to start at 8PM and keep counting. (because I have some
CC= events I want to happen at certain times)

Your answer is found in Chapter 14.3 of the Designer's manual... You might
be interested to know that this chapter section is completely incoherantly
entitled "Routines that Run when an Object is in Scope"... nevertheless, it
holds the info about using "clock" style time keeping. Excerpt follows:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

If you're writing a game with the time instead of the score and turns on
the status line, you can set the time by

SetTime( 60 * HOURS + MINUTES, RATE );

The current time is held in the variable `the_time' and runs on a
24-hour clock. The RATE controls how rapidly time is moving: a RATE of
0 means it is standing still (that is, that the library doesn't change
it: your routines still can). A positive RATE means that that many
minutes pass between each turn; and negative RATE means that many turns
pass between each minute.

The time still won't appear on the game's status line unless you set

Statusline time;

as a directive somewhere in your code. And remember to start off the
clock by calling `SetTime' in your `Initialise' routine, if you're
going to use it.

---
  .....with love and squalor.              <as544@torfree.net>