About

The script uses hologram particles in order to display a square coloured by a choice of colours from the pretty menu system. To use the script, drop the script in a box and save it. If you are not on Second Life, you may need to change the script to set the square particle which can be downloaded on this page. The script is inspired after Aztroboy Resident's similar script but without the need to move the box to see the particles.

Screenshot

Square Box Display

Code

color_display.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2014 - 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);
}
 
list colors = ["black", < 0, 0, 0 >, "white", < 1, 1, 1 >, "gray", < 0.5, 0.5, 0.5 >, "silver", < 0.75, 0.75, 0.75 >, "darkgray", < 0.4, 0.4, 0.4 >,
               "lightgrey", < 0.83, 0.83, 0.83 >, "red", < 1, 0, 0 >, "darkred", < 0.55, 0, 0 >, "crimson", < 0.86, 0.08, 0.24 >, "indianred", < 0.8, 0.36, 0.36 >,
               "orangered", < 1, 0.27, 0 >, "hotpink", < 1, 0.41, 0.71 >, "pink", < 1, 0.75, 0.8 >, "lightpink", < 1, 0.71, 0.76 >, "deeppink", < 1, 0.08, 0.58 >,
               "fuchsia", < 1, 0, 1 >, "orchid", < 0.85, 0.44, 0.84 >, "plum", < 0.87, 0.63, 0.87 >, "violet", < 0.8, 0.51, 0.8 >, "indigo", < 0.29, 0, 0.51 >, "lavender", < 0.7, 0.7, 1 >, "magenta", < 1, 0, 1 >,
               "purple", < 0.5, 0, 0.5 >, "darkmagenta", < 0.55, 0, 0.55 >, "darkviolet", < 0.58, 0, 0.83 >, "blueviolet", < 0.54, 0.17, 0.89 >, "darkblue", < 0, 0, 0.55 >, "blue", < 0, 0, 1 >, "deepskyblue", < 0, 0.75, 1 >, "mediumblue", < 0, 0, 0.8 >,
               "midnightblue", < 0.1, 0.1, 0.44 >, "royalblue", < 0.25, 0.41, 0.88 >, "slateblue", < 0.42, 0.35, 0.8 >, "steelblue", < 0.27, 0.51, 0.71 >, "teal", < 0, 0.5, 0.5 >, "turquoise", < 0.25, 0.88, 0.82 >, "darkcyan", < 0, 0.55, 0.55 >, "lightblue", < 0.68, 0.85, 0.9 >,
               "aquamarine", < 0.5, 1, 0.83 >, "azure", < 0.8, 1, 1 >, "cyan", < 0, 1, 0.9 >, "skyblue", < 0.53, 0.81, 0.92 >, "yellow", < 1, 1, 0 >, "gold", < 1, 0.84, 0 >, "lightyellow", < 1, 1, 0.88 >, "goldenrod", < 0.85, 0.65, 0.13 >,
               "yellowgreen", < 0.6, 0.8, 0.2 >, "darkgreen", < 0, 0.39, 0 >, "green", < 0, 0.5, 0 >, "forestgreen", < 0.13, 0.55, 0.13 >, "lawngreen", < 0.49, 0.99, 0 >,
               "springgreen", < 0, 1, 0.5 >, "lightgreen", < 0.56, 0.93, 0.56 >, "chartreuse", < 0.5, 1, 0 >, "greenyellow", < 0.68, 1, 0.18 >, "honeydew", < 0.94, 1, 0.94 >,
               "limegreen", < 0.2, 0.8, 0.2 >, "mintcream", < 0.96, 1, 0.98 >, "seagreen", < 0.18, 0.55, 0.34 >, "orange", < 1, 0.65, 0 >, "darkorange", < 1, 0.55, 0 >, "coral", < 1, 0.5, 0.31 >, "navajowhite", < 1, 0.87, 0.68 >,
               "salmon", < 0.98, 0.5, 0.45 >, "seashell", < 1, 0.96, 0.93 >, "brown", < .24, .17, .15 > ];
 
default {
    touch_start(integer total_number) {
        if (llDetectedKey(0) != llGetOwner()) return;
        integer comChannel = (integer)("0x8" + llGetSubString(llGetKey(), 0, 6));
        llListen(comChannel, "", llGetOwner(), "");
        llDialog(llGetOwner(), "Please choose: ", wasDialogMenu(llList2ListStrided(colors, 0, -1, 2), [" Back", "", "Next "], ""), comChannel);
    }
    listen(integer channel, string name, key id, string message) {
        if (message == " Back") {
            llDialog(id, "Please browse the available items:\n", wasDialogMenu(llList2ListStrided(colors, 0, -1, 2), [" Back", "", "Next "], "<"), channel);
            return;
        }
        if (message == "Next ") {
            llDialog(id, "Please browse the available items:\n", wasDialogMenu(llList2ListStrided(colors, 0, -1, 2), [" Back", "", "Next "], ">"), channel);
            return;
        }
        integer i = llListFindList(colors, (list)message);
        if (i == -1) return;
        llOwnerSay(message);
        llParticleSystem([PSYS_SRC_TEXTURE, "4c056388-098b-3420-99f8-b43ca46ea202", PSYS_PART_START_SCALE, < 1, 1, 0 >, 6, < 1, 1, 0 >, PSYS_PART_START_COLOR,
                          (vector)llList2String(colors, i + 1), PSYS_PART_END_COLOR, (vector)llList2String(colors, i + 1), PSYS_PART_START_ALPHA, 1, PSYS_PART_END_ALPHA, 1, PSYS_SRC_BURST_PART_COUNT, 0x7FFFFFFF, PSYS_PART_MAX_AGE, 0.2, PSYS_SRC_MAX_AGE, 0, PSYS_SRC_PATTERN, (integer)4, PSYS_SRC_BURST_SPEED_MIN, 0, PSYS_SRC_BURST_SPEED_MAX, 0, PSYS_SRC_ANGLE_BEGIN,
                          (float)0.03 * 3.141593, PSYS_SRC_ANGLE_END, (float)0 * 3.141593, 8,
                          ZERO_VECTOR, PSYS_PART_FLAGS, (integer)(0 | 1 | PSYS_PART_EMISSIVE_MASK)]);
    }
}

secondlife/color_display.txt ยท Last modified: 2023/09/27 09:51 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.