Proudly built and coded in Irukandji, the new TimeGen4 is the latest iteration of the IruMoto Time Generator, a very cool piece of kit that promises to make your virtual world region come alive with activity, colour, and movement.
Purpose and functionality
Powerful and versatile, TimeGen4 divides each day on your region into 48 half-hour segments (in-world time). On a typical Open Simulator region, where six in-world days occur every real-world day, that’s nearly 300 time segments each calendar day.
Now your region can really come alive throughout the day and night, e.g. street lights coming on, clock tower chiming, bonfires, club lights, NPCs coming online etc. Basically any script that would otherwise do something in response to a touch or listen event will work perfectly with TimeGen4.
What this means in real terms is that your region can always have something happening, even if you aren’t there to make it happen. Set and forget, and let TimeGen4 entertain your visitors automatically.
TimeGen4 comes with some common pre-configured scripts that you can use straight out of the box (with the tiniest bit of editing) or as a foundation for new scripts we haven’t even thought of yet.
Also new to TimeGen4 is the ability to communicate with IruMoto NPC Engines, allowing you to keep your region clean of rogue avatars and unnecessary scripted objects.
The IruMoto Time Generator is suitable for use in virtual worlds running Open Simulator 9.1 and later. It will also work in Second Life, however I have not placed any on that grid as at time of writing.
A single script powers the Time Generator. Its user-changeable variables are managed via the supporting timeGen4Config notecard.
Receiving scripts, e.g. the script in a lighthouse beam, will also contain a script to listen for updates from the Time Generator, either directly or through a conduit script. More details below.
Component parts of the IruMoto Time Generator are:
- .[timeGen4.2] script
- .timeGen4Config notecard
Four other scripts control the digital time display on the TimeGen4 wall panel but these form part of the main unit and don’t need to be touched.
External support scripts:
There are four types of script that the Time Generator communicates with:
- Remote Object (RO) scripts. RO scripts would usually go in a single prim object, or the root of a specialised moving object such as a boat circling an island.
- Conduit scripts. A conduit script is similar to an RO script, however it is usually stationary, e.g. the root prims of a house or shop. The main purpose of a conduit script is to communicate to all of the child prims in its linkset.
- The conduit script also requires the same .timeGen4Config notecard that is used by TimeGen4.
- Linked Object (or LO) scripts are the most common receiver scripts, and generally where all of the visual wizardry takes place, e.g. the fire or light or waterfall. Unlike the other two types, LO scripts do not listen to the TimeGen4. Instead they wait for the RO or Conduit script to tell them what to do. This greatly reduces the amount of listens required on your region, and thus reduces lag.
In your pack, you would have noticed a TimeGen4 HUD. It looks like a cutdown version of the Time Generator but it isn’t. Its purpose is so you can always see what time it is on your region, which is especially helpful when you are scripting objects to activate at a certain time of the day.
You win ten points if you just worked out the HUD contains an RO script, a config notecard, and four LO scripts for the digital display.
Also, TimeGen4 has a new feature that pings IruMoto NPC Engines, where the ‘tgChan’ variable of an NPC matches the region channel of your Time Generator. Note that this feature is intended to find engines, not NPCs, thus making it very helpful to locate missing invisible control units when NPCs can’t/won’t come online.
Interconnectivity is automatic since [.npcExist500.1z].
Quirks & Formats
Time is NOT regular in Open Simulator or Second Life, meaning that not every day is the same length. Additionally, day and night duration fluctuate with the seasons.
For this reason, TimeGen4 is the first version that I have made available to the public. It has been under development for over seven years, and each time that I thought I had ironed out all the bugs, a day would grow longer or shorter and skip one or even several time segments.
On a region level, the impact of this meant that something that was due to happen at say 5.30 pm would not happen that day, e.g. the street lights would not turn on and the region would stay in darkness all night, etc etc.
Not to be discouraged, I kept tweaking the maths. Many, many, many, many times.
It is December 2021 as I write this, and TimeGen4 has been running for six months now without missing a single time segment. I’m not going to say that the Time Generator will never miss a time segment in the future, but if it skips one every fifty thousand, I can live with that.
A few OS purists have asked why I am still using llGetSunDirection as the core method for determining sun position, and the reason is simple. It works. Once the new OSSL functions like osGetCurrentSunHour etc have passed the same scrutiny as my previous tests AND once the vast majority of grids are running version 9.2 or later, then I will consider re-jigging the code from LSL to OSSL.
Re file names, the naming convention might look odd but there is logic behind it.
- All IruMoto scripts start with a period then a brace;
- All notecards start with a period but no brace;
- All animations start with a period then capital X.
This convention carries across every product I make, and is for the sake of order in my Contents windows. Scripts are always at the top, followed by notecards, followed by animations. It keeps things neat and simple.
Before we set up your TimeGen4, you need to understand how it works.
- TimeGen4 asks the time at regular intervals. If the time is unchanged, it does nothing. If the time has changed, it sends an 8-letter message to the entire region on a dedicated channel. The message will be “Time0000”, where 0000 is 24 hour time, broken up into half hour increments on the exact hour or half hour. For example, it would broadcast Time0130 at 1.30 am and then the next broadcast will be Time0200 at 2.00 am. Bear in mind that these are in-world times, and half an hour in-world is only 2 to 10 minutes in real time. Times range from 0000 representing midnight to 2330 for 11.30 pm. The four digits must always be preceded by the word “Time” with a capital T and no spaces. Note: For testing purposes, you can type the following into your chat bar: “/-505050 Time1800”, assuming that -505050 is your channel, to mimic your TimeGen4 broadcasting the time as 6 pm.
- Meanwhile across your region, conduit scripts are listening for these broadcasts. Located in the fixed root prim of your chosen object, the conduit script then re-transmits that time update to each child prim in its linkset.
- Just like conduit scripts, remote-object (RO) scripts are also listening directly to your TimeGen4, and again just the same, they re-transmit the time update to any child prims in the linkset. Where they differ, is that the RO script will also act out itself. It may for example be the rotating prim of a lighthouse beam, where its spin function starts and stops at a certain time, as does the glow of a linked light beam
- That linked light beam contains an LO script. It is the LO script, which has been waiting for that re-transmitted message via the RO script – or indeed from a conduit script – that turns on the actual light.
In you pack, you will see two objects; the TimeGen4 and the TimeGen4 HUD.
TimeGen4 is meant to be visibly reminiscent of a Tesla battery or similar, so rez it on a wall or somewhere vertical. Only rez one unit per region.
Right-click the HUD and choose ‘Wear’. It will appear in the top left corner of your screen. If you want to mount it somewhere else on the screen, that’s fine. The digital display should change to 0000. When the time generator updates next, the time on your HUD will change to your region’s current time.
Both the main unit and your HUD required a copy of the .timeGen4Config notecard. Make sure the details for each are identical or as listed below.
In edit mode, click on the Content tab and open the .timeGen4Config notecard.
Follow the instructions precisely. Everything you enter in the notecard is changeable in the future so don’t over-think it.
- #COMMS CHANNEL: Give your TimeGen4 a unique communications channel. Make it a large negative number that isn’t used for anything else on your region. If you are also using IruMoto NPC Engines, this same comms channel will need to be entered in their .npc500Config notecards as well, under the #TIMEGEN CHANNEL heading.
- #HOVERTEXT: Leave off unless you are stripping the script and card from the shell provided and building your own. This is the only reason I’ve left this option in the notecard as the digital display looks heaps better than hovertext.
- #TIME OFFSET: Leave this for now because you have no way of knowing if it’s an issue or not yet. This feature allows you to adjust the time zone to match your region. The default value I’ve set is 4.0 which reflects my own situation, not yours. For me, living right on top of the Tropic of Capricorn in east coast Australia, I wanted last light to be around 7.30 pm, but my region wanted to give me last light at 3.30 pm, so I added 4. Tweak it as you see fit, but remember the number must be positive with one decimal place. No negatives allowed for this variable or your TimeGen4 will break.
- #METHOD: Don’t touch. This is just a bit of future-proofing, and also if I ever decide to have separate versions for Second Life and Open Sim.
- #CHAT: If you have this turned on, whenever the time changes, generally every few minutes, the Time Generator will say the time for anyone nearby to hear. It is really annoying, so it is off by default. However, I do recommend turning it on for your HUD while you set things up as it can be a handy tool when you’re trying to work out what time of day things are happening, e.g. what time do you turn the lights on? Match it up with the chat from your HUD – Nice and simple.
- #PING: yes by default. If you don’t run IruMoto NPC Engines, ignore it. Feel free to turn it off if you want. Will be hard-coded to yes in a future update.
Once the above is done, still in the Content tab of the edit window, click the Reset Scripts button. TimeGen4 will determine the current time and your digital display will change. Remember, you need to update the config card for both the main unit and the HUD, and then reset both. The HUD’s digital display might not update for several minutes until it receives its first sync from the main unit.
Conduit scripts also rely on a .timeGen4Config notecard, so you will need to drop this into your object and update the channel number to match your TimeGen4. This is the only line of information used by this script at this stage, so the other lines don’t matter. Once done, drop in the conduit script and you’re ready to go.
RO (remote object) scripts
Like conduits, RO scripts listen directly to the Time Generator, however their use is very specific and less versatile than a conduit. As such, the scripts are full perm and do not rely on a config notecard. Instead, you enter the channel number directly into the integer chan variable in the script header.
LO (linked object) scripts
Linked object scripts are where the action happens, e.g. a light turns on. They do not need to reference the channel number as they only listen to a conduit script or RO script. All these little guys want to know is what time the action kicks off and when it ends. To make things even more exciting, they are full perms so you get to edit the scripts directly and see how it all works!
Inside each LO script are two main variables; one will be startEvent and the other endEvent or similar terminology. The values that startEvent and endEvent are looking for is the time.
Remember the time format we discussed earlier? “Time1800” etc? You need to enter a value in this exact format into both the startEvent and endEvent values. If you’re unsure of what I mean about the format, look in the chat from your HUD. You will see the exact message that your TimeGen4 is transmitting to the region with every update.
Q. How many TimeGens should I install on my region?
A. You only need one TimeGen per region regardless of whether it’s a standard region or huge var-region.
Q. I have many regions. Can I use the same channel for all my regions?
A. Yes. Just remember that you will need to install one time generator per region as it will not (theoretically) transmit across sim boundaries.
Q. Which communication method is best?
A. Conduit scripts do all the heavy lifting, and since there is only one conduit in every linkset instead of dozens of listener scripts, it is a very economical way to communicate. This ability is the fundamental strength of TimeGen4. RO scripts exist to fill the gap when conduits can’t do the task. RO scripts are ideal where an object moves around or it is not part of a greater linkset. Just remember that one RO script, given its small scope of ability, uses the same amount of resources as a conduit script but delivers a lot less.
Q. How do tenants on my region plug into the time generator?
A. Give them copies of the RO, LO and Conduit scripts to use in their own devices. These scripts are full perm, so anyone can use them and tweak them to suit their needs.
Q. My tenant has their own TimeGen and wants to use it. Will this cause problems?
A. No, so long as they use a different comms channel. That said, there really is no point having two units on one region. They might as well plug into yours instead.
I’ll make a YouTube version of this shortly and hopefully that will double up as a bit of a forum. You can also post any questions down below.
Have a brilliant day,
Xay Tomsen/AndrewT 2020
Andrew has created, nurtured, and destroyed many glittering kingdoms, but nowadays just tinkers with code, occasionally yelling like a madman at his scruffy NPC minions.
Leave a Reply