The weather system of Sociopolitical Ramifications was originally developed by Neikrad for Brazilian Dreams (hence the name). This document describes an example of a room with complex MPI weather messages. - unci Other weather sources: news weather-use - How to use the weather system for your own building news weather-install - How to install new weather zones news weather-details - Details about the involved MUF programs. If you wish to install the weather system on another MUCK, please contact Neikrad (firmiss@cae.wisc.edu) directly for MUF sources and full documentations. ========================================================================== === Brazilian Dreams MUCK Weather System [ Advanced MPI Example ] === === Written by Neikrad of Brazilian Dreams and FurryMUCK, changed for === === SPR by unci (taking out the initial steps and adding dbrefs) === ========================================================================== Here is a more complex example of how you might go about using the weather system and MPI to describe a room. This particular example has been translated from a NarniaMUSH example room owned by Opal @ NarniaMUSH. I've tried to keep the MPI routines simple so that those with even minimal MPI knowledge should be able to follow the example. You should be familiar with the MPI commands {prop:}, {exec:}, {if:} and {when:}... they're used most often. The more complex MPI commands are formatted for readability. This example is for a room called... A Meadow in the Forest with a Stream --[ main description ]-- @desc = You stand in a meadow admidst a forest. The surrounding trees are thick and form a large clearing that is criss-crossed by a few animal paths. Through the center of the meadow, a brook runs through with a small waterfall that is {exec:d/waterfall}. {exec:d/daytime}. {exec:d/temp} {exec:d/breeze}. {exec:d/season}. {exec:d/precip}{exec:d/sky} ( The first part of this room description is constant. The rest executes MPI routines which will use the {weather} MPI global to vary the room description. There is nothing special about the propdir 'd', I just put all these MPI routines there just to keep things organized. Normally I've set things up so that the final period '.' is in the main description for each of the MPI-evaluated sentences. The only exception is in {exec:d/precip}. I did this because if there is no rain/snow, then no string will be returned. ) --[ waterfall ]-- ( here that sentence about the waterfall is finished ) d/waterfall = {if:{gt:{weather:tempc},0} ,roaring softly as it falls over some rocks ,frozen solid in the chill weather } --[ daytime ]-- ( a sentence or two describing the day ) d/daytime = {prop:daytime/{weather:daytime}} ( This simple routine seems to pop up over and over again ) ( {weather:daytime} can result in seven possible values dawn, sunrise, morning, afternoon, dusk, sunset, night. Seven properties should be added to the room to deal with each condition. Again, there's nothing special about the fact that I put them in a propdir called 'daytime'. You could in fact use {prop:{weather:daytime}} and put the values in properties called 'dawn', 'sunrise', etc. ) daytime/dawn = The sun is just rising behind the clouds to the east. The songs of birds can be heard as the new day begins daytime/sunrise = You see the sun rising over the treetops to the east. The eastern sky is ablaze with deep orange and golden yellow waves daytime/morning = The sounds of many animals can be heard as they begin their daily tasks daytime/afternoon = It is a quiet afternoon in the meadow. You can hear the brook babble and the birds sing but little else seems to be about at this time daytime/dusk = Behind the clouds to the west, you can tell the sun is setting. It is getting cooler in the meadow as night falls daytime/sunset = In the west, you see a glorious sunset that seems to reach across the skies with rivers of deep red, dark purple and brilliant oranges daytime/night = It is dark here in the meadow, you can barely see you hand in front of your face. Every now and then you hear a noise that makes you wonder just what sort of animals wonder about at night in meadows such as this --[ temp ]-- ( we begin a sentence talking about the air... ) d/temp = The air is quite {weather:temp} --[ breeze ]-- ( and finish the sentence here. ) d/breeze = and {prop:breeze/{weather:wind}} ( here's that structure again ) breeze/calm = very still breeze/breezy = a light breeze wafts by breeze/gusty = occassional gusts of wind blow through the meadow breeze/windy = a steady wind whistles throw the meadow breeze/hi_wind = high winds howl through the meadow --[ season ]-- ( Here we describe the season ) d/season: It is {weather:season} and the meadow {prop:season/{weather:season}} season/spring = is now covered with dark rich emerald green grass and beautiful wildflowers as far as the eye can see season/summer = is lush with green grass and alive with the sounds of many insects buzzing about season/fall = is brown with dormant grass and all the trees of the forest are alive with the many colours of fall season/winter = is cold and desolate. The trees are barren and leafless --[ precip ]-- ( This is one of the trickier ones. A string is to be returned ONLY if there is precipitation of any kind. ) d/precip = {with,{weather:precip},precip, {if:{not:{eq:{&precip},none}} ,Right now {prop:precip/{&precip}} {prop:force/{weather:prate}} {lit: } } } ( Since we use the {weather:precip} value twice, it seemed reasonable to make it a variable using {with}. That {lit} adds a couple spaces to the end. Its not really needed if you put a couple spaces before the 2nd to last '}' ) ( here's the precipitation type...) precip/rain = it is raining precip/hail = hail falls from the sky mixed with rain precip/sleet = sleet falls from the sky mixed with rain precip/snow = it is snowing ( and this describes how hard its falling ) force/0 = almost unnoticeably. force/1 = in a mist. force/2 = very lightly. force/3 = steadily. force/4 = in a forceful storm. ( The 'force/0' property is probably unnecessary but for some reason its in the Narnia example. If {weather:prate} = '0' then {weather:precip} should be 'none'. A reminder... All numeric weather values are stored as strings so if you use MUF to read weather properties you'll need to do an 'atoi' before using numeric weather values. ) --[ sky ]-- ( finally the sky is described ) ( This is the most complicated one but hopefully you're up to it ) d/sky = Above you the {prop:sky/{weather:daytime}} sky/dawn = dawn sky {exec:d/clouds} sky/sunrise = dawn sky {exec:d/clouds} sky/morning = morning sky {exec:d/clouds} sky/afternoon = afternoon sky {exec:d/clouds} sky/dusk = dusk sky {exec:d/clouds}.{exec:d/dusk-stars} sky/sunset = dusk sky {exec:d/clouds}.{exec:d/dusk-stars} sky/night = night sky {exec:d/clouds}.{exec:d/night-stars} ( evaluate different clouds for different sky conditions ) d/clouds = {prop:clouds/{weather:sky}} clouds/clear = is clear {prop:skycolor/{weather:daytime}} clouds/some_clouds = has a few {exec:cloudcolor} clouds drifting by clouds/cloudy = is nearly covered with a blanket of {exec:cloudcolor} clouds clouds/overcast = is dark and omniously overcast ( note, no dawn or dusk below ... skycolor/ props used only if clear skies ) skycolor/sunrise = and coloured golden brown by the rising sun skycolor/morning = with the sun shining radiantly skycolor/afternoon = with the sun shining radiantly skycolor/sunset = and a glow with the setting sun skycolor/night = with the heavans in clear view ( we set the cloud color to 'white' if no precipitation, 'dark' otherwise ) cloudcolor = {if:{eq:{weather:precip},none},white,dark} ( I've introduced these MPI macros below because they seem to be rather useful for conditions which come up from time to time. ) _msgmacs/visible_sky?: {with:{weather:sky},sky, {if:{or:{eq:{&sky},clear}, {eq:{&sky},some_clouds} }, 1, 0 } } ( This first one simply checks to see if you can see the sky ) _msgmacs/phase: {with:{weather:moon},moon, {left:{&moon}, {sub:{instr:{&moon}, }, 1} } } ( This give just the first word in the 'moon' property, deleting the 'waxing' or 'waning' string... possible values: new, crescent, half, gibbous, full ) ( below is where we use these _msgmacs MPI macros ) d/dusk-stars = {if:{visible_sky?},{lit: }As you look up you can just make out the first stars of the evening {prop:moon/{phase}} d/night-stars = {if:{visible_sky?},{lit: }In the evening sky you see the stars twinkling {prop:moon/{phase}} moon/new = and a tiny crescent sliver of a new moon. moon/crescent = and a crescent moon shines moon/half = and a half-full moon moon/gibbous = and a bright moon that is nearly full moon/full = and a full moon shines brightly ( This example is based on NarniaMUSH's weather system. Brazilian Dream's weather system has an additional property which might be useful here. Since the moon is only out part of the time you can use {weather:moonstat} to see if the moon is up, where [roughly] in the sky it is, or if its obscured by the sun or clouds. ) --[ Finally, an example of what this look like all put together ]-- A Meadow in the Forest with a Stream You stand in a meadow admidst a forest. The surrounding trees are thick and form a large clearing that is criss-crossed by a few animal paths. Through the center of the meadow, a brook runs through with a small waterfall that is roaring softly as it falls over some rocks. The sounds of many animals can be heard as they begin their daily tasks. The air is quite chilly and occassional gusts of wind blow through the meadow. It is fall and the meadow is brown with dormant grass and all the trees of the forest are alive with the many colours of fall. Above you the morning sky is clear blue with the sun shining radiantly. Hopefully this example shows you some of the things you can do with the MUCK weather system's MPI routine. Enjoy! --- Neikrad @ Brazilian Dreams If you see any problems with parts of this example, please contact firmiss@cae.wisc.edu