Skip to content

Latest commit

 

History

History
213 lines (132 loc) · 5.6 KB

timekeeper.md

File metadata and controls

213 lines (132 loc) · 5.6 KB

Table of Contents

Timekeeper

The public API for Easy Timekeeping.

getPhaseOfDay

Get the name of the current phase of the day as a localised string.

Not to be confused with the four shifts, the phase of day relates to the daylight cycle. During the day phase, the scene lighting will be set to the day value. During the night, scene lighting is set to the night value. During dawn, lighting is gradually changed from the night to the day values, while during dusk, the lighting changes from the day to night values.

Returns string the localised name of the day phase. This is one of the set [Dawn, Day, Dusk, Night], but localized.

increment

Increment or decrement the time. You must be a GM to run this function.

Parameters

  • time time the time step to increment or decrement

Returns timeChangeData if the time was changed, otherwise false.

set

Set the time. You must be a GM to run this function.

Parameters

  • time time the time to set

Returns timeChangeData if the time was changed, otherwise false.

getTime

Gets the current time.

Returns timeAugmented the current time

tellTime

Posts the current time to chat.

factorGameTurns

Factors a time object into game turns, shifts and days

Parameters

  • totalMinutes

Properties

  • totalMinutes number total elapsed minutes since 12am on day 0

Returns gameTurnTime totalMinutes factored into game turns, shifts, days and weeks

time

A time object used for inputting time values to the Easy Timekeeping API

Type: Object

Properties

  • days number days since day 0
  • hours number hour of the day in 24-hour time, range [0..23]
  • minutes number minute of the hour, range [0..59]

timeAugmented

An augmented time object used when values are returned from the Easy Timekeeping API

Type: Object

Properties

  • days number days since day 0
  • hours number hour of the day in 24-hour time, range [0..23]
  • minutes number minute of the hour, range [0..59]
  • totalMinutes number total elapsed minutes since 12am on day 0
  • weekNumber number 1-based number of 7-day weeks that have elapsed, including the current partial week.
  • day dayData additional metadata about the day of the week

dayData

Day data

Type: Object

Properties

  • index number 1-based number of the day of the week, starting with Monday. Each week is fixed at 7 days.
  • name string the name of the current day of the week, based on the current world settings.

timeChangeData

Time change object returned from the Easy Timekeeping API

Type: Object

Properties

gameTurnTime

Game turn time. This is used by the graphical clocks, and returned from API calls.

Type: Object

Properties

  • totalGameTurns number total number of elapsed game turns
  • days number days since day 0
  • shifts number the current shift out of the 4 shifts per day. 0-based, range [0..3]
  • turns number the current game turn within the current shift. 0-based indexing
  • day dayData additional metadata about the day of the week
  • weekNumber number 1-based number of 7-day weeks that have elapsed, including the current partial week.
  • shiftName string the name of the current shift, based on world settings.

Constants

Constants used in time calculations.

Properties

  • secondsPerDay number The number of seconds in a day.
  • minutesPerDay number The number of minutes in a day.
  • hoursPerDay number The number of hours in a day.
  • shiftsPerDay number The number of shifts in a day.
  • minutesPerShift number The number of minutes in a shift.
  • hoursPerShift number The number of hours in a shift.
  • daysPerWeek number The number of days in a week.
  • minutesPerTurn number The number of minutes in a game turn. Will vary by current module settings.
  • turnsPerShift number The number of game turns per shift. Will vary by current module settings.
  • turnsPerDay number The number of game turns per day. Will vary by current module settings.