CAOS-Programmierung: Befehlsgruppen: Time

Aus Wikibooks
Zur Navigation springen Zur Suche springen

<< Befehlsgruppen | Inhaltsverzeichnis >>

Time

BUZZ (command) interval (integer)

Sets the ideal interval in milliseconds between each tick. However fast the machine, it won't tick quicker than this, but it might tick slower. You 
can find the actual time taken with RACE. Changing this from the default value of 50 midgame will damage profiling and seasons. Things such as  
creature brains are designed for the default 50 millisecond update interval. Change this with caution!

BUZZ (integer)

Returns the ideal interval in milliseconds between each tick. You can find the actual interval with RACE.

DATE (integer)

Returns the day within the current season, from 0 to GAME "engine_LengthOfSeasonInDays" - 1. See also HIST DATE.

DAYT (integer)

Returns the current day of the month

ETIK (integer)

Returns the number of ticks since the engine was loaded in.

HIST DATE (integer) world_tick (integer)

Returns the day within the current season. This is the same as DATE. See also WTIK and HIST WTIK.

HIST SEAN (integer) world_tick (integer)

Returns the current season for a given world tick. This is the same as SEAN. See also WTIK and HIST WTIK.

HIST TIME (integer) world_tick (integer)

Returns the time of day for a given world tick. This is the same as TIME. See also WTIK and HIST WTIK.

HIST YEAR (integer) world_tick (integer)

Returns the number of game years elapsed for a given world tick. This is the same as YEAR. See also WTIK and HIST WTIK.

MONT (integer)

Returns the month of the year

MSEC (integer)

Returns a time stamp measured in milliseconds. It is not specified when the time is measured from; the stamp is only guaranteed to be consistent  
during one session.

PACE (float)

Returns the tick rate satisfaction factor.
Factor 1 - ticks are taking the time we would expect them to, which is set by BUZZ.
Factor more than 1 - the engine is running too slowly.
Factor less than 1 - the engine is leaving spare processing time.
This is averaged over the last 10 ticks. 
Agents can look at this to adjust the resources they use according to current spare processing time. For example, if you have a random snowflake  
generator in winter, you could increase the chance of generation if PACE is low, and decrease the chance if PACE is high. When you do this remember 
that computers will be arbitarily faster in the future, so you should place an extra upper limit on the number of snowflakes to stop them filling the 
whole screen.
Note that PACE only measures the time the engine takes for tick processing, not for handling requests from external applications, or adding Windows 
events to its internal queue. Because of this, you should aim for a value which is a bit less than 1.
Compare RACE.

RACE (integer)

Returns the time in milliseconds which the last tick took overall. This differs from PACE in that on fast machines it will have a minimum of 50 
milliseconds, or the value set by BUZZ. It accounts for all the time in the tick, including event handling and window processing.

RTIF (string) real_time (integer) format (string)

Takes a real world time, as returned by RTIM or HIST RTIM and converts it to a localised string for display. The format string is made up of any text, 
with the following special codes:
%a - Abbreviated weekday name
%A - Full weekday name
%b - Abbreviated month name
%B - Full month name
%c - Date and time representation appropriate for locale
%d - Day of month as decimal number (01 - 31)
%H - Hour in 24-hour format (00 - 23)
%I - Hour in 12-hour format (01 - 12)
%j - Day of year as decimal number (001 - 366)
%m - Month as decimal number (01 - 12)
%M - Minute as decimal number (00 - 59)
%p - Current locale’s AM/PM indicator for 12-hour clock
%S - Second as decimal number (00 - 59)
%U - Week of year as decimal number, with Sunday as first day of week (00 - 53)
%w - Weekday as decimal number (0 - 6; Sunday is 0)
%W - Week of year as decimal number, with Monday as first day of week (00 - 53)
%x - Date representation for current locale
%X - Time representation for current locale
%y - Year without century, as decimal number (00 - 99)
%Y - Year with century, as decimal number
%z, %Z - Time-zone name or abbreviation; no characters if time zone is unknown
%% - Percent sign
The # flag may prefix any formatting code, having the following meanings:
%#a, %#A, %#b, %#B, %#p, %#X, %#z, %#Z, %#% # flag is ignored.
%#c Long date and time representation, appropriate for current locale. For example: Tuesday, March 14, 1995, 12:41:29.
%#x Long date representation, appropriate to current locale. For example: Tuesday, March 14, 1995.
%#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y Remove leading zeros (if any). 
You probably want to READ any formatted string you use from a catalogue file.

RTIM (integer)

Returns the current real world time. This is measured in seconds since midnight, 1 January 1970 in UTC. To display, use RTIF.

SCOL (integer) and_mask (integer) eor_mask (integer) up_speeds (byte-string) down_speeds (byte-string)

Set an AND and an EOR mask, to control the following scrolling functions:
1 - Screen edge nudgy scrolling
2 - Keyboard scrolling
4 - Middle mouse button screen dragging
8 - Mouse wheel screen scrolling
The byte strings is used for nudgy and keyboard scrolling. The defaults are [1 2 4 8 16 32 64] and [0 1 2 4 8 16 32]. They represent the number of 
pixels scrolled each consecutive tick, as the scrolling gets slower and faster.
If you use [] for a byte string, then the string won't be changed at all. See also the EAME variables engine_nudge_border_t etc.

SEAN (integer)

Returns the current season. This can be
0 - spring
1 - summer
2 - autumn
3 - winter
The GAME variable engine_LengthOfSeasonInDays sets the season length. See also HIST SEAN.

TIME (integer)

Returns the time of day. This can be
0 - dawn
1 - morning
2 - afternoon
3 - evening
4 - night
The GAME variable engine_LengthOfDayInMinutes sets the day length. See also HIST TIME.

WOLF (integer) kanga_mask (integer) eeyore_mask (integer)

Provides various functions to distort space-time and otherwise help with wolfing runs. Set an AND and an EOR mask, to control the following bits:
1 - Display rendering. Turning it off speeds the game up.
2 - Fastest ticks. The game usually runs at a maximum of 20 frames per second. If this is set, it instead runs as fast as it can.
4 - Refresh display at end of tick. If set, then the display is updated at the end of the tick, and the flag is cleared.
8 - Autokill. If set, agents which generate run errors are automatically killed, as the command line option.

WPAU (command) paused (integer)

Stops world ticks from running. Days, seasons and years won't change and any delayed messages are paused, as are CAs and some sound effects. Set to 1 
to pause, 0 to run. Use along with PAUS.

WPAU (integer)

Returns 1 if world ticks are paused, or 0 otherwise.

WTIK (integer)

Returns the number of ticks since the world was first made. For debugging purposes only you can change this value with DBG: WTIK.

YEAR (integer)

Returns the number of game years elapsed. The GAME variable engine_NumberOfSeasons sets the year length. See also HIST YEAR.

<< Befehlsgruppen | Inhaltsverzeichnis >>