User:Katharine Berry/Scripts/Rotating Online Status
Pandorabot | Rotating Online Status | SPD Viewer | Brainfsck Interpreter | Force Reload
About
This is script to set up an object to show a rotating online status script. This example is set up for the Building and Planning department.
Usage
Just set the constants above the line as you wish (I'd leave them all except AGENTS, myself), and stick it in a prim. The bits that you'll want to edit are self-explanatory.
Script
// Rotating Online Status v1.0. // Copyright (c) 2007, Katharine Schomer // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of Katharine Schomer nor the names of any contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY KATHARINE SCHOMER ``AS IS'' AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL KATHARINE SCHOMER BE LIABLE FOR ANY // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Note that this script assumes at least one agent. list AGENTS = [ // "agent-key" , "texture name/UUID of person", "6bd00d47-0ec2-4244-be8e-de9cc883e6f8", "00000000-0000-0000-0000-000000000001", // Achilles Schomer "aac5349e-1d1e-4269-96dd-5920770bff78", "00000000-0000-0000-0000-000000000002", // Explo Schomer "46e5fe4f-6572-4f8f-ba1e-ed32a73f6d6e", "00000000-0000-0000-0000-000000000003" // Marsbar9 Schomer ]; float DISPLAY_TIME = 10.0; // Time to show each person, in seconds (approx). integer DISPLAY_OFFLINE = FALSE; // Whether offline agents should be included in the rotation. float DEFAULT_ALPHA = 0.7; // Opaqueness. (0.7 = 30% transparency) vector DEFAULT_COLOUR = <1.0, 1.0, 1.0>; // The colour shown when nobody is online, if DISPLAY_OFFLINE = FALSE. vector ONLINE_TINT = <1.0, 1.0, 1.0>; // Colour texture is tinted if they're online. (Should probably be white) vector OFFLINE_TINT = <1.0, 0.6, 0.6>; // Colour texture is tinted if they're offline - only used if DISPLAY_OFFLINE is TRUE. // You don't want to edit anything below this line. // ------------------------------------------------- integer TEXTURE_DISPLAY_FACE = 0; key BLANK_TEXTURE = "5748decc-f629-461c-9a36-a35a221fe21f"; integer AGENTS_STRIDE = 2; integer gCurrentAgent = 0; integer gShownThisRotation = 0; ShowDefault() { llSetTexture(BLANK_TEXTURE,TEXTURE_DISPLAY_FACE); llSetAlpha(DEFAULT_ALPHA,TEXTURE_DISPLAY_FACE); llSetColor(DEFAULT_COLOUR,TEXTURE_DISPLAY_FACE); } NextAgent() { if(++gCurrentAgent >= llGetListLength(AGENTS) / AGENTS_STRIDE) { gCurrentAgent = 0; if(!gShownThisRotation) { ShowDefault(); llSleep(DISPLAY_TIME); } gShownThisRotation = 0; } llRequestAgentData(llList2Key(AGENTS,gCurrentAgent * AGENTS_STRIDE),DATA_ONLINE); } default { state_entry() { ShowDefault(); NextAgent(); } timer() { llSetTimerEvent(0); NextAgent(); } dataserver(key qid, string data) { integer online = (integer)data; if(online || DISPLAY_OFFLINE) { ++gShownThisRotation; llSetAlpha(1.0, TEXTURE_DISPLAY_FACE); if(online) { llSetColor(ONLINE_TINT, TEXTURE_DISPLAY_FACE); } else { llSetColor(OFFLINE_TINT, TEXTURE_DISPLAY_FACE); } llSetTexture(llList2String(AGENTS,(gCurrentAgent * AGENTS_STRIDE) + 1), TEXTURE_DISPLAY_FACE); llSetTimerEvent(DISPLAY_TIME); } else { NextAgent(); } } }