Table of Contents

Shortnote

The anklet uses essentially recyles the code used for the carbon/scholarly glasses by extracting the monogramming code and the resizer.

Exports

Code

anklet.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    //
///////////////////////////////////////////////////////////////////////////
integer wasMenuIndex = 0;
list wasDialogMenu(list input, list actions, string direction) {
    integer cut = 11-wasListCountExclude(actions, [""]);
    if(direction == ">" &&  (wasMenuIndex+1)*cut+wasMenuIndex+1 < llGetListLength(input)) {
        ++wasMenuIndex;
        jump slice;
    }
    if(direction == "<" && wasMenuIndex-1 >= 0) {
        --wasMenuIndex;
        jump slice;
    }
@slice;
    integer multiple = wasMenuIndex*cut;
    input = llList2List(input, multiple+wasMenuIndex, multiple+cut+wasMenuIndex);
    input = wasListMerge(input, actions, "");
    return input;
}
 
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
integer wasListCountExclude(list input, list exclude) {
    if(llGetListLength(input) == 0) return 0;
    if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) 
        return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
    return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
}
 
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
list wasListMerge(list l, list m, string merge) {
    if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return [];
    string a = llList2String(m, 0);
    if(a != merge) return [ a ] + wasListMerge(l, llDeleteSubList(m, 0, 0), merge);
    return [ llList2String(l, 0) ] + wasListMerge(llDeleteSubList(l, 0, 0), llDeleteSubList(m, 0, 0), merge);
}
 
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
vector wasPercentToGradient(float percent, string rgb) {
    if(llStringLength(rgb) != 2) {
        llSay(DEBUG_CHANNEL, "Assert failed, rgb parameter must consist of a pair of either r, g, or b.");
        return ZERO_VECTOR;
    }
    string a = llGetSubString(rgb, 0, 0);
    string b = llGetSubString(rgb, 1, 1);
    list col = [ "r", "g", "b" ];
    integer ax = llListFindList(col, (list)a);
    integer bx = llListFindList(col, (list)b);
    if(ax == -1 || bx == -1) {
        llSay(DEBUG_CHANNEL, "Asset failed, rgb parameters must contain either r, g, or b letters.");
        return ZERO_VECTOR;
    }
    col = llListReplaceList(col, (list)((100-percent)/100), ax, ax);
    col = llListReplaceList(col, (list)(percent/100), bx, bx);
    return 2*<llList2Float(col, 0), llList2Float(col, 1), llList2Float(col, 2)>;
}
 
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
string wasProgress(integer percent, integer length, list symbols) {
    percent /= (integer)((float)100.0/(length));
    string p = llList2String(symbols,0);
    integer itra = 0;
    do {
        if(itra>percent-1) p += llList2String(symbols,2);
        else p += llList2String(symbols,1);
    } while(++itra<length);
    return p + llList2String(symbols,3);
}
 
key toucher = NULL_KEY;
integer channel = 0;
integer i = 0;
list monogram = [];
 
default {
    state_entry() {
        channel = (integer)("0x8" + llGetSubString(llGetKey(), 0, 6));
        if(toucher == NULL_KEY) return;
        llListen(channel, "", toucher, "");
        llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", ["✖ Commit", "⎙ Size", "⎙ Stamp"], channel);
    }
    touch_start(integer num) {
        if(llDetectedKey(0) != llGetOwner()) return;
        toucher = llDetectedKey(0);
        llListen(channel, "", toucher, "");
        llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", ["✖ Commit", "⎙ Size", "⎙ Stamp"], channel);
    }
    listen(integer channel, string name, key toucher, string message) {
        if(message == "✖ Commit") {
            llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0\n\nThis option will delete the script and make your configuration permanent. This is meant to keep your script consumption down and to please those that believe that scripts are the principal source of lag. After pressing the DELETE button below, this script will delete itself and you will not be able to reconfigure your anklet.", ["DELETE", "CANCEL"], channel);
            return;
        }
        if(message == "CANCEL") state stub;
        if(message == "⎙ Size") state size;
        if(message == "⎙ Stamp") state read_monogram;
        if(message == "DELETE") {
            llRemoveInventory("Monogram");
            llRemoveInventory(llGetScriptName());
        }
    }
    on_rez(integer num) {
        llResetScript();
    }
}
 
state stub {
    state_entry() {
        state default;
    }
}
 
 
state size {
    state_entry() {
        llListen(channel, "", toucher, "");
        llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", ["-.01", "-.02", "-.05", "+.01", "+.02", "+.05", "⏏ Exit"], channel);
    }
    touch_start(integer num) {
        if(llDetectedKey(0) != llGetOwner()) return;
        llListen(channel, "", toucher, "");
        llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", ["-.01", "-.02", "-.05", "+.01", "+.02", "+.05", "⏏ Exit"], channel);
    }
    listen(integer channel, string name, key toucher, string message) {
        if(message == "⏏ Exit") state default;
        if((float)message == 0) return;
        float scale = 1 + (float)message;
        integer i = llGetNumberOfPrims();
        do {
            vector linkScale = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_SIZE]), 0);
            vector linkPos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0);
            llSetLinkPrimitiveParamsFast(i, [PRIM_SIZE, scale * linkScale, PRIM_POSITION, scale * linkPos]);
        } while(--i>1);
        llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", ["-.01", "-.02", "-.05", "+.01", "+.02", "+.05", "⏏ Exit"], channel);
    }
    on_rez(integer num) {
        llResetScript();
    }
}
 
state read_monogram {
    state_entry() {
        i = llGetInventoryNumber(INVENTORY_NOTECARD)-1;
        do {
            if(llGetInventoryName(INVENTORY_NOTECARD, i) == "Monogram")
            jump found_notecard;
        } while(--i>-1);
        llSay(DEBUG_CHANNEL, "Failed to find Monogram notecard.");
        return;
@found_notecard;
        i = 0;
        llGetNotecardLine("Monogram", i);
    }
    dataserver(key id, string data) {
        if(data == EOF) {
            llSetText("", <0,0,0>, .0);
            state monogram_menu;
        }
        if(data != "") monogram += data;
        integer percent = 100 * i/26;
        llSetText("Please wait, loading menu...\n" + wasProgress(percent, 10, ["[", "█", "░", "]"]) + "\n Memory: " + (string)llGetFreeMemory(), wasPercentToGradient(percent, "rg"), 1);
        llGetNotecardLine("Monogram", ++i);
    }
    on_rez(integer num) {
        llResetScript();
    }
}
 
state monogram_menu {
    state_entry() {
        wasMenuIndex = 0;
        llListen(channel, "", toucher, "");
        llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", wasDialogMenu(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], ["⏏ Exit", "⟻ Back", "Next ⟼"], ""), channel);
    }
    touch_start(integer num) {
        if(llDetectedKey(0) != llGetOwner()) return;
        llListen(channel, "", toucher, "");
        llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", wasDialogMenu(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], ["⏏ Exit", "⟻ Back", "Next ⟼"], ""), channel);
    }
    listen(integer channel, string name, key toucher, string message) {
        if(message == "⏏ Exit") {
            monogram = [];
            state default;
        }
        if(message == "⟻ Back") {
            llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", wasDialogMenu(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], ["⏏ Exit", "⟻ Back", "Next ⟼"], "<"), channel);
            return;
        }
        if(message == "Next ⟼") {
            llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", wasDialogMenu(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], ["⏏ Exit", "⟻ Back", "Next ⟼"], ">"), channel);
            return;
        }
        i = llGetListLength(monogram)-1;
        do {
            list m = llParseString2List(llList2String(monogram, i), ["="], []);
            if(message == llList2String(m, 0)) {
                llSetLinkPrimitiveParamsFast(8, [PRIM_TYPE, PRIM_TYPE_SCULPT, llList2String(m, 1), PRIM_SCULPT_TYPE_SPHERE]);
                llDialog(toucher, "\n            Welcome to the Delicate Initial Anklet.\nCreated in 2013 by Wizardry and Steamworks\n                 10 Jun 2013: Version: 1.0", wasDialogMenu(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], ["⏏ Exit", "⟻ Back", "Next ⟼"], ""), channel);
                return;
            }
        } while(--i>-1);
    }
    on_rez(integer num) {
        llResetScript();
    }
}

secondlife/delicate_initial_anklet.txt · Last modified: 2022/11/24 07:46 by 127.0.0.1

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.