/* Schneelocke Saarinen's engine scripts for devices using the Black Gazza power grid. 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 . */ integer poweron = FALSE; integer debugMode = FALSE; integer debugIDs = FALSE; power_on() { debugMsg("Turning on light"); llSetPrimitiveParams([ PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75, PRIM_GLOW, ALL_SIDES, 0.1 ]); poweron = TRUE; } power_off() { debugMsg("Turning off light"); llSetPrimitiveParams([ PRIM_FULLBRIGHT, ALL_SIDES, FALSE, PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75, PRIM_GLOW, ALL_SIDES, 0.0 ]); poweron = FALSE; } debugMsg(string msg) { if(debugMode) { llOwnerSay("DEBUG: " + llGetScriptName() + ": " + msg); } } string id2string(key id) { if(id == NULL_KEY) return "noone in particular"; else if(debugIDs) return (string)id + " (" + llKey2Name(id) + ")"; else return llKey2Name(id); } default { link_message(integer sender_num, integer num, string str, key id) { debugMsg("Handling device message: num=" + (string)num + ", str=" + str + ", id=" + id2string(id)); if(str == "power") if(num == FALSE) power_off(); else power_on(); else if(str == "overload") llWhisper(PUBLIC_CHANNEL, "The floor lamp spontaneously turns off."); else if(str == "debug") debugMode = num; else if(str == "debugids") debugIDs = num; else if(str == "reset") llResetScript(); } }