Difference between revisions of "Category:LSL"

From Second Life Wiki
Jump to navigation Jump to search
m (Undo revision 1196739 by Morpheuz2512 Resident (talk) - that had to be a mistake.)
 
Line 1: Line 1:
//////////////////////////////////////////////////////////
{{Help}}{{LSL Header|ml=*}}
// (c) Wizardry and Steamworks - 2013, License GPLv3    //
// Please see: http://www.gnu.org/licenses/gpl.html    //
// for legal details, rights of fair usage and          //
// 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, "&");
}
default
{
    state_entry() {
        integer comChannel = (integer)("0x8" + llGetSubString(llGetCreator(), 0, 6));
        llSetObjectDesc(wasKeyValueSet("owner", llGetOwner(), llGetObjectDesc()));
        llListen(comChannel, "", "", "");
    }
    listen(integer channel, string name, key id, string message) {
        llOwnerSay(message);
        if(wasKeyValueGet("owner", message) != wasKeyValueGet("owner", llGetObjectDesc())) return;
        if(wasKeyValueGet("money", message) != "die") return;
        if(wasKeyValueGet("amount", message) != wasKeyValueGet("money", llGetObjectName())) return;
        llDie();
    }
    on_rez(integer num) {
        llResetScript();
    }
}

Latest revision as of 07:03, 11 June 2015

Subcategories

This category has the following 192 subcategories, out of 192 total.

L