Is there any way to check for the date at runtime?
For example, if I want an event to only happen if it's christmas, would it be possible to have the game manually check for this without going through insane calculations with the realtime var?
ID:154956
Oct 27 2011, 4:01 am
|
|
In response to Albro1
|
|
Oh. Guess it was too obvious, didn't bother to check the whole log, sorry. D:>
Thanks anyway, this'll be useful. |
time2text proc
See also:
realtime var (world)
timeofday var (world)
Format:
time2text(timestamp,format)
Args:
timestamp: a time value as obtained from world.realtime or world.timeofday
format: a text string describing the output format.
Returns:
a text string containing the date and time in the specified format.
A time value (GMT) is converted to text representing the time in the game's time zone.
The default format is "DDD MMM DD hh:mm:ss YYYY", which produces results such as "Wed, May 23 15:41:13 2001". As you can see, the fields in the format text are replaced by components of the date and time. The following list contains all of the recognized fields. Anything else in the format string is inserted directly into the output.
YYYY
year (2001, 2002, ...)
YY
year (01, 02, ...)
Month
January, February, ...
MMM
Jan, Feb, ...
MM
number of the month (01, 02, ...)
Day
Monday, Tuesday, ...
DDD
Mon, Tue, ...
DD
day of the month
hh
hour (00, 01, ... 23)
mm
minute
ss
second
Because world.timeofday is in a range of 0 to 864000, values in this range are treated as a time for the current date. This way time2text() can return accurate results for world.timeofday. Any other values are interpreted as coming from world.realtime and will have the right time and date.
</small>
F1 is your friend. Just do time2text(world.timeofday, "MM") and time2text(world.timeofday, "DD"). Then see if the month is 12 and the day is 25.