Keran's Time/Weather Snippets Patch

In this file are several bits of code that I patched over the base version of Keran's Time/Weather code package (4.0). This was NOT an easy patch, but, the system works more the way I would like it to, now. Each bit of code included here is self-inclusive: it works without the whole package. However, none of the 'fancy' features of Keran's package are included.

Author: Gwen Morse
Category: Weather Systems

Instructions

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

MUSHCode for Keran's Time/Weather Snippets Patch

@@
@@ In this file are several bits of code that I patched over the base version of
@@ Keran's Time/Weather code package (4.0). This was NOT an easy patch, but, the
@@ system works more the way I would like it to, now. Each bit of code included
@@ here is self-inclusive: it works without the whole package. However, none of
@@ the 'fancy' features of Keran's package are included.
@@


@@ Vtime. This one allows you to adjust the resulting vtime ahead or behind
@@ the multiple of the present time. That way, if you want 4:1 time, but, you want the
@@ starting date to be 50 years ahead (or behind) the present time, you can adjust it
@@ by adjusting the value of TIME-BEGINS (which should be a second-based timestamp).
@@ the decimal number on the end of the function is the decimal value of the time
@@ acceleration you want.

&VSECS Keran's Time Functions=[add(secs(),mul(sub(secs(),v(TIME-BEGINS)),2.25))]
&TIME-BEGINS Keran's Time Functions=936182650
&VTIME Keran's Time Functions=[convsecs(u(vsecs))]

@@ The season changes by the correct calendar day for a Gregorian calendar
@@ (unlike most season commands, that depend entirely by month, and do not
@@ take into account that seasons change on the 21st).

&SEASON Timer=[switch(mid(vtime(), 4, 3), Jan, WINTER, Feb, WINTER, Mar, switch(gte(mid(vtime(), 8, 2),21),1,SPRING,WINTER), Apr, SPRING, May, SPRING, Jun, switch(gte(mid(vtime(), 8, 2),21),1,SUMMER,SPRING),Jul, SUMMER, Aug, SUMMER, Sep, switch(gte(mid(vtime(), 8, 2),21),1,AUTUMN,SUMMER), Oct, AUTUMN, Nov, AUTUMN, Dec, switch(gte(mid(vtime(), 8, 2),21),1,WINTER,AUTUMN))]

@@ This is replacement code my husband worked out for Keran's Moon/Tide functions
@@ I didn't quite like the way the original code worked. Tide_begin is a basic starting
@@ timestamp, just like time_begins from vtime(). Tide_cycle is how long each tide is, in
@@ seconds. I chose the length of my cycle by the average tide figures from the daily paper.
@@ This length provides roughtly two high and two low tides each day, just like the Atlantic.
@@ It could be quite useful for doing tide-locked exits and room descs :).

&TIDE_BEGIN Keran's Moon and Tide Functions=936182650
&TIDE_CYCLE Keran's Moon and Tide Functions=44160
&FN_TIDE Keran's Moon and Tide Functions=[switch(u(div(mul(10,mod(sub(vsecs(),v(tide_begin)),v(tide_cycle))),v(tide_cycle))),0,high,1,high,2,medium,3,medium,4,medium,5,low,6,low,7,medium,8,medium,9,medium)] and [switch(u(div(mul(10,mod(sub(vsecs(),v(tide_begin)),v(tide_cycle))),v(tide_cycle))),0,ebbing,1,rising,2,rising,3,rising,4,rising,5,rising,6,ebbing,7,ebbing,8,ebbing,9,ebbing)]

@@ I run a builder character responsible for an atmosphered moon that circles around a gas giant planet.
@@ In an attemt to make things more interesting, I decided to give it an unusual length to one "solar" day.
@@ Referencing Robert Heinlein's "Farmer in the Sky", I was able to model lunar time after Ganymede,
@@ a satellite of Jupiter that has a solar day that last 168 hours (an earth "week").
@@ This makes morning, afternoon, evening, and night each last 42 hours.
@@
@@ The moon I run is named Verron IV, and it circles around the gas giant Verron, so, FN_VERRON is the
@@ visibility of the gas giant in the sky. "Prime", "Secundus" and "Tierce" are the three moons between
@@ Verron IV and Verron (Verron I, II, and III). The FN belonging to each of those names shows the
@@ orbital pattern of each of those moons.
@@ Time_of_day is the function that calls all the other code together. It includes lunar and
@@ reverse elipses, sunrise and sunset descs, and other goodies!

&FN_VERRON Keran's Moon and Tide Functions=[switch(div(mod(secs(),604800),75600),0,new,1,waxing crescent,2, waxing half,3,waxing gibbous,4,full,5,waning gibbous,6,waning half,7,waning crescent)]
&FN_PRIME Keran's Moon and Tide Functions=[switch(div(mod(secs(),86400),10800),0,new,1,waxing crescent,2,waxing half,3,waxing gibbous,4,whole full,5,waning gibbous,6,waning half,7,waning crescent)]
&FN_SECUNDUS Keran's Moon and Tide Functions=[switch(div(mod(secs(),172800),21600),0,new,1,waxing crescent,2,waxing half,3,waxing gibbous,4,full disk,5,waning gibbous,6,waning half,7,waning crescent)]
&FN_TIERCE Keran's Moon and Tide Functions=[switch(div(mod(secs(),345600),43200),0,new,1,waxing crescent,2,waxing half,3,waxing gibbous,4,full and round,5,waning gibbous,6,waning half,7,waning crescent)]
&FN_TIME Keran's Moon and Tide Functions=[switch(div(mod(secs(),604800),151200),0,night,1,morning,2,afternoon,3,evening)]
&TIME_OF_DAY Wrist Unit=[switch(u(fn_isnight),1,{During the night phase, the dark sky is truly spectacular. The gas giant and its satellites provide a miniature solar system for anyone who chooses to watch the show.},{From the angle of the sun, it appears to be [u(fn_time)].})][switch(div(mod(secs(),604800),10800),0,{%bThe moon is transitioning through a reverse eclipse, coming between the gas giant and the sun. The golden face is so huge that the moon's tiny shadow crawl across the surface like a freckle.} ,14,{%bThe morning sunrise welcomes a new day, with the softer colors of red, violet, pink and gold. A hint of an unusual bluish-green, almost turquoise color, highlights the lowest band of clouds. The shimmering colors are soothing and relaxing.},28,{%bThe gas giant is transitioning through a solar eclipse, coming between Verron IV and the sun. A beautiful red ring of light surrounds the dark face.},42,{%bThe red-violet corona of the setting sun paints bright bands of color across the evening sky. Warm reds and yellows blends with cool violet. Glittering faintly behind the brighter colors of the glorious sunset are the first evening stars.})][switch(u(fn_verron),New,,{%bThe great gas giant Verron hangs in the sky, never rising or setting, wondrous in the way it's suspended above in its golden [u(fn_verron)] phase. Dark points on the visible face appear to be the shadows of other near moons.})][switch(u(fn_isnight),1,{%bTiny conspicuous lights, bright as stars but unwinking, are the further and smaller moons.})][switch(u(fn_prime),New,,{%bThe lavender-tinted Prime moon spins through its [u(fn_prime)] profile, visibly changing location in the sky every few minutes.})][switch(u(fn_secundus),New,,{%bThe giant copper-tinted Secundus moon calls attention to its [u(fn_secundus)] outline.})][switch(u(fn_tierce),New,,{%bStately blue-white Tierce, the moon closest to Verron IV, reveals a [u(fn_Tierce)] face.})]
&FN_ISNIGHT Keran's Moon and Tide Functions=[switch(u(fn_time),night,1,0)]
&FN_ISNIGHT Keran=[switch(u(fn_time),night,1,0)]

@@ For a standard "Earth" moon, use the following function.

&FN_MOON Keran's Moon and Tide Functions=[switch(div(mod(secs(),2419200),302400),0,new,1,waxing crescent,2,waxing half,3,waxing gibbous,4,whole full,5,waning gibbous,6,waning half,7,waning crescent)]