Bugfixes For Keran's Weather System 4.0

Fixes bugs in Keran's Weather System 4.0. Not sure if this is an official bug fix or not, use at own risk.

Author: Unknown
Category: Weather Systems
Compatibility: CobraMUSH, PennMUSH, TinyBit.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Bugfixes For Keran's Weather System 4.0


Dec. 23, 1998

MUX version:

Not a code change, but an alteration to the distribution file. The default
lock on the Storm Maker should be set to:

@lock Storm Maker=ISADMIN/1

An error occurs if the &isadmin attribute hasn't been defined when this
lock is set. Changed the order of attributes in the distribution file so
that the default lock is set after &isadmin.

Dec. 23, 1998

Added a note to the instructions about needing to execute search and
replace in a particular order if one of your dbrefs turns out to be
same as one of mine, but doesn't refer to the same object.

Dec. 24, 1998

There's a typo in the +help; every-half-hour should be every-halfhour.

&CLOCK-COMMANDS Weather and Time Help - Admin Commands=%radd <dbref> <triggerlist>%rdel <dbref> <triggerlist>%r%rThese are the commands on the Clock allowing you to add or delete items from the Clock's triggerlists, so that the Clock can trigger commands on them at appropriate times. You must be where the Clock can hear you in order to use them. <dbref> is the number of the item to be added to the Clock's triggerlists, and <triggerlist> is which triggerlist to use. The triggerlist must be time-of-day, sun, moon, tide, hour, every-hour, every-halfhour, or every-quarterhour. An item to be triggered must have an attribute &trigger-at-<time> = <action to be triggered>, where <time> is dawn, sunrise, morning, noon, afternoon, dusk, sunset, night, midnight, after~midnight, moonrise, moonset, meridian~transit, every~hour, every~halfhour, every~quarterhour, 0 through 23, high~and~rising, high~and~slack, high~and~ebbing, low~and~ebbing, low~and~slack, low~and~rising. Use &trigger-at-0 and &trigger-at-12 for triggering at precisely midnight and noon; the times of day called noon and midnight are time stretches.%r%rThe Clock triggers the Weathermaker at dawn and the Emits Bank at various times of day and hours, by default.%r

As an aside, that's /got/ to be the worst user interface in MUSHdom, and I
don't know what I was thinking of when I used a different separator for the
triggerlists and the trigger-ats. Patching the Clock to get rid of this
abomination is high on the to-do list.

Dec. 29, 1998

The first-item-edit routine in the database editing code in the instructions
for doing upgrades from 3.0 should read:

&FIRST-ITEM-EDIT me=$edit *, *: &counter me=%0; &cutoff me = %1; think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/moon-phase, #555/moon-phase)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/tide, #555/tide)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/randword, #533/randword)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/blank2tilde, #533/blank2tilde)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/tilde2blank, #533/tilde2blank)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/moon-adjective, #555/moon-adjective)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/long-weather, #533/long-weather)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/short-weather, #533/short-weather)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/tree-weather, #533/tree-weather)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/window, #533/lowercase-long-weather)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/slave-short-weather, #533/slave-short-weather)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/slave-long-weather, #533/slave-long-weather)])); think iter(lattr(#%0), set(#%0, ##:[edit(get(#%0/##), #7/slave-tree-weather, #533/slave-tree-weather)])); @switch hasattr(#%0, hear-global-emits) = 1, {&hear-weather-emits #%0 = [get(#%0/hear-global-emits)]; &hear-global-emits #%0}, @@; @trigger me/next-item-edit

There was an extra increment to the counter that would cause it to miss every
second item in a series.

Dec. 30, 1998

Fixed the inconsistency in the Clock triggerlist syntax, and errors in the
instructions. It's add <dbref> time~of~day, add <dbref> every~hour, not
add <dbref> time-of-day but add <dbref> every~hour, etc.

&TRIGGERLIST-TIME~OF~DAY Clock=#111 #173 #624
@@ Replace with dbrefs of Weathermaker, Emits Bank, and Test Room
&TRIGGERLIST-TIME-OF-DAY Clock
&ROUTINE-TIME-OF-DAY Clock=&last-time-of-day me = [u(time-of-day)]; &time-of-day me = [u(#7/time-of-day)]; @switch [comp(u(last-time-of-day), u(time-of-day))] = 0, @@, @dolist [v(triggerlist-time~of~day)] = @trigger ##/trigger-at-[u(#533/blank2tilde, u(#7/time-of-day))]
&CLOCK-COMMANDS Weather and Time Help - Admin Commands=%radd <dbref> <triggerlist>%rdel <dbref> <triggerlist>%r%rThese are the commands on the Clock allowing you to add or delete items from the Clock's triggerlists, so that the Clock can trigger commands on them at appropriate times. You must be where the Clock can hear you in order to use them. <dbref> is the number of the item to be added to the Clock's triggerlists, and <triggerlist> is which triggerlist to use. The triggerlist must be time~of~day, sun, moon, tide, hour, every~hour, every~halfhour, or every~quarterhour. An item to be triggered must have an attribute &trigger-at-<time> = <action to be triggered>, where <time> is dawn, sunrise, morning, noon, afternoon, dusk, sunset, night, midnight, after~midnight, moonrise, moonset, meridian~transit, every~hour, every~halfhour, every~quarterhour, 0 through 23, high~and~rising, high~and~slack, high~and~ebbing, low~and~ebbing, low~and~slack, low~and~rising. Use &trigger-at-0 and &trigger-at-12 for triggering at precisely midnight and noon; the times of day called noon and midnight are time stretches.%r%rThe Clock triggers the Weathermaker at dawn and the Emits Bank at various times of day and hours, by default.%r

Jan. 3, 1999 - Penn Release
The Penn port should incorporate all the changes above already.

Jan. 8, 1999 -- MUX and Penn

Typo in an attribue name.
&TREES_AUTUNM_DAY_HUMID Tree Weather Descriptions

Jan. 8, 1999 -- MUX and Penn

Not really a bug, but +today on the Global Command Object should work
correctly without the global functions loaded. Should appear this:

MUX:
&TODAY Global Command Object=$+today: @pemit %#=It's hour [u(#7/hour)] in the day, in week [u(#7/week)] of [u(#533/tilde2blank, u(#7/month))], in the year [u(#7/year)]. The [u(#555/moon-phase)] moon [switch(u(#555/moon-up), 1, is up., 0, isn't up.)] The tide is [u(#555/tide)].%r[u(#533/long-weather)]

Penn:
&TODAY Keran's Global Command Object=$+today: @pemit %#=It's hour [u(#69/hour)] in the day, in week [u(#69/week)] of [u(#2757/tilde2blank, u(#69/month))], in the year [u(#69/year)]. The [u(#2758/moon-phase)] moon [switch(u(#2758/moon-up), 1, is up., 0, isn't up.)] The tide is [u(#2758/tide)].%r[u(#2757/long-weather)]

Also, the +help on the Configuration object for global setup has incorrect
dbrefs. It incorrectly points to the Time Functions objects instead of the
Miscellaneous Functions object. Should read:

&GLOBAL-SETUP Weather and Time Help - Configuration Considerations=%rYou should put these attributes on #1 to set up the required global +functions:%r%r&SETUP-GLOBAL-FUNCTIONS #1 = @function randword = <dbref of Miscellaneous Functions>/randword; @function tilde2blank = <dbref of Miscellaneous Functions>/tilde2blank; @function blank2tilde = <dbref of Miscellaneous Functions>/blank2tilde%r@startup #1 = @trigger me/setup-global-functions%r%rFor version 4.0 of the Weather and Time Code, you'll need to kick the function_invocation_limit on the server up to handle the recoded in variable descs in children of the parent rooms. Setting function_invocation_limit to 12500 seems to suffice.%r

Jan. 15, 1999

Penn and MUX -- typo in a weather desc.

&AUTUMNDUSKFOG Weather Long Description Bank=Everything is grey, veiled by darkening twilit mist. There is little wind. It's chilly and the air feels damp.

Mar. 10, 1999

Typo in the desc of the Wizard Weather and Time command object. 'has command' should be 'has commands'.
@Desc Wizard Weather and Time Commands=This object has commands for making the most common configuration changes on it. It writes to the Time Functions Object and the Weathermaker. It has no globals and should be kept in the Auxiliary room.

Unused attribute left over from 2.0 removed.

&TREES_AUTUMN_DAY_HUMID Tree Weather Descriptions


April 30, 1999
MUX, Tiny, and Penn
Typo in the general help. The +help for the sunrise function should read:
&HELP_SUNRISE Weather and Time Help - General=%ru(#7/sunrise)%r%rReturns the num
ber of seconds after virtual midnight that sunrise takes place. If you need the
time as secs(), add u(#7/sunrise) to u(#7/last-midnight).%r


May 3, 1999
MUX, Tiny, and Penn
Bug in the Time Functions object. The system-month function should read:
&SYSTEM-MONTH Time Functions=[switch(mid(time(), 4, 3), Jan, January, Feb, February, Mar, March, Apr, April, May, May, Jun, June, Jul, July, Aug, August, Sep, September, Oct, October, Nov, November, Dec, December)]
If this bug showed up, you may also need to manually set:
&weathertype weathermaker=fair
&weathertype-old weathermaker=fair
&weathertype-master slave=fair
&slave-weathertype-old=fair
&slave-weathertype=fair
I left 'May' out of the switch(), which causes it to be impossible to
determine a season in system clock mode during May, which causes it to be
impossible to determine a weathertype, which causes weather descs to
disappear.


September 15, 1999
MUX, Tiny, and Penn
Bug in the Time Functions object. The system-season function should read:
&SYSTEM-SEASON Time Functions=[switch(u(system-month), January, winter, February, winter, March, spring, April, spring, May, spring, June, summer, July, summer, August, summer, September, autumn, October, autumn, November, autumn, December, winter)]



December 1, 1999

MUX
There's a bug in both Indoor Parent Rooms.
&HAS-SOFTFLAG Miscellaneous Functions=[hasattr(%0,%1)]
@Desc Parent of Windowless Indoor Rooms=[ifelse(u(#533/has-softflag,%#,dayblind), u(dayblind-vision), {[ifelse(u(#533/has-softflag,%#,night-vision), u(night-vision), {[ifelse(u(#533/has-softflag,%#,dark-vision), u(dark-vision), u(normal-vision))]})]})][u(instructions)]
@Desc Parent of Windowed Indoor Rooms=[ifelse(u(#533/has-softflag,%#,dayblind), u(dayblind-vision), {[ifelse(u(#533/has-softflag,%#,night-vision), u(night-vision), {[ifelse(u(#533/has-softflag,%#,dark-vision), u(dark-vision), u(normal-vision))]})]})][u(outside-desc)][u(instructions)]

Tiny2.2
&HAS-SOFTFLAG Keran's Miscellaneous Functions=[hasattr(%0,%1)]
@Desc Parent of Windowed Indoor Rooms=[switch(u(#338/has-softflag,%#,dayblind), 1, u(dayblind-vision), {[switch(u(#338/has-softflag,%#,night-vision), 1, u(night-vision), {[switch(u(#338/has-softflag,%#,dark-vision), 1, u(dark-vision), u(normal-vision))]})]})][u(outside-desc)][u(instructions)]
@Desc Parent of Windowless Indoor Rooms=[switch(u(#338/has-softflag,%#,dayblind), 1, u(dayblind-vision), {[switch(u(#338/has-softflag,%#,night-vision), 1, u(night-vision), {[switch(u(#338/has-softflag,%#,dark-vision), 1, u(dark-vision), u(normal-vision))]})]})][u(instructions)]

Penn
This only works if safer_ufun, is set to no.
&HAS-SOFTFLAG Keran's Miscellaneous Functions=[hasattr(%0,%1)]
@DESCRIBE Keran's Parent of Windowed Indoor Rooms=[ifelse(u(#2757/has-softflag,%#,dayblind), u(dayblind-vision), {[ifelse(u(#2757/has-softflag,%#,night-vision), u(night-vision), {[ifelse(u(#2757/has-softflag,%#,dark-vision), u(dark-vision), u(normal-vision))]})]})][u(outside-desc)][u(instructions)]
@DESCRIBE Keran's Parent of Windowless Indoor Rooms=[ifelse(u(#2757/has-softflag,%#,dayblind), u(dayblind-vision), {[ifelse(u(#2757/has-softflag,%#,night-vision), u(night-vision), {[ifelse(u(#2757/has-softflag,%#,dark-vision), u(dark-vision), u(normal-vision))]})]})][u(instructions)]

A note: I finally put the 4.0 Penn code up at the new port site. This means the database numbers of my working copy are different from those in the release file again. I'm changing them to the dbrefs in the 4.0 release file when I post bug-fixes, but it would be very easy to forget. If I forget, the current working copy dbrefs are:

#292 Keran's Time Functions
#293 Keran's Tree Weather Descriptions
#294 Keran's Weather Long Description Bank
#295 Keran's Box of Weather and Time Stuff, with Notes
#296 Keran's Weathermaker
#297 Keran's Wizard Weather and Time Commands
#298 Keran's Slave Weather Station
#299 Keran's Clock
#300 Keran's Emits Bank
#301 Keran's Global Command Object
#302 Keran's Weather and Time Help - Admin Commands
#303 Keran's Weather and Time Help - Configuration Considerations
#304 Keran's Weather and Time Help - General
#305 Keran's Miscellaneous Functions
#306 Keran's Storm Maker
#307 Keran's Moon and Tide Functions

Rooms:

#309 Keran's Parent of Windowless Indoor Rooms
#308 Keran's Parent of Windowed Indoor Rooms
#310 Keran's Parent of Separable Day-Night and Season Desc Outdoor Rooms
#311 Keran's Parent of Season-and-Day-Night Varying Outdoor Rooms
#312 Keran's Parent of Season-and-Day-Night-Dawn-Dusk Outdoor Rooms
#313 Keran's Parent of Separable Day-Night-Dawn-Dusk and Season Outdoor Rooms
#314 Keran's Parent of Weather-and-Day-Night Varying Outdoor Rooms
#315 Keran's Grandparent of Windowed Indoor Rooms
#316 Keran's Grandparent of Windowless Indoor Rooms
#317 Keran's Grandparent of Outdoor Rooms
#318 Keran's Great-grandparent of Rooms
#319 Keran's Test Room

Also, there was a mislocated block of text in the Penn 4.0 release file.
Some of the attributes of the General help object were listed under the
Miscellaneous Function object instead. They've been moved back where they
belong.


December 17, 1999

Tiny2.2, MUX, and Penn
There's a mistake in the instructions of the Indoor Parent Rooms. The
instructions for the portable light descriptions should read
'&portable-light-desc here=...'not '&portable-light here=...'

&INSTRUCTIONS Parent of Windowed Indoor Rooms=%r%rHow to describe variable lighting conditions in an indoor room with windows:%r&artificial-light-desc here=What the room looks like by firelight, electric light, etc., at any time of day. Overrides portable light and daylight.%r&portable-light-desc here=What the room looks like at night if it's lit by candle, flashlight, etc. This desc appears at night if the lights are out and there is something in the room set light, or carrying something set light.%r&day-desc here=What the room looks like by natural daylight. Overrides portable light.%r&night-desc here=What the room looks like at night with no artificial light sources.%r&dayblind-desc here=What the room looks like by natural or artificial light to creatures blinded by bright light.%r&night-vision-desc here=What the room looks like at night without artificial light to creatures that can see at night. %r&dark-vision-desc here=What the room looks like at night to creatures that can see in complete darkness. May be set to \[u(night-vision)\] if you're not trying to describe infravision or some such thing.%rThe vision type of a creature is determined by whether it has a dayblind, night-vision, or dark-vision attribute; no such attribute means normal human vision. Only one such attribute should be set on any creature.%r&window-prefix here=Some phrase that lets the viewer know that they're looking through a window, door, etc., at something outside. For example: 'Through the window, you can see that '. Used by the Storm Generator.%r&outside-desc here=A description of what the viewer sees when they look out, for example: Outside, \[u(#533/lowercase-short-weather)\]. Or Outside, \[u(#533/lowercase-long-weather)\].%r&light-action here=\[name(%%0)\] flips the light switch, lights the oil lamps, kindles a fire, or whatever.%r&lights-out-action here=\[name(%%0)\] turns off the lights, snuffs the oil lamps, douses the fire, and so on.%r@set here=!no_command%r'Light' turns the lights on; 'lights out' turns them off.%r&instructions here=\\ to turn these instructions off.%r&<name>-desc=\\ will turn any of the descriptions off.%rChildren of the Windowed Indoor Parent Room receive both visual and audible effects from the Storm Generator.

&INSTRUCTIONS Parent of Windowless Indoor Rooms=%r%rHow to describe variable lighting conditions in an indoor room without windows:%r&artificial-light-desc here=What the room looks like by firelight, electric light, etc., at any time of day. Overrides portable light.%r&portable-light-desc here=What the room looks like at night if it's lit by candle, flashlight, etc. This desc appears if the lights are out and there is something in the room set light, or carrying something set light.%r&dark-desc here=What the room looks like when unlit to creatures that can't see in complete darkness.%r&dayblind-desc here=What the room looks like by natural or artificial light to creatures blinded by bright light.%r&dark-vision-desc here=What the room looks like at night to creatures that can see in complete darkness.%rThe vision type of a creature is determined by whether it has a dayblind, night-vision, or dark-vision attribute; no such attribute means normal human vision. Only one such attribute should be set on any creature.%r&light-action here=\[name(%%0)\] flips the light switch, lights the oil lamps, kindles a fire, or whatever.%r&lights-out-action here=\[name(%%0)\] turns off the lights, snuffs the oil lamps, douses the fire, and so on.%r@set here=!no_command%r'Light' turns the lights on; 'lights out' turns them off.%r&instructions here=\\ to turn these instructions off.%r&<name>-desc=\\ will turn any of the descriptions off.%rChildren of the Windowless Indoor Parent Room hear audible effects produced by the Storm Generator, but no visuals.%r