& 78 @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ & IC Time and Weather & Weather The following commands are available: +TIME These admin-only commands are available, but aren't globals (you must be near the Time and Weather object to use them): SETWEATHER, WEATHERSTATS The following functions are available: ICTIMEFMT(), ICTIMEFUNC(), WEATHER() See HELP for more info. There are also some other time/weather functions available on which you can use in your code. See also: TAW CHANGES & TAW CHANGES v1.1b - The @lock/use didn't include the object itself, even though it should trigger it's own commands. Fixed by Fraibert. v1.1 - The weather() @function referenced the wrong attribute. Fixed by Matthew Stockfleth. v1.0 - Original Release & SETWEATHER SETWEATHER AUTO SETWEATHER /[] The first form of this command forces the weather object to reset the weather, automatically selecting a valid weather type for the current IC date, and choosing one of the preset descriptions. The second form forces weather. If no is given, one will be selected automatically from the preset descriptions, otherwise will be used. must be a valid type of weather for the current IC date. You must be an admin to use this command, and must be near the Time and Weather Code object (use THINK ICTIMEFUNC(weatherobj) to get its dbref). & WEATHERSTATS WEATHERSTATS This command lists the valid weather types for any season (spring, summer, autumn or winter), and the chance that each will occur. You must be an admin to use this command, and must be near the Time and Weather Code object (use THINK ICTIMEFUNC(weatherobj) to get its dbref). & +TIME +TIME The +time command shows the current Real Life time, in the local timezone of the MUSH and in GMT, along with the IC Time and the IC Weather. & ICTIMEFUNC() ictimefunc([[, [, ..]]]) With no arguments, this function returns a list of all the valid s which can be used. Each is a different IC time/weather related function which can be used. If a is given, that subfunction is called with the args to . Descriptions of some subfunctions are available at HELP ICTIMEFUNC2. See also: ictimefmt(), weather() & ICTIMEFUNC2 12hour: returns the current hour in the 12 hour clock (1-12) 12hour_long: as above, but always 2 digits long (01-12) ampm: returns 'AM' or 'PM', depending on whether it's before midday or not cloudy: returns 1 if the current weather is cloudy (so stars, etc, may be obstructed), 0 otherwise date: returns the current IC date, in the format d/m/yyyy datetime: same as ictimefunc(time) [ictimefunc(date)] datetime_english: returns the current IC date in an easily readable format datetime_timefunc: returns the current IC date in the same format as the time() function returns the RL date dom: returns the day of the month (1-31) hour: current hour in the 24 hour clock (0-23) hour_long: as above, but always 2 digits long (00-23) leapyear: returns 1 if the current year is a leapyear, 0 otherwise minutes: returns the number of minutes past the IC hour (0-59) month: returns the current IC month (1-12) months: list of month names (January-December) months_short: list of short month names (Jan-Dec) Continued in HELP ICTIMEFUNC3 & ICTIMEFUNC3 moonphase: returns a number from 1-8 representing the moonphase for the current IC date. You can obtain the moonphase for other dates by passing the year, month (1-12) and dom (1-31) respectively. moonphases: list of the 8 moonphase names ord: returns the ordinal of a number (1 -> 1st, etc) ratio: the number of IC minutes in a RL minute season: returns the current season (1-4) season_name: returns the name of the current season seasons: list of season names (Spring-Winter) seconds: number of seconds past the IC minute (0-59) time: returns the current IC time, in the format HH:MM:SS timezone: returns the current timezone abbreviation tod: returns the current time of day tod-2: returns the current time of day, limited to just "day" or "night" tod-4: returns the current time of day, limite to "day", "night", "dawn" or "dusk" weatherobj: returns the dbref of the Time and Weather Code object, for admins, or #-1 for others weekday: returns the current weekday (1-7) weekdays: list of weekday names (Sunday-Saturday) weekdays_short: list of weekday names (Sun-Sat) year: the current IC year & ICTIMEFMT() ictimefmt() This function is similar to the timefmt() function, but it forms the current IC date and time instead of a real-life date and time. All escape codes start with a $. Invalid codes return #-1 INVALID ESCAPE CODE. Other text will pass through unchanged. These codes are available: $a - Abbreviated weekday name $M - Minutes after the hour $A - Full weekday name $p - AM/PM ($P may also work) $b - Abbreviated month name $S - Seconds after the minute $B - Full month name $w - Day of the week. 0 = Sunday $c - Date and time $x - Date $d - Day of the month $X - Time $H - Hour of the 24-hour day $y - Two-digit year $I - Hour of the 12-hour day $Y - Four-digit year $j - Day of the year $Z - Time zone $m - Month of the year $$ - $ character See also: ictimefunc(), weather() & WEATHER() weather([]) This function can be used to obtain the current IC weather. If is given and is true, the weather type is returned (one of fair, cloudy, storm, rain, lightsnow, snow or fog). Otherwise, the full textual description of the weather as shown on the +time command is returned. This is primarily useful for room descriptions. See also: ictimefunc(), ictimefmt() & &Time and Weather Setup Once you've installed the Time and Weather code, you may want to make some customizations to how it works, possibly including: Timezones - see AHELP TAW TZ Triggers - see AHELP TAW TRIGGERS Weather Descs - see AHELP TAW WEATHER & &TAW TZ The Time code can be setup to support multiple IC timezones. The default code is the British timezone setup of Greenwich Mean Time and British Summer Time. Timezones are changed by the TICK`TOCK_TZ attribute on the Time and Weather Code object (which is evaluated via UFUN(), and is not @triggered). The attribute should simply check the current time, date and timezone and, if a change is appropriate, should make it. For example, the default code is this: &tick`tock_tz %vb=switch(v(hour)/[v(weekday)]/[v(month)]/[v(timezone)], 1/7/3/GMT,if(gt(v(dom),24),set(me,hour:2)[set(me,timezone:BST)]), 2/7/10/BST,if(gt(v(dom),24),set(me,hour:1)[set(me,timezone:GMT)])) That is, if it's 1 am on a Sunday in March, it's currently GMT, and there's less than a week left in the month (making it the last Sunday in the month), it changes the hour to 2am, and the timezone to BST. If it's 2 am on the last Sundy in October, and it's BST, it checks to make sure it's the last Sunday in the month, and then changes the time to 1 am and the timezone back to GMT. If you don't want to have timezones, simply clear this attribute. & &TAW TRIGGERS There are four attributes triggered on the Time and Weather Code object by the clock code, TICK`HOUR, TICK`DAY, TICK`MONTH and TICK`YEAR, which are @triggered at the start of each IC hour, day, month or year, respectively. If you want to run code on a regular basis, you can do so from here. The Weather code is triggered by TICK`DAY to change the weather on a regular basis. You may need to give the Time and Weather Code object powers for it to run the code you need in the triggers (if you want it to @nspemit, for example), or you may prefer to have it trigger an attribute on another object instead. & &TAW WEATHER Weather descriptions are kept on the Time and Weather Code object, in attributes named WEATHER``. The attributes are evaluated, so the weather descriptions can contain code. Each attribute is a |-separated list of textual weather descriptions. When the weather changes, the code also makes a prediction about what the weather will change to next. These aren't always correct. They're designed to be used for newspapers, etc, which have a forecast. The predictions are stored in attributes named WEATHER`PREDICT`-> where is the current weather type, and is the type of weather the system is predicting will come next. You can also change the frequency with which one type of weather will follow another. This is controlled by the WEATHER`TYPE`` attributes, which contain a list of the types of weather which can follow from during . One is picked at random, so the more times a type appears, the more chance it has of being chosen. & 78 @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@