Table of Contents

Note

This is a RLV enabled blindfold that uses environmental settings to dim the viewer lights when worn. It uses LID™ technology to sense the log-in, log-off, attach, detach and script restart in order to achieve that effect. This is similar to related work that emulates the psychedelic effects of drugs by using RLV environmental settings.

Usage

Just wear the blindfold to dim the lights or detach to restore the environment.

Exports

Code

blindfold.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
string wasKeyValueGet(string var, string kvp) {
    list dVars = llParseString2List(kvp, ["&"], []);
    do {
        list data = llParseString2List(llList2String(dVars, 0), ["="], []);
        string k = llList2String(data, 0);
        if(k != var) jump continue;
        return llList2String(data, 1);
@continue;
        dVars = llDeleteSubList(dVars, 0, 0);
    } while(llGetListLength(dVars));
    return "";
}
 
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
string wasKeyValueSet(string var, string val, string kvp) {
    list dVars = llParseString2List(kvp, ["&"], []);
    if(llGetListLength(dVars) == 0) return var + "=" + val;
    list result = [];
    do {
        list data = llParseString2List(llList2String(dVars, 0), ["="], []);
        string k = llList2String(data, 0);
        if(k == "") jump continue;
        if(k == var && val == "") jump continue;
        if(k == var) {
            result += k + "=" + val;
            val = "";
            jump continue;
        }
        string v = llList2String(data, 1);
        if(v == "") jump continue;
        result += k + "=" + v;
@continue;
        dVars = llDeleteSubList(dVars, 0, 0);
    } while(llGetListLength(dVars));
    if(val != "") result += var + "=" + val;
    return llDumpList2String(result, "&");
}
 
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
LID(key id) {
    if(id != NULL_KEY && llGetAttached() != 0) {
        llSetLinkPrimitiveParamsFast(2, [PRIM_DESC, wasKeyValueSet("login", (string)((integer)wasKeyValueGet("login", llList2String(llGetLinkPrimitiveParams(2, [PRIM_DESC]), 0))+1), llList2String(llGetLinkPrimitiveParams(2, [PRIM_DESC]), 0))]);
        llResetScript();
    }
    llSetLinkPrimitiveParamsFast(2, [PRIM_DESC, wasKeyValueSet("login", "-1", llList2String(llGetLinkPrimitiveParams(2, [PRIM_DESC]), 0))]);
    llOwnerSay("@setenv_daytime:-1=force");
}
 
default {
    state_entry() {
        // LID™ - http://grimore.org/fuss:lsl#log-in_detection_with_attachments
        // if LID™, then login = 1
        // else login = 0 - script running | parameter undefined
        if((integer)wasKeyValueGet("login", llList2String(llGetLinkPrimitiveParams(2, [PRIM_DESC]), 0)) > 0) {
            llSetLinkPrimitiveParamsFast(2, [PRIM_DESC, wasKeyValueSet("login", "0", llList2String(llGetLinkPrimitiveParams(2, [PRIM_DESC]), 0))]);
            llSetTimerEvent(25);
            return;
        }
        llSetLinkPrimitiveParamsFast(2, [PRIM_DESC, wasKeyValueSet("login", "0", llList2String(llGetLinkPrimitiveParams(2, [PRIM_DESC]), 0))]);
        state check;
    }
 
    timer() { state check; }
 
    // LID™ - http://grimore.org/fuss:lsl#log-in_detection_with_attachments
    attach(key id) { LID(id); }
 
    changed(integer change) {
        if(change & CHANGED_INVENTORY || change & CHANGED_REGION || change & CHANGED_OWNER) {
            llResetScript();
        }
    }
}
 
state check {
    state_entry() {
        llSetTimerEvent(5);
        integer _comChannel = 10+(integer)llFrand(10);
        llListen(_comChannel, "", llGetOwner(), "");
        llOwnerSay("@version=" + (string)_comChannel);
    }
 
    timer() {
        llSetTimerEvent(0);
        llOwnerSay("Your viewer is not RLV-enabled. This gizmo requires a RLV-enabled viewer. Cannot proceed.");
    }
 
    listen(integer channel, string name, key id, string message) {
        llSetTimerEvent(0);
        state blindfold;
    }
 
    changed(integer change) {
        if(change & CHANGED_INVENTORY || change & CHANGED_REGION || change & CHANGED_OWNER) {
            llResetScript();
        }
    }
 
    // LID™ - http://grimore.org/fuss:lsl#log-in_detection_with_attachments
    attach(key id) {
        LID(id);
    }
}
 
state blindfold {
    state_entry() {
        llOwnerSay("@setenv_ambienti:.1=force");
        llOwnerSay("@setenv_bluedensityi:.1=force");
        llOwnerSay("@setenv_bluehorizoni:.1=force");
        llOwnerSay("@setenv_cloudcolori:.1=force");
        llOwnerSay("@setenv_cloudcoverage:.1=force");
        llOwnerSay("@setenv_sunmooncolori:.1=force");
        llOwnerSay("@setenv_scenegamma:.3=force");
    }
    changed(integer change) {
        if(change & CHANGED_INVENTORY || change & CHANGED_REGION || change & CHANGED_OWNER) {
            llResetScript();
        }
    }
 
    // LID™ - http://grimore.org/fuss:lsl#log-in_detection_with_attachments
    attach(key id) {
        LID(id);
    }
 
}

secondlife/blindfold.txt · Last modified: 2023/09/27 09:54 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.