clockManager object | subtime.t[29]

The clockManager object is used to keep track of subjective time. In this version we store dates and times internally as Date objects, although we recognize date/times in the form [d, h, m] defined on ClockEvents. [DEFINED IN SUBTIME EXTENSION]

`clockManager : PreinitObject`

Superclass Tree (in declaration order)

`clockManager`
`PreinitObject`
`ModuleExecObject`
`object`

Summary of Properties

`baseDate baseScaleFactor curTime eventList lastEvent nextEvent nextTime scaleFactor turnLastCommitted`

Inherited from `PreinitObject` :
`execBeforeMe reverseGlobalSymbols`

Inherited from `ModuleExecObject` :
`execAfterMe hasInitialized_ isDoingExec_ isExecuted_`

Summary of Methods

`checkTime checkTimeFmt eventDate eventReached execute formatTime getClockTime lastEventDate reachCheck slowDownTime syncTime`

``

Inherited from `ModuleExecObject` :
`_execute classExec`

Properties

`baseDate` | `subtime.t[444]`

The base date (year, month, day) our game is meant to start on, expressed as a Date object. Often this doesn't matter if we're only interested in the time of day. By default we make it Jan 1, 2000. If gameMain.gameStartDate is defines it will instead be taken from there. [SUBTIME EXTENSION]

`baseScaleFactor` | `subtime.t[201]`

The base scaling factor: this is the number of minutes per hundred turns when we have unlimited time until the next event. This number is pretty arbitrary, since we're depending so much on the player's uncertainty about just how long things take, and also because we'll adjust it anyway when we're running out of time before the next event. Even so, you might want to adjust this value up or down according to your sense of the pacing of your game.

In Mike Roberts's implementation, the baseScaleFactor was defined as a constant value of 60. This is still the default value, but if there is a next event we take the scale factor from that event's scaleFactor so that we can vary the pace of time according to the spacing of events if we wish. [SUBTIME EXTENSION]

`curTime` | `subtime.t[416]`

the current game clock time [SUBTIME EXTENSION]

`eventList` | `subtime.t[413]`

our list of clock events (we build this automatically during pre-initialization) [SUBTIME EXTENSION]

`lastEvent` | `subtime.t[419]`

the most recent event that we reached [SUBTIME EXTENSION]

`nextEvent` | `subtime.t[425]`

the next event we're due to reach [SUBTIME EXTENSION]

`nextTime` | `subtime.t[422]`

the next event's game clock time [SUBTIME EXTENSION]

`scaleFactor` | `subtime.t[208]`

The scaling factor to use once we have passed the last ClockEvent; this is the number of minutes per hundred turns once there are no more ClockEvents. [SUBTIME EXTENSION]

`turnLastCommitted` | `subtime.t[435]`

The turn counter (Schedulable.gameClockTime) on the last turn where committed to a specific time. Each time we check the time, we look here to see how many turns have elapsed since the last time check, and we use this to choose a plausible scale for the wall-clock time change. [SUBTIME EXTENSION]

Methods

`checkTime ( )` | `subtime.t[49]`

Get the current game-clock time. This returns date/time as a Date object.

Remember that our time-keeping scheme is a sort of "Schrodinger's clock" [see footnote 1]. Between time checks, the game time clock is in a vague, fuzzy state, drifting along at an indeterminate pace from the most recent check. When this method is called, though, the clock manager is forced to commit to a particular time, because we have to give a specific answer to the question we're being asked ("what time is it?"). As in quantum mechanics, then, the act of observation affects the quantity being observed. Therefore, you should avoid calling this routine unnecessarily; call it only when you actually have to tell the player what time it is - and don't tell the player what time it is unless they ask, or there's some other good reason.

If you want a string-formatted version of the time (as in '9:05pm'), you can call checkTimeFmt().

`checkTimeFmt (fmt)` | `subtime.t[220]`

Get the current game-clock time, formatted into a string with the given format mask - see formatTime() for details on how to write a mask string.

Note that the same cautions for checkTime() apply here - calling this routine commits us to a particular time, so you should call this routine only when you're actually ready to display a time to the player. [SUBTIME EXTENSION]

`eventDate (t)` | `subtime.t[447]`

Return the date of t as a Date object. [SUBTIME EXTENSION]

`eventReached (evt)` | `subtime.t[326]`

Receive notification from a clock event that an event has just occurred. (This isn't normally called directly from game code; instead, game code should usually call the ClockEvent object's eventReached() method.) [SUBTIME EXTENSION]

`execute ( )`OVERRIDDEN | `subtime.t[247]`

pre-initialize the clockManager [SUBTIME EXTENSION]

`formatTime (t, fmt)` | `subtime.t[233]`

Get a formatted version of the given wall-clock time. The time (t) parameter can be expressed as a list, in the same format as ClockEvent.eventTime: [day,hour,minute], where 'day' is 1 for the first day of the game, 2 for the second, and so on. Alternatively it can be supplied as a Date object.

The format string (fmt) is specified in the same way as for the formatDate() method of the Date class (for which see the TADS 3 System Manual). [SUBTIME EXTENSION]

`getClockTime (dat)` | `subtime.t[479]`

Get the time in our [d, h, m, s] format from a Date object. [SUBTIME EXTENSION]

`lastEventDate ( )` | `subtime.t[473]`

Retutn the date and time of the last event as a Date object. [SUBTIME EXTENSION]

`reachCheck ( )` | `subtime.t[384]`

Check each turn whether another ClockEvent has been reached. Note that this requires the events.t module to be present to work. [SUBTIME EXTENSION]

`slowDownTime ( )` | `subtime.t[170]`

Compute the time remaining until the next event at which we start to slow down the clock. By default we make this half the time from the previous event to the next. Game code can override if some other value is preferred. [SUBTIME EXTENSION]

`syncTime (t)` | `subtime.t[497]`

Synchronize the timeManager's time with our time, if it exists. [SUBTIME EXTENSION]

Adv3Lite Library Reference Manual
Generated on 25/04/2024 from adv3Lite version 2.0