/* * presentation_seating * Part of the Sloodle project (www.sloodle.org) * * Copyright (c) 2011-06 contributors (see below) * Released under the GNU GPL v3 * ------------------------------------------- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * All scripts must maintain this copyright information, including the contributer information listed * * DESCRIPTION * This script should be placed in each chair, it listens to the SLOODLE_CHANNEL_OBJECT_DIALOG channel for set:color * * Contributors: * Paul Preibisch * Edmund Edgar */ string SLOODLE_EOF = "sloodleeof"; integer eof= FALSE; integer isconfigured=FALSE; integer SLOODLE_CHANNEL_OBJECT_DIALOG = -3857343; // an arbitrary channel the sloodle scripts will use to talk to each other. Doesn't atter what it is, as long as the same thing is set in the sloodle_slave script. vector color= <0,0,0>; integer sloodle_handle_command(string str) { list bits = llParseString2List(str,["|"],[]); integer numbits = llGetListLength(bits); string name = llList2String(bits,0); string value1 = ""; string value2 = ""; if (numbits > 1) value1 = llList2String(bits,1); if (numbits > 2) value2 = llList2String(bits,2); if (name == "set:color"){ color = (vector)value1; llSetColor(color,ALL_SIDES); } else if (name == SLOODLE_EOF) eof = TRUE; return (color != ZERO_VECTOR); } default { on_rez(integer start_param) { llResetScript(); } state_entry() { } link_message( integer sender_num, integer num, string str, key id) { // Check the channel if (num == SLOODLE_CHANNEL_OBJECT_DIALOG) { // Split the message into lines list lines = llParseString2List(str, ["\n"], []); integer numlines = llGetListLength(lines); integer i = 0; for (; i < numlines; i++) { isconfigured = sloodle_handle_command(llList2String(lines, i)); } // If we've got all our data AND reached the end of the configuration data, then move on if (eof == TRUE) { if (isconfigured == TRUE) { //sloodle_translation_request(SLOODLE_TRANSLATE_SAY, [0], "configurationreceived", [], null_key, ""); state ready; } } } } } state ready{ link_message( integer sender_num, integer num, string str, key id) { // Check the channel if (num == SLOODLE_CHANNEL_OBJECT_DIALOG) { // Split the message into lines list lines = llParseString2List(str, ["\n"], []); integer numlines = llGetListLength(lines); integer i = 0; for (; i < numlines; i++) { isconfigured = sloodle_handle_command(llList2String(lines, i)); } } } on_rez(integer start_param) { llResetScript(); } } // Please leave the following line intact to show where the script lives in Git: // SLOODLE LSL Script Git Location: mod/furniture-1.0/objects/default/assets/presentation_seating.lslp