MPP - Day and Night Sky Cycle V2.4 - Documentation
A complete day and night cycle for your Sansar scene, ready to use: a sun that follows the real path of the sun for the place and the date you choose, a sky dome with stars, a cloud layer, a desk of buttons for your visitors, and a scheduler that talks in the nearby chat and can switch your lamps on at sunset.
New in V2.4: the scene clock can show legal time (time zone, summer time, longitude), and sunrise and sunset are within about 3 minutes of the official times. The set is delivered for Paris; to use another place, you only change a few settings (section 2).
Contents
- What you get
- Quick start (5 minutes)
- The Commands Desk
- How time works
- Control settings
- Sun settings
- Sky, Stars and Clouds settings
- Visitor commands
- Scheduled events - Actions A and Actions B
- Announcements
- Welcome message
- Adding the script to your own objects
- Recipes
- Troubleshooting
- Limits
1. What you get
In Build mode, your inventory holds the item - MPP - Day and Night Sky Cycle - V 2.4. It is one parent object that groups four objects, all already scripted and set up:
| Object | What it is | Scripts on it |
|---|---|---|
| MPP Sun | The directional light: the sun by day, the moonlight at night | MPP - Day Night - Control (every setting of the scene: place, date, day length, visitor commands, scheduler) and MPP - Day Night - Sun (the light and its colors) |
| MPP Sky | The sky dome | MPP - Day Night - Sky (the sky layers of the dome) and MPP - Day Night - Stars (the star layer, lit at night only) |
| MPP Clouds | Two cloud spheres that stay still | MPP - Day Night - Clouds (one script drives both spheres) |
| MPP - Commands Desk | A desk with 9 buttons for your visitors | one MPP - ActionButton script (V1.7.0) on each button |
The five DayNight scripts are the same script, MPP - Day Night V2.4.0, used as three modules:
- Control (on MPP Sun): the settings of the whole scene. It sends them to the Sun, and receives the visitor commands.
- Sun (on MPP Sun): moves the light along the sun path and changes its color and intensity through the day.
- Sky (three times: Sky and Stars on MPP Sky, Clouds on MPP Clouds): each one follows the Sun, fades and tints the materials of its object and, when its rotation is On, turns the object with the sun.
To see the settings of a script: in the Scene Objects list, expand - MPP - Day and Night Sky Cycle - V 2.4 to show its four objects, select one and open Properties. Each script appears as a block titled with its name in capitals, for example MPP - DAY NIGHT - CONTROL. Under the title, the first drop-down shows the script (MPP - Day Night V2.4.0) and the second one its module (MPPDayNightControl, MPPDayNightSun or MPPDayNightSky). On MPP Clouds the script sits on the part Sphere 02. The nine buttons are the objects inside MPP - Commands Desk, named after their button (for example MPP button - City).
All the modules talk on one private channel, General/Group = DayNight. Keep it identical everywhere.
2. Quick start (5 minutes)
2.1 Place the set
- Open your scene in Build mode.
- In your inventory, find - MPP - Day and Night Sky Cycle - V 2.4 and drag it into the scene.
- Move it near the centre of your scene: the sky dome and the clouds surround it.
- Do not rotate MPP Sun, MPP Sky or MPP Clouds on their own: the sun and the sky are set to turn together from their current orientation. You may move the whole set, and turn the whole set around the vertical axis (for example to choose where the sun is at noon), but never tilt it.
- Save and build the scene, then visit it. The sun already runs: Paris, July 21, a 4-hour day, opening at 4:30 AM at the first light of dawn.
2.2 Choose your place on the globe
Select MPP Sun, open Properties, and go to the block MPP - DAY NIGHT - CONTROL, group Geo:
| Setting | Delivered | What to type |
|---|---|---|
| Geo/Latitude (deg) | 48.857 (Paris) | Latitude of your place, -90 to 90. Negative = south of the equator |
| Geo/Longitude (deg) | 2.352 (Paris) | Longitude, -180 to 180. Negative = west of Greenwich |
| Geo/UTC Offset (h) | 1 | Time zone in winter, in hours from UTC: London 0, Paris 1, New York -5, Tokyo 9, India 5.5 |
| Geo/Clock Mode (0-4) | 2 | Summer time rule: 1 = none, 2 = Europe, 3 = North America, 4 = Australia. 0 = solar clock (12:00 = sun at its highest) |
| Geo/Place Name | Paris in France | The name of your place, as the welcome message will say it |
Appendix A gives these values for 40 cities. Example, Tokyo: latitude 35.68, longitude 139.65, UTC Offset 9, Clock Mode 1, Place Name Tokyo in Japan.
Do not forget Geo/Place Name: the welcome message quotes it.
The desk's City button only knows Stockholm, Paris, Los Angeles and Sydney: once a visitor clicks it, your own place comes back only when the scene restarts. Delete that button (it is the object MPP button - City inside the desk) if you want to keep your place.
2.3 Choose the day of the year
Same block, Geo/Day Of Year (1-365). Delivered: 202 (July 21). The day sets the height of the sun and the length of the day.
| Day | Date | In the north | In the south |
|---|---|---|---|
| 79 | March 20 | Spring equinox, about 12 hours of day | Autumn |
| 172 | June 21 | Longest day | Shortest day |
| 266 | September 23 | Autumn equinox | Spring |
| 355 | December 21 | Shortest day | Longest day |
Appendix B gives the day number of 20 well-known dates (Christmas = 359, Halloween = 304...). The date does not advance by itself: the scene always replays the day you chose.
The desk's Season button switches between days 172 and 355 only: once a visitor clicks it, your own day comes back only when the scene restarts. Delete that button (MPP button - Season) if you want to keep your day.
2.4 Choose the length of a day and the opening hour
Same block, group Cycle:
| Setting | Delivered | What it does |
|---|---|---|
| Cycle/Day Length (hours) | 4 | Real time for one full in-world day (24 in-world hours), hours part |
| Cycle/Day Length (minutes) | 0 | Minutes part, added to the hours |
| Cycle/Start Time (0-24h) | 4.5 | Hour on the scene clock when the scene starts: 4.5 = 4:30 AM, 12 = 12:00 PM, 21.25 = 9:15 PM |
Examples: 1 h 0 min = a whole day in one real hour; 0 h 16 min = a fast day for a demo; 24 h 0 min = the in-world day runs at real speed.
If you change the day length, also change Buttons/Normal (minutes) (same block, group Buttons) to the same length in minutes, for example 60 for a 1-hour day. The desk's Cycle speed button switches between Buttons/Fast and Buttons/Normal: otherwise its "normal" position brings back the 4-hour day.
4:30 AM is the first light of dawn in Paris in July. After changing the place or the day, check the opening hour: for example 9 opens the scene in the morning almost everywhere.
2.5 Save, build and visit
Type /daynight help in the nearby chat to see the visitor commands, or click the ? button of the desk. That is all you need: the rest of this guide explains every option.
3. The Commands Desk
A sloped desk titled Commands Desk with 9 buttons. The large button on the left is Help. The top row holds the four "setting" buttons (from left to right: Cycle speed, Season, Time of day, City); the bottom row holds the four "moment" buttons (Sunrise, Noon, Sunset, Midnight). Any visitor can click them.
| Button | Icon | What a click does |
|---|---|---|
| Help | a question mark | Sends the list of chat commands privately to the visitor who clicked |
| Sunrise | a half sun on the horizon, arrow up | The sun sweeps to today's sunrise |
| Noon | a full sun | The sun sweeps to its highest point |
| Sunset | a half sun on the horizon, arrow down | The sun sweeps to today's sunset |
| Midnight | a moon and stars | The sun sweeps to its lowest point |
| Time of day | a sun and a moon joined by circular arrows | Each click goes to the next moment: sunrise, noon, sunset, midnight, then again. The button keeps the color of the last moment sent |
| Cycle speed | a fast-forward sign | Switches between a fast day (16 real minutes) and the normal day (4 hours). Red = fast, green = normal. It starts green |
| Season | a sun and a snowflake | Switches between the summer solstice (June 21, day 172) and the winter solstice (December 21, day 355). Yellow = summer, blue = winter |
| City | a globe with a pin | Goes through Stockholm, Paris, Los Angeles and Sydney: latitude, longitude, time zone and summer time together. Each city has its color: light blue, warm white, yellow, green |
Good to know:
- Sweeps. A time button does not jump: the sun, the sky and the light sweep to the requested moment in 8 seconds (
Transition/Duration (s)on the Control). Time always moves forward, so asking for sunrise in the evening goes through the night. - One command every 4 seconds. The Control accepts one visitor command every 4 seconds, for everybody, buttons and chat together (
Chat/Cooldown (s)). A click during that time is refused, and the visitor receives a private "[DayNight] please wait". Each button also has its own short cooldown (0.8 s, shared by all visitors): when the same button is clicked again too fast, by you or by someone else, it answers privately "Please wait 1 second before using this button again." and the click is ignored. A multi-state button (Time of day, Cycle speed, Season, City) moves to its next state even when its click is refused: its color no longer matches the scene, and its next click sends the state after that one. Wait a few seconds, then click on until the scene shows what you want (Cycle speed and Season: two more clicks). - Season and City move the clock. These buttons keep the solar time: the sun stays at the same point of its daily course, only higher or lower for the new date or place. With a legal clock the hour shown jumps, usually by about 1 hour.
- Colors at start. When the scene starts, Time of day shows the sunrise color, Season the summer color, City the Stockholm color, and Cycle speed the green (normal) color. The first click of Time of day, Season or City sends the first command of its list.
- Adjust or remove it. You can move, resize, copy or delete the desk: it has no link with the other objects, it only sends script events. Without it, the chat commands still work.
- Keep the sun to yourself. Turn
Owner OnlyOn on each button (script MPP - ActionButton): only you, the scene owner, can then use them; add your friends' handles to itsAccess Listto let them in too. Visitors who are not allowed receive a private "You are not allowed to use this button." (Denied Text), andHide From DeniedOn even hides the buttons from them. TurnChat/Owner OnlyOn in the Control as well, for the chat commands. Other ways: delete the desk, or turnButtons/EnableOff in the Control (the buttons then still click and change color, but do nothing). - Add a button. Any object with the MPP Action Button Script (V1.7.0, Appendix C) works with
Send as Command = Onand one of the command texts of section 8, for exampledaynight_summer.
Button settings (script MPP - ActionButton V1.7.0)
Shared by the 9 buttons: Collision Mode Off (click), Cooldown Seconds 0.8, Global Cooldown On, Cooldown Notice On (text "Please wait {time} before using this button again."), Owner Only Off, Access List empty, List Is Blacklist Off, Denied Text "You are not allowed to use this button.", Hide From Denied Off, Send as Command On, Private Text Off, Remote Control Off (Remote Prefix mpp_actionbutton, unused), Click Sound MPP - Computer Beep at volume 100, Visual On, Tint Material Name empty (every tintable material of the button), Return Fade Seconds 0.8, Emissive On, Debug Off.
| Button | Hover Text | Command Count | Initial Command | Commands | Tints (RGB) |
|---|---|---|---|---|---|
| Help | Help | 1 | 0 | daynight_help | 230,230,230 |
| Sunrise | Sunrise | 1 | 0 | daynight_sunrise | 255,183,113 |
| Noon | Noon | 1 | 0 | daynight_noon | 255,240,228 |
| Sunset | Sunset | 1 | 0 | daynight_sunset | 255,60,163 |
| Midnight | Midnight | 1 | 0 | daynight_midnight | 84,120,217 |
| Time of day | Time of day | 4 | 0 | daynight_sunrise, daynight_noon, daynight_sunset, daynight_midnight | 255,183,113 / 255,240,228 / 255,60,163 / 84,120,217 |
| Cycle speed | Cycle speed | 2 | 2 | daynight_fast, daynight_normal | 255,89,89 / 89,255,89 |
| Season | Season | 2 | 0 | daynight_summer, daynight_winter | 255,217,89 / 89,166,255 |
| City | City | 4 | 0 | daynight_stockholm, daynight_paris, daynight_losangeles, daynight_sydney | 166,220,255 / 255,240,228 / 225,217,89 / 89,255,166 |
The one-command buttons flash their tint with an emissive of 0.2, then fade back; the multi-state buttons keep the tint of their current state, with an emissive of 4.
4. How time works
- The in-world day runs from 0 h to 24 h on the scene clock (see below). Its real duration is
Cycle/Day Length(delivered: 4 real hours). - The clock is anchored on real time: a 4-hour day lasts 4 hours, with no drift, whatever the server load.
- Sunrise and sunset are computed from
Geo/LatitudeandGeo/Day Of Year. Near the poles the sun may never set (polar day) or never rise (polar night). - The day is cut in four periods: Morning, Day, Evening, Night. With
Timeline/Auto From GeoOn they follow the computed sunrise and sunset. Each period has its own light color and intensity on the Sun, and its own tint on the sky, the stars and the clouds.
Solar time and legal time
The sun itself always moves in solar time: at 12:00 solar time it stands at its highest. Real clocks show legal time, which differs by the time zone, summer time, the longitude inside the time zone and the equation of time (the sun runs up to 16 minutes early or late during the year). In Paris, the sun culminates between 12:34 PM (early November) and 1:57 PM (late July), legal time.
Geo/Clock Mode chooses the clock that visitors read and type: 0 = solar time, 1 = legal time without summer time, 2 = legal time with European summer time (delivered), 3 = North American, 4 = southern hemisphere (Australia). With a legal clock, set Geo/Longitude and Geo/UTC Offset (winter offset from UTC: Paris 1, London 0, New York -5). The City button sets all three (a Control in Clock Mode 0 keeps solar time). Appendix A gives the values of 40 cities.
Hours you type (time 18, 18:30 in the Events lists, Cycle/Start Time) are on the scene clock. Keywords follow the sun: sunrise, sunset, noon (sun at its highest) and midnight (sun at its lowest). The four manual period starts of the timeline are solar hours, because they describe the light.
Sunrise and sunset follow the published convention (upper edge of the sun on the horizon, with atmospheric refraction). Accuracy: about 3 minutes compared with official ephemerides, with a few exceptions near the polar circles and around the summer time switches (section 15).
Example - the delivered set (Paris, July 21). The scene clock is 1 h 57 min ahead of the sun. Sunrise reads 6:10 AM and sunset 9:44 PM, like the real ones; the sun is at its highest at 1:57 PM, so the Noon button answers time set to noon (1:57 PM); /daynight time 12 puts the sun 1 h 57 min before its highest point. The scene opens at 4:30 AM, when the Morning period begins: the first light of dawn, 1 h 40 min before sunrise.
5. Control settings
Object MPP Sun, block MPP - DAY NIGHT - CONTROL (module MPPDayNightControl). The "Delivered" column gives the values of the set.
Cycle
| Setting | Delivered | What it does |
|---|---|---|
| Cycle/Day Length (hours) | 4 | Real duration of a full in-world day, hours part (0 to 72) |
| Cycle/Day Length (minutes) | 0 | Minutes part (0 to 59). 0 h 0 min falls back to 4 hours |
| Cycle/Start Time (0-24h) | 4.5 | Hour when the scene starts, on the scene clock. 12 = 12:00, 6.5 = 6:30 AM. Applied again when the Control or the Sun restarts |
Geo
| Setting | Delivered | What it does |
|---|---|---|
| Geo/Use Geographic Model | On | Realistic sun height and day length for the latitude and the season. Off = latitude and date are ignored: the sun rises at 6:00 and sets at 18:00 solar time every day and passes straight overhead at noon (the Sun's Advanced/Tilt Extra Offset can tilt that path) |
| Geo/Latitude (deg) | 48.857 | -90 to 90. Negative = southern hemisphere |
| Geo/Longitude (deg) | 2.352 | -180 to 180, east positive, west negative. Places solar noon on a legal clock |
| Geo/Day Of Year (1-365) | 202 | 79 = Mar 20, 172 = Jun 21, 202 = Jul 21, 266 = Sep 23, 355 = Dec 21 (Appendix B) |
| Geo/Place Name | Paris in France | Name shown by {place} and {location} in the messages. The City button sets it and the chat command lat clears it; typing your own latitude here does not clear it |
| Geo/Clock Mode (0-4) | 2 | Clock that visitors read and type. 0 = solar time, 1 = legal time, 2 = legal + European summer time, 3 = legal + North American summer time, 4 = legal + southern summer time (Australia). With Use Geographic Model Off, choose 0 to keep sunrise at 6:00 and sunset at 18:00 |
| Geo/UTC Offset (h) | 1 | Winter time zone in hours from UTC, -12 to 14, decimals allowed (India 5.5). Summer time is added by the Clock Mode |
Timeline
| Setting | Delivered | What it does |
|---|---|---|
| Timeline/Auto From Geo | On | The four periods follow the computed sunrise and sunset (recommended) |
| Timeline/Twilight (% of day) | 7 | Morning starts this much before sunrise and Day this much after; the same around sunset (Evening, Night). 7 % of a day = 1 h 41 min in-world |
| Timeline/Blend Width (% of day) | 8 | Softness of each period change |
| Timeline/Manual Morning / Day / Evening / Night Start (h) | 4.8 / 7.2 / 16.8 / 19.2 | Used only when Auto From Geo is Off. Solar hours (12 = sun at its highest), because they describe the light. Decimal hours: 6.5 = 6:30 |
Chat, Buttons, Transition
| Setting | Delivered | What it does |
|---|---|---|
| Chat/Enable | On | Listens to the chat commands (section 8) |
| Chat/Prefix | /daynight | Command prefix |
| Chat/Owner Only | Off | On = only the scene owner can use the chat commands. The buttons are not affected |
| Chat/Feedback | On | Private confirmation after each command, and the private "please wait" and error messages. Off = silent (the help is still sent) |
| Chat/Cooldown (s) | 4 | Minimum delay between two visitor commands, chat and buttons together. Refused commands answer "please wait". 0 = off |
| Buttons/Enable | On | Listens to the buttons of the desk |
| Buttons/Event Prefix | daynight | Prefix of the button command texts. If you change it, change the commands of the buttons too |
| Buttons/Fast (minutes) | 16 | Day length applied by the Cycle speed button (fast) |
| Buttons/Normal (minutes) | 240 | Day length applied by the Cycle speed button (normal). Keep it equal to your Cycle/Day Length |
| Transition/Duration (s) | 8 | The sun sweeps to a requested time in this many seconds. 0 = instant jump |
Events, General, Debug
| Setting | Delivered | What it does |
|---|---|---|
| Events/Enable | On | Master switch of the scheduler: actions, announcements and welcome message |
| Events/Actions A (states) | 2 lines | sunset | mpp_lamp_all_on and sunrise | mpp_lamp_all_off (section 9) |
| Events/Actions B (moments) | empty | Section 9 |
| Events/Announcements | 3 lines | hourly | It is {time}., morning | Have a good day!, night | Have a restful night. (section 10) |
| Events/Welcome Mode (0-2) | 2 | 0 = off, 1 = once in nearby chat, 2 = privately to each visitor (section 11) |
| Events/Welcome Delay (s) | 10 | Seconds between the visitor's arrival and the message (0 to 60) |
| Events/Welcome Message | see section 11 | The welcome text |
| General/Group | DayNight | Must match the Sun and the Sky modules |
| Debug/Verbose Logging | Off | Logs config pushes, commands and every scheduled event in the script console |
6. Sun settings
Object MPP Sun, block MPP - DAY NIGHT - SUN (module MPPDayNightSun).
| Setting | Delivered | What it does |
|---|---|---|
| Rotation/Axis (x|y|z) | x | Axis of the daily rotation. Keep x |
| Rotation/Invert Direction | Off | Reverses the direction of the sun. The sky follows automatically |
| Rotation/South Direction (x|-x|y|-y) | empty | World axis of the geographic south. North of the tropics the sun culminates toward it at noon; south of the equator it culminates on the opposite side. Empty = keep the pose (with the delivered pose, south = -x). Prefer turning the whole set: this setting turns the sun path only, not the dome |
| Light/Enable Timeline | On | Drives the light color and intensity through the four periods |
| Light/Morning Color, Intensity | 255,141,45 (golden), 3.2 | Sunrise light |
| Light/Day Color, Intensity | 255,245,224 (warm white), 8 | Daylight |
| Light/Evening Color, Intensity | 255,39,243 (magenta), 2 | Sunset light. For a natural copper sunset, try 255,99,41 |
| Light/Night Color, Intensity | 56,98,215 (moonlight blue), 0.04 | Night light. Raise the intensity for brighter nights |
| General/Group | DayNight | Private channel shared with the Sky and Control modules |
| Advanced/Tilt Axis (x|y|z) | z | Axis of the latitude and season tilt. Keep z |
| Advanced/Tilt Extra Offset (deg) | 0 | Artistic tilt added to the latitude. 0 = realistic |
| Advanced/Base Euler <x,y,z> (deg) | <0,0,0> | Extra rotation of the sun path. Keep <0,0,0> |
| Advanced/Tick (s) | 0.25 | Evaluation interval of the light |
| Debug/Verbose Logging | Off | Detailed log lines |
| Debug/Heartbeat (s) | 0 | Periodic status line in the log. 0 = off |
Intensities go from 0 to 100. The evening colors of the whole set (light, sky, clouds) are a stylized magenta sunset.
7. Sky, Stars and Clouds settings
Three modules share the same settings (module MPPDayNightSky):
- Sky: object MPP Sky, block MPP - DAY NIGHT - SKY. It drives the sky layers of the dome (materials
SkyandFX). - Stars: object MPP Sky, block MPP - DAY NIGHT - STARS. It drives the star layer of the same dome (material
Stars). Its Emissive is 0 by day and 3.2 at night (Blend/Emissive Day / Night), so the stars shine at night and vanish by day. - Clouds: object MPP Clouds, block MPP - DAY NIGHT - CLOUDS. It drives every scriptable material of the object, so both cloud spheres. The clouds do not rotate but darken at night and take the colors of the day.
| Setting | Sky | Stars | Clouds | What it does |
|---|---|---|---|---|
| Rotation/Enable | On | On | Off | The layer turns with the sun |
| Rotation/Cycle Axis (x|y|z) | x | x | x | Rotation axis. Keep x |
| Rotation/Cycle Angle Offset (deg) | 0 | 0 | 0 | Keep 0 |
| Materials/Names (empty=all) | Sky, FX | Stars | empty | Names of the materials to drive. Empty = every scriptable material of the object |
| Materials/Match Mode (1-4) | 4 | 1 | 4 | 1 = exact name, 2 = exact ignoring case, 3 = contains, 4 = contains ignoring case |
| Materials/Log Names | Off | Off | Off | On = lists the found, driven and skipped materials in the log at start |
| Blend/Enable | On | On | On | Fades the materials between their Day and Night values around the horizon |
| Blend/Horizon (deg) | 12 | 12 | 12 | Half-width of the fade. Higher = longer dawn and dusk |
| Blend/Absorption Day / Night | 0 / 0.96 | 0 / 0 | 0.2 / 1 | Absorption of the material by day and by night |
| Blend/Emissive Day / Night | 0 / 0.16 | 0 / 3.2 | 0.96 / 0.32 | Emissive intensity by day and by night |
| Tint/Enable | On | On | On | Tints the materials through the four periods |
| Tint/Morning Color | 255,163,104 | 104,164,255 | 255,204,104 | Tint of the morning |
| Tint/Day Color | white | white | white | White = no tint |
| Tint/Evening Color | 190,60,255 | 255,140,59 | 255,59,183 | Tint of the evening |
| Tint/Night Color | 17,47,173 | white | 16,117,173 | Tint of the night |
| General/Group | DayNight | DayNight | DayNight | Must match the Sun |
| Advanced/Resync Threshold (deg) | 1 | 1 | 1 | The layer realigns only when it is further than this from the Sun |
| Advanced/Tick (s) | 0.25 | 0.25 | 0.25 | Evaluation interval of the blend and tint |
| Debug/Verbose Logging, Heartbeat (s) | Off, 0 | Off, 0 | Off, 0 | Same as the Sun |
8. Visitor commands
Chat
Type these in the nearby chat. Every command but help goes through the shared cooldown (4 seconds).
| Command | Effect |
|---|---|
/daynight help | Lists the commands |
/daynight midnight sunrise noon sunset | Sweeps to that moment of the sun: noon = sun at its highest, midnight = at its lowest; sunrise and sunset are the computed ones for the current place and season. The answer gives the clock time, e.g. time set to noon (1:57 PM) |
/daynight time 18 | Sweeps to 6:00 PM on the scene clock. Decimals allowed: time 6.5 = 6:30 AM |
/daynight length 16 | A full day now lasts 16 real minutes (0.5 to 4320) |
/daynight date 172 | Day of the year: 172 = summer solstice |
/daynight lat -33.9 | Custom latitude. Longitude, time zone and clock mode stay as they are |
/daynight stockholm paris losangeles sydney | City presets: latitude, longitude, time zone, summer time rule and place name. A Control set to Clock Mode 0 stays on solar time |
With a legal clock (Clock Mode 1-4), date, the season and the city commands keep the solar time (the sun changes height, not its place in the day) but make the clock jump, usually by about 1 hour.
A command changes the scene for everybody until the scene restarts (or until the Control or the Sun script restarts): then the settings of the Control apply again.
Button commands
The desk sends these texts as script events (MPP ActionButton, Send as Command = On):
daynight_midnight daynight_sunrise daynight_noon daynight_sunset daynight_fast daynight_normal daynight_summer daynight_winter daynight_help daynight_stockholm daynight_paris daynight_losangeles daynight_sydney
daynight_fast and daynight_normal apply Buttons/Fast and Buttons/Normal; daynight_summer and daynight_winter jump to days 172 and 355.
9. Scheduled events - Actions A and Actions B
The Control can send script events to any other script of the scene at chosen in-world times. Two lists, the same syntax, two different behaviors.
Delivered: Actions A holds sunset | mpp_lamp_all_on and sunrise | mpp_lamp_all_off. No lamp comes with the set: these two lines are a ready-made example for lamps driven by the MPP Light Switch Script (V1.5.1, sold on the Sansar Store, see Appendix C; V1.4.2 works too), which is compatible as is. Put that script on your lamps with External Events On and they switch on at sunset and off at sunrise by themselves (example 1). Without such lamps these two lines do nothing; delete them if you like. Actions B is empty.
Line syntax
when | event_name
when | event_one, event_two
Everything before the first | is the time, everything after is one event name or several separated by commas. Event names are sent exactly as typed (case and punctuation kept). Each list holds up to 20 lines.
The when part
| You type | Meaning |
|---|---|
18:30 18h30 18h 18.5 18,5 | A fixed hour on the scene clock, 0 to 24 |
sunrise sunset | The computed sunrise and sunset. They move with latitude and season |
morning day evening night | The start of that period of the timeline |
noon midnight | The sun at its highest and at its lowest (solar noon and midnight). They read 12:00 and 00:00 only with Clock Mode 0; in Paris in July, noon reads about 1:57 PM |
hourly | Every full hour of the scene clock (24 times a day) |
sunset-0:30 night+1 sunrise+0.25 | A keyword shifted by hours: 30 minutes before sunset, 1 hour after nightfall, 15 minutes after sunrise |
A = states, B = moments
| Actions A (states) | Actions B (moments) | |
|---|---|---|
| Use it for | Things that are on or off: lamps, fires, fountains, shop signs | Things that happen: a bell, a rooster, a firework, a sound |
| At scene start | Replayed: after 5 seconds the scene is put in the state it should have at the current hour | Nothing |
| After a jump or sweep (Noon button) | The states crossed on the way are applied | Skipped |
| When the season or place changes | Replayed | Not replayed. With a legal clock the clock may jump, so a fixed hour or an hourly line can come round a second time or be skipped once |
| Rule | Use explicit on / off events, never a toggle | Anything |
Why it matters: start the scene at 10 PM with lamps in list A and they are lit within 5 seconds, although sunset happened before the scene existed. A bell at 18:00 in list A would ring at every scene start; in list B it rings only when 6 PM really passes.
The Control's own commands (
daynight_noon,daynight_summer...) are refused in list A, because a replayed time command would loop. Put them in list B.
Example 1 - street lamps (MPP Light Switch Script V1.5.1 or V1.4.2)
LightSwitch settings: External Events = On, External Event Prefix = mpp_lamp. (V1.4.0 and V1.4.1 also answer the _all_ names below; on V1.4.0 the switch is called Enable External Script Events.) Since V1.5 the lamp's Cooldown Seconds also applies to these events: when the scheduler replays the last 24 hours (scene start, Season or City change), each lamp goes straight to the right state, without blinking.
Actions A (states)
sunset | mpp_lamp_all_on
sunrise | mpp_lamp_all_off
_all_ reaches every LightSwitch whatever its Group. To drive one group only, write the group name in lowercase, with underscores for spaces. For lamps whose Group is Street:
sunset | mpp_lamp_street_on
sunrise | mpp_lamp_street_off
Use night and morning instead of sunset and sunrise to switch at the end of dusk and at the first light of dawn.
Example 1b - the same with MPP LightSwitch V1.3
V1.3 listens to another name pattern: <Event Prefix>:<group in lowercase>:<action>. With Event Prefix = mpp_lamp and Group = Lamp:
Actions A (states)
sunset | mpp_lamp:lamp:on
sunrise | mpp_lamp:lamp:off
With an empty Group the names are mpp_lamp:on and mpp_lamp:off.
Example 2 - shop window lit before the street lamps
Actions A (states)
sunset-0:30 | mpp_lamp_shop_on
23:00 | mpp_lamp_shop_off
sunset | mpp_lamp_street_on
sunrise | mpp_lamp_street_off
Example 3 - one line, several receivers
sunset | mpp_lamp_all_on, campfire_on, fountain_off
sunrise | mpp_lamp_all_off, campfire_off, fountain_on
Example 4 - moments
Actions B (moments)
sunrise | rooster_crow
12:00 | church_bell
hourly | clock_chime
midnight | daynight_summer
The last line uses a DayNight command as a moment: each time the sun really passes its lowest point (midnight), the season jumps to summer. Like a click, it goes through the 4-second cooldown: it is skipped silently if a visitor command was accepted just before, and a visitor who clicks right after gets "please wait".
Which scripts can receive these events?
Any script that subscribes to a script event by name. One thing to know: a scheduled event is sent by the scene, not by a visitor, so it carries no avatar.
| Receiver | Works? |
|---|---|
| MPP Light Switch Script (V1.4.2 and later) | Yes, as is |
| MPP TransformByClickOrChat | Yes with Command Access Mode = 0 (Everyone) |
| MPP RandomObjectSpawner | Yes with ExternalEventsUseClickPermission Off, or ClickPermissionMode = Everyone (keep AllowExternalEventsWithoutAvatar On, its default) |
| MPP StreamSwitcher V1.4.7 | No: it requires an avatar |
| Your own scripts | Yes: SubscribeToScriptEvent("campfire_on", handler) |
For scripters. The payload is compatible with the MPP ActionButton interface and adds the hour of the scene clock:
public interface IScheduledEvent
{
string ActivatorAvatarUuid { get; } // always empty for a scheduled event
float InWorldHour { get; } // 0..24, the hour of the entry on the scene clock
}
SubscribeToScriptEvent("campfire_on", (ScriptEventData e) =>
{
// e.Data is null when another script posts the same name without a payload
var data = (e.Data != null) ? e.Data.AsInterface<IScheduledEvent>() : null;
LightTheFire();
});
10. Announcements
Lines of the Events/Announcements list are said in the nearby chat, to everybody.
when | message
Same when syntax as the actions. Delivered:
hourly | It is {time}.
morning | Have a good day!
night | Have a restful night.
With a 4-hour day, hourly speaks every 10 real minutes: delete that line for a quieter scene. To silence all the announcements, empty the list (or turn Events/Enable Off, which also stops the actions and the welcome message).
The message may contain variables:
| Variable | Example output | Meaning |
|---|---|---|
{time} | 2:00 PM | Hour of the entry on the scene clock, 12-hour format |
{time24} | 14:00 | Hour of the entry on the scene clock, 24-hour format |
{date} | July 21 | From Geo/Day Of Year |
{place} | Paris in France | Geo/Place Name (may be empty) |
{lat} | 48.9 N | Latitude |
{location} | Paris in France (latitude 48.9 N) or latitude 48.9 N | Place and latitude together |
{daylength} | 4 hours, 16 minutes, 1 hour 30 minutes | Real duration of a full day |
{sunrise} {sunset} | 6:10 AM, 9:44 PM | Computed for the current place and season, on the scene clock; -- during polar day or night |
More examples
Events/Announcements
sunrise | Good morning! The sun rises at {sunrise}.
sunset-1 | One hour of daylight left: sunset is at {sunset}.
12:00 | Noon in {place}. Lunch time!
noon | The sun is at its highest: it is {time}.
Good to know:
- Announcements are never replayed and are skipped during a sweep: clicking Noon does not flood the chat with hourly messages.
- On very short days, an
hourlyline that comes less than 4 seconds after the previous announcement is skipped, not delayed. Other lines (sunrise,12:00...) are said even then, up to 3 in the same half second. - In polar day,
sunset,eveningandnightlines stay silent; in polar night,sunrise,morninganddaylines do. This holds for the actions too, and formorning,day,eveningandnightonly whileTimeline/Auto From Geois On (manual period starts keep firing). - With a legal clock, a date or city change moves the clock: around that change, an
hourlyor fixed-hour line may be said twice or skipped once.
11. Welcome message
| Mode | Behavior |
|---|---|
| 0 | Off |
| 1 | Said once in the nearby chat, after the first visitor of the scene session arrives. Visitors who arrive later may not see it: mode 2 greets everybody |
| 2 (delivered) | Sent privately to each visitor on arrival |
Events/Welcome Delay (s) is counted from the visitor's arrival, not from the scene start, so the message is not lost while the scene is still loading. 10 seconds suits most scenes; raise it for heavy scenes.
Delivered text:
Welcome! Here it is {date}. Our position on the globe: {location}. A full day lasts {daylength} in this world.
which gives:
Welcome! Here it is July 21. Our position on the globe: Paris in France (latitude 48.9 N). A full day lasts 4 hours in this world.
Another example:
Welcome to the harbour! Local time is {time}, sunset at {sunset}. The lamps switch on by themselves at nightfall.
In the welcome message {time} is the current time on the scene clock.
12. Adding the script to your own objects
The script MPP - Day Night V2.4.0 comes with the set, in your inventory. You can add it to your own objects, for example a second cloud layer, your own sky dome, or a sun of your own: in Build mode, drag the script from your inventory onto the object, choose its module in the second drop-down of the new script block (MPPDayNightSky, MPPDayNightSun or MPPDayNightControl), then enter its values. A new module starts with the built-in defaults of the script (last point below), not with the values of the set.
- A layer that follows the sun (clouds, dome, stars, fog...): add the script to the object and choose the module MPPDayNightSky. Keep
General/Group=DayNight. For a layer that rotates, place the object at its midnight orientation and tick Movable from Script; for a still layer, setRotation/EnableOff. FillMaterials/Namesif the object has materials you do not want to drive; the materials must be scriptable. - One Sun and one Control per scene. They are already on MPP Sun. To use another light as the sun, add the Sun and Control modules to it, enter their values again, then delete the two scripts of MPP Sun. The light must point straight up from under the ground at midnight (with the standard pose, a rotation of
<90,0,0>), and the object needs Movable from Script. - If an object has both a RigidBody and Movable from Script, keep the RigidBody Motion Type = Keyframed: a Static rigid body blocks the rotation.
- A module added from your inventory starts with the built-in defaults of the script, which differ from the delivered set on a few points: copper evening light (255,99,41) and sky tint (255,140,107); sky fading Absorption 0.20 / 0.95 and Emissive 0.18 / 0.02;
Materials/Log NamesOn; and, on a new Control, day 80, Start Time 0, an empty Place Name, empty event lists,Chat/Cooldown1 andWelcome Mode1.
13. Recipes
A - Your city, today's season. In the Control: the values of your city from Appendix A, the day of the year from Appendix B, and your city's name in Geo/Place Name. That is the quick start of section 2.
B - Village with automatic lighting. Keep the delivered Actions A (sunset | mpp_lamp_all_on, sunrise | mpp_lamp_all_off) and put the MPP Light Switch Script (V1.5.1, Appendix C) on your lamps with External Events = On. Choose day 172 for long summer days.
C - Always-winter Nordic scene. In the Control: latitude 59.33, longitude 18.07, UTC offset 1, Clock Mode 2, day 355, place name Stockholm in Sweden. The sun rises late, stays low and sets early; lamps in list A follow these short days by themselves. For a polar night, use Tromso (Appendix A) and day 355.
D - Fixed hours whatever the season. Timeline/Auto From Geo = Off, then Manual starts 6, 8, 18, 20. morning, day, evening and night now mean 6:00, 8:00, 18:00 and 20:00 solar time all year; set Geo/Clock Mode = 0 if you want the clock to read these very hours.
E - Showroom demo. Keep the desk; set Buttons/Fast (minutes) to your liking and keep Chat/Cooldown = 4, so that a group of visitors cannot fight over the sun.
F - Solar clock. Geo/Clock Mode = 0: 12:00 is always the sun at its highest, noon reads 12:00 PM and every hour you type or read is on solar time.
G - Quick test of your schedule. Set the day length to 16 minutes, turn Debug/Verbose Logging On in the Control, visit, and open the script console: every sent event shows with its time on the scene clock, as events: 21:44 state #1 -> mpp_lamp_all_on.
H - A quiet scene. Delete the hourly announcement, set Events/Welcome Mode = 0, and turn Chat/Feedback Off.
14. Troubleshooting
| Symptom | Check |
|---|---|
| Nothing moves | Did you visit the scene? The scripts do not run in Build mode. The objects must keep Movable from Script |
| The sky turns in another direction than the sun, or the sun rises in the ground | MPP Sun, MPP Sky or MPP Clouds was rotated on its own. Put it back as delivered; turn only the whole set, around the vertical axis |
| The sky or the clouds do not follow | Same General/Group on every module? The log warns when no Sun is heard after 10 s |
| Materials do not fade | Materials must be scriptable. With Materials/Log Names On the log lists the found, driven and skipped names |
| Sunrise and sunset are one hour off | Check Geo/Clock Mode (summer time rule) and Geo/UTC Offset (the winter offset). Near a summer time switch the clock can be one hour off for up to 3 days (see section 15) |
| The sun is not at its highest at 12:00 | Normal with a legal clock: the sun culminates at solar noon (in Paris between 12:34 PM and 1:57 PM). noon and midnight follow the sun. Choose Clock Mode 0 for a solar clock |
| The welcome message names the wrong place | Change Geo/Place Name in the Control |
| The scene opens at night | Cycle/Start Time is an hour on the scene clock: 4.5 is 4:30 AM, dawn in July in Paris. Set for example 9 for a morning start |
| The day length went back to 4 hours | The Cycle speed button applies Buttons/Normal (minutes): set it to your day length in minutes |
| My place or my day changed by itself | A visitor clicked the City or Season button of the desk. Your settings come back when the scene restarts; delete these buttons to keep them |
| A button changed color but the sun did not move | You clicked during the 4-second cooldown ("please wait"). The button still moved to its next state: wait a few seconds, then click on until the scene matches the button (Cycle speed and Season: two more clicks) |
| "[DayNight] please wait" | The cooldown between two commands is running (Chat/Cooldown (s), 4 seconds, for everybody) |
| "Please wait 1 second before using this button again." | The button's own cooldown (0.8 s, shared by all visitors): the same button was clicked again too fast. Nothing happened: click again |
| "You are not allowed to use this button." | The button is set to Owner Only (or the visitor is not in its Access List) |
| Too many messages in the chat | Delete the hourly announcement (section 10) or set Events/Welcome Mode = 0 |
| Lamps do not react | Only for lamps with MPP LightSwitch: the event name must be exactly the one the lamp listens to (examples 1 and 1b: V1.3 and V1.4 use different names, and group names are lowercase). External events enabled on the lamp? Turn Debug/Verbose Logging On in the Control to see what is sent and when |
| A line of a list is ignored | The log says why: Events/Actions A entry #2 ignored: time 'sunst' not recognized |
| Lamps flip the wrong way after a restart | A toggle event sits in list A. Use on / off events |
| A bell rings at every scene start | It is in list A. Move it to list B |
| No welcome message | Events/Enable On? Mode 1 speaks once per scene session: rebuild or wait for the scene to restart. Raise the delay on heavy scenes |
| Light micro-flashes on the sun at very high frame rates | A Sansar client effect during the light fades: limit Max Foreground FPS to 60-72 in the client settings |
| Values changed after an update | Write your values down before updating a script. A value can come back at its default when a setting of the new version changed its form (for example, it became a slider). Enter it again |
15. Limits
- Each list holds 20 lines (Sansar limit). One line may carry several events, and
hourlycounts as one line. - Scheduled events carry no avatar: receivers that require one ignore them (see section 9).
- A moment placed exactly on the target of a time preset does not fire when that time is reached by a sweep.
- A DayNight command in Actions B (example 4) shares the 4-second visitor cooldown: if a visitor used a command just before, it is skipped without a message, and a visitor who clicks right after it gets "please wait".
- One DayNight set per scene: two Controls would both answer the same buttons and chat commands.
- The calendar has 365 days and no year: summer time starts and ends on fixed days (Europe: March 28 to October 28; North America: March 11 to November 4; Australia: October 4 to April 4). Near a switch, the clock can be one hour off for up to 3 days.
- Sunrise and sunset are within about 3 minutes of official ephemerides: the calendar has no year, refraction is the standard value, and relief and altitude are ignored.
- Near the polar circles, in the days around the start and end of polar day or polar night, the sun grazes the horizon and sunrise and sunset can be up to about 15 minutes off.
- The date does not advance by itself: the scene replays the same day until the Control or a visitor changes it.
Appendix A - 40 cities
Type these values in the Control, Geo group, and the city name in Geo/Place Name if you like. Geo/Use Geographic Model must be On.
| City | Latitude | Longitude | UTC Offset | Clock Mode |
|---|---|---|---|---|
| Europe | ||||
| Paris (France) | 48.86 | 2.35 | 1 | 2 |
| London (UK) | 51.51 | -0.13 | 0 | 2 |
| Madrid (Spain) | 40.42 | -3.70 | 1 | 2 |
| Rome (Italy) | 41.90 | 12.50 | 1 | 2 |
| Berlin (Germany) | 52.52 | 13.41 | 1 | 2 |
| Amsterdam (Netherlands) | 52.37 | 4.90 | 1 | 2 |
| Stockholm (Sweden) | 59.33 | 18.07 | 1 | 2 |
| Athens (Greece) | 37.98 | 23.73 | 2 | 2 |
| Istanbul (Turkey) | 41.01 | 28.98 | 3 | 1 |
| Moscow (Russia) | 55.76 | 37.62 | 3 | 1 |
| Reykjavik (Iceland) | 64.15 | -21.94 | 0 | 1 |
| Tromso (Norway) | 69.65 | 18.96 | 1 | 2 |
| Americas | ||||
| New York (USA) | 40.71 | -74.01 | -5 | 3 |
| Los Angeles (USA) | 34.05 | -118.24 | -8 | 3 |
| Chicago (USA) | 41.88 | -87.63 | -6 | 3 |
| Toronto (Canada) | 43.65 | -79.38 | -5 | 3 |
| Vancouver (Canada) | 49.28 | -123.12 | -7 | 1 |
| Anchorage (USA) | 61.22 | -149.90 | -9 | 3 |
| Honolulu (USA) | 21.31 | -157.86 | -10 | 1 |
| Mexico City (Mexico) | 19.43 | -99.13 | -6 | 1 |
| Bogota (Colombia) | 4.71 | -74.07 | -5 | 1 |
| Lima (Peru) | -12.05 | -77.04 | -5 | 1 |
| Rio de Janeiro (Brazil) | -22.91 | -43.17 | -3 | 1 |
| Buenos Aires (Argentina) | -34.60 | -58.38 | -3 | 1 |
| Africa and Middle East | ||||
| Dubai (UAE) | 25.20 | 55.27 | 4 | 1 |
| Lagos (Nigeria) | 6.52 | 3.38 | 1 | 1 |
| Nairobi (Kenya) | -1.29 | 36.82 | 3 | 1 |
| Johannesburg (South Africa) | -26.20 | 28.05 | 2 | 1 |
| Cape Town (South Africa) | -33.92 | 18.42 | 2 | 1 |
| Asia | ||||
| Tokyo (Japan) | 35.68 | 139.65 | 9 | 1 |
| Seoul (South Korea) | 37.57 | 126.98 | 9 | 1 |
| Beijing (China) | 39.90 | 116.41 | 8 | 1 |
| Shanghai (China) | 31.23 | 121.47 | 8 | 1 |
| Hong Kong (China) | 22.32 | 114.17 | 8 | 1 |
| Singapore | 1.35 | 103.82 | 8 | 1 |
| Bangkok (Thailand) | 13.76 | 100.50 | 7 | 1 |
| Mumbai (India) | 19.08 | 72.88 | 5.5 | 1 |
| Delhi (India) | 28.61 | 77.21 | 5.5 | 1 |
| Oceania | ||||
| Sydney (Australia) | -33.87 | 151.21 | 10 | 4 |
| Melbourne (Australia) | -37.81 | 144.96 | 10 | 4 |
Checked for the year 2027 against the official times (NOAA algorithm, real time zone rules): sunrise and sunset within 2 minutes, except on up to 3 days around each summer time switch (6 days a year at most), and for Tromso (see below).
- Vancouver: British Columbia keeps summer time all year from November 2026, hence UTC -7 without summer time (Clock Mode 1).
- Tromso: polar night from November 28 to January 14 (days 332 to 14), midnight sun from May 18 to July 25 (days 138 to 206). Near these dates sunrise and sunset can be up to about 15 minutes off.
- Southern hemisphere (Lima, Rio, Buenos Aires, Nairobi, Johannesburg, Cape Town, Sydney, Melbourne): the seasons are reversed, day 172 is their shortest day.
- Stockholm, Paris, Los Angeles and Sydney are also the four cities of the City button and of the chat commands (sections 3 and 8).
Appendix B - 20 dates
Type the day number in Geo/Day Of Year. The calendar has 365 days and no year.
| Date | Day | Day Of Year |
|---|---|---|
| New Year's Day | January 1 | 1 |
| Valentine's Day | February 14 | 45 |
| Chinese New Year (2026 date, moves every year) | February 17 | 48 |
| St Patrick's Day | March 17 | 76 |
| Spring equinox | March 20 | 79 |
| Easter (2026 date, moves every year) | April 5 | 95 |
| May Day | May 1 | 121 |
| Summer solstice, Fete de la Musique | June 21 | 172 |
| Midsummer (St John's Day) | June 24 | 175 |
| Independence Day (USA) | July 4 | 185 |
| Bastille Day (France) | July 14 | 195 |
| Autumn equinox | September 23 | 266 |
| Halloween | October 31 | 304 |
| Day of the Dead (Mexico) | November 2 | 306 |
| Thanksgiving (USA, 2026 date, moves every year) | November 26 | 330 |
| Festival of Lights (Lyon) | December 8 | 342 |
| Winter solstice | December 21 | 355 |
| Christmas Eve | December 24 | 358 |
| Christmas Day | December 25 | 359 |
| New Year's Eve | December 31 | 365 |
Easter, Chinese New Year and Thanksgiving move every year: the table gives their 2026 date. For another year, count the day number from January 1 (January 31 = 31, February 28 = 59, March 31 = 90, April 30 = 120, May 31 = 151, June 30 = 181, July 31 = 212, August 31 = 243, September 30 = 273, October 31 = 304, November 30 = 334).
Appendix C - Related MPP items
Other MPP creations on the Sansar Store that work with this set:
| Item | What it adds | Store page |
|---|---|---|
| Light Switch Script (V1.5.1) | Lamps and emissive materials switched on and off with smooth transitions, by click, chat or script events. Compatible as is with the scheduler: the delivered Actions A lines switch these lamps on at sunset and off at sunrise (section 9) | https://www.sansar.com/store/listings/7379d48c-2b6f-45f6-b6f1-205ce95aec1c/light-switch-script |
| Action Button Script (V1.7.0) | The script of the Commands Desk buttons: turn any object into a button or build your own control panel with the command texts of section 8. One to four commands per button, color and glow for each state, owner-only access with allowed or blocked avatars, and a private "please wait" notice | https://www.sansar.com/store/listings/3e1a3546-6c79-4527-bc1e-78d02648d19e/action-button-script |
| Commands Help On Chat Script (V1.3.8) | A visitor greeter and a help display for the nearby chat, triggered by a chat command or by a button: list your scene commands, /daynight ones included | https://www.sansar.com/store/listings/fea2df6b-21ce-48eb-94fc-4b7a7aad2777/commands-help-on-chat-script |
| Neutral Skybox - Seamless HDRI | A seamless 360-degree HDRI skybox with a soft neutral blue gradient and a clean horizon: a calm backdrop for the sky of your scene | https://www.sansar.com/store/listings/dbd41290-32e4-4255-adfa-fe35bcf2b521/neutral-skybox-seamless-hdri |
MPP - My Pretty Pixels. Day and Night Sky Cycle V2.4 (script MPP - Day Night V2.4.0).