// ===================================================================== // Region Info Board // skimi3d script library // https://grid.skimi3d.com/scripts/region-info-board // // A sign that says where you are, who else is here, and whether the // region is having a good day. // // Useful at a landing point, and more useful than it looks while you // are building: the time dilation line is the region telling you // honestly how hard it is working, and watching that number while you // add things teaches more than any guide. // // Plain LSL. // ===================================================================== // --------------------------------------------------------------------- // Settings // --------------------------------------------------------------------- // A line of your own above the rest. Empty for none. string TITLE = ""; // Which lines to show. integer SHOW_REGION = TRUE; // the name of the region integer SHOW_VISITORS = TRUE; // how many people are in it integer SHOW_TIME = TRUE; // the region's own clock integer SHOW_HEALTH = FALSE; // how hard the region is working // Seconds between refreshes. Ten is smooth and costs almost nothing; // below about two you are writing changes faster than anybody's viewer // is told about them. float REFRESH = 10.0; // Colour of the text. vector COLOUR = <1.0, 1.0, 1.0>; // --------------------------------------------------------------------- // Everything below here is the machinery // --------------------------------------------------------------------- string gLast = ""; // How hard the region is working, in words rather than a number. // // Time dilation is the share of a second the region actually managed to // get through. 1.0 is a region keeping up; 0.5 means everything in it is // happening at half speed. string health() { float d = llGetRegionTimeDilation(); if (d > 0.95) return "running easily"; if (d > 0.85) return "busy"; if (d > 0.70) return "working hard"; return "struggling"; } string build() { list lines = []; if (TITLE != "") lines += [TITLE]; if (SHOW_REGION) lines += [llGetRegionName()]; if (SHOW_VISITORS) { integer n = llGetListLength(llGetAgentList(AGENT_LIST_REGION, [])); if (n == 1) lines += ["1 person here"]; if (n != 1) lines += [(string)n + " people here"]; } if (SHOW_TIME) { // The region's own clock, in whole minutes. Seconds would make // the sign rewrite itself for ever and tell nobody anything. integer secs = (integer)llGetWallclock(); integer h = secs / 3600; integer m = (secs % 3600) / 60; string hh = (string)h; if (h < 10) hh = "0" + hh; string mm = (string)m; if (m < 10) mm = "0" + mm; lines += [hh + ":" + mm]; } if (SHOW_HEALTH) lines += [health()]; return llDumpList2String(lines, "\n"); } show() { string now = build(); // Only write when the words have actually changed. // // At ten seconds this saves five writes in six, because the clock // only moves once a minute and the visitor count hardly at all. // Every avoided write is a message about this object that never has // to go out to everybody nearby. if (now == gLast) return; llSetText(now, COLOUR, 1.0); gLast = now; } default { state_entry() { gLast = ""; show(); llSetTimerEvent(REFRESH); } timer() { show(); } touch_start(integer total) { // A touch is a request for the current state, which costs // nothing and saves waiting for the next refresh. show(); } on_rez(integer start) { llResetScript(); } }