TIME

TIME is a CAOS function that returns the current time of day.

Usage
Syntax: TIME

Returns an integer representing the current time of day in the world. This can be in the range from 0 (dawn) to 4 (night).

Example
TIME can be used to create agents that act differently at different times of day - from simply having a day sprite and a night sprite, to having plants that only bloom during the day or animals that sleep at night.

Being used to change a metaroom's background between a day version and a night version: scrp 1 1 1 9 doif time eq 4 and bkgd ov01 eq "room-daytime" scam null -1 bkgd ov01 "room-nighttime" 2 elif time eq 0 and bkgd ov01 eq "room-nighttime" scam null -1 bkgd ov01 "room-daytime" 2 endi endm

Simple example for an agent that has different behavior at dawn and dusk, during the day, and at night: doif time eq 0 or time eq 3 gsub dawndusk elif time eq 1 or time eq 2 gsub day else gsub night endi