Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Adjustable Constants
- integer CommandChannel = 594923831; //Randomly Chosen Channel Number. Must Match for all controllers. Change for different sets controls and responders.
- float OffDelay = 3;
- //variables
- key Owner;
- integer ListenHandle;
- //Functions
- LightsOn() {
- llSetLinkPrimitiveParamsFast( LINK_THIS, [
- PRIM_POINT_LIGHT, TRUE, <1.0, 1.0, 0.9>, 1.0, 10, 0.75,
- PRIM_GLOW, ALL_SIDES, 0.2
- ] );
- } // end LightsOn
- LightsOff() { //Make it a nightlight instead of fully off.
- llSetLinkPrimitiveParamsFast( LINK_THIS, [
- PRIM_POINT_LIGHT, TRUE, <1.0, 1.0, 0.9>, 0.1, 3, 0.75,
- PRIM_GLOW, ALL_SIDES, 0.02
- ] );
- } // end LightsOn
- //States
- default {
- state_entry() {
- Owner = llGetOwner();
- ListenHandle = llListen( CommandChannel, "", NULL_KEY, "On");
- LightsOff();
- }
- on_rez( integer param ) { llResetScript(); }
- listen( integer channel, string name, key id, string message) {
- //Ignore messages from objects with different owners.
- if( llList2Key( llGetObjectDetails(id, [OBJECT_OWNER] ), 0 ) != Owner ) return;
- if( message == "On" ) {
- llListenRemove( ListenHandle ); //Only listen for the currently relevant command.
- ListenHandle = llListen( CommandChannel, "", NULL_KEY, "Off");
- LightsOn();
- } else if( message == "Off" ) {
- llListenRemove( ListenHandle ); //Only listen for the currently relevant command.
- ListenHandle = llListen( CommandChannel, "", NULL_KEY, "On");
- llSleep( OffDelay );
- LightsOff();
- } //else ignore unknown messages.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment