Difference between revisions of "User:Fred Gandt/Scripts/Continued 5"

From Second Life Wiki
Jump to navigation Jump to search
(update analog clock and a little tidying)
(→‎One Prim Analog Clock: <-- add new script)
Line 826: Line 826:
     timer() {
     timer() {
         tick(); // We never tock :-(
         tick(); // We never tock :-(
    }
}</syntaxhighlight>
=== {{Anchor|One Prim Analog Clock}} One Prim Analog Clock ( V1 ) ===
* Basically the same instructions as above, except use only one prim.
* No chimes or second hand.
==== Clock Maker ====
<syntaxhighlight lang="lsl2">// V1 //
default {
    state_entry() {
        if ( llGetObjectPrimCount( llGetKey() ) == 1 ) {
            llSetLinkPrimitiveParamsFast( LINK_ROOT, [
                PRIM_MATERIAL, PRIM_MATERIAL_WOOD,
                PRIM_PHYSICS, FALSE,
                PRIM_TEMP_ON_REZ, FALSE,
                PRIM_PHANTOM, FALSE,
                PRIM_SIZE, <0.010000, 0.500000, 0.500000>,
                PRIM_ROTATION, <0.006886, -0.006422, 0.682003, 0.731288>,
                PRIM_TYPE, PRIM_TYPE_TUBE, PRIM_HOLE_DEFAULT, <0.000000, 1.000000, 0.000000>, 0.870000, ZERO_VECTOR, <1.000000, 0.500000, 0.000000>, ZERO_VECTOR, <0.260000, 1.000000, 0.000000>, ZERO_VECTOR, 1.000000, 0.000000, 0.000000,
                PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
                PRIM_NAME, "One prim analog clock",
                PRIM_DESC, "",
                PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                PRIM_SLICE, <0.260000, 1.000000, 0.000000>,
                PRIM_ALLOW_UNSIT, TRUE,
                PRIM_SCRIPTED_SIT_ONLY, FALSE,
                PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                PRIM_TEXTURE, 0, "6d4b097d-a29e-df77-1ff3-1b6beb505f83", <1.000000, 1.000000, 0.000000>, <1.000000, 0.000000, 0.000000>, 0.000000,
                PRIM_TEXTURE, 1, TEXTURE_PLYWOOD, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_TEXTURE, 2, "f99cd171-c605-920f-2d1a-4ffcfb35664a", <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_TEXTURE, 3, "42bf069c-ec10-1965-6238-935c3ff16db8", <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_TEXTURE, 4, "f99cd171-c605-920f-2d1a-4ffcfb35664a", <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_TEXTURE, 5, "a25bebc8-4739-453d-d44e-fc522cf95488", <0.052000, 2.800000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_COLOR, 0, ZERO_VECTOR, 1.000000,
                PRIM_COLOR, 1, <1.000000, 1.000000, 1.000000>, 1.000000,
                PRIM_COLOR, 2, <1.000000, 1.000000, 1.000000>, 1.000000,
                PRIM_COLOR, 3, ZERO_VECTOR, 1.000000,
                PRIM_COLOR, 4, <1.000000, 1.000000, 1.000000>, 1.000000,
                PRIM_COLOR, 5, <1.000000, 1.000000, 1.000000>, 1.000000,
                PRIM_BUMP_SHINY, 0, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 1, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 2, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 3, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 4, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 5, PRIM_SHINY_MEDIUM, PRIM_BUMP_NONE,
                PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                PRIM_TEXGEN, 0, PRIM_TEXGEN_PLANAR,
                PRIM_TEXGEN, 1, PRIM_TEXGEN_DEFAULT,
                PRIM_TEXGEN, 2, PRIM_TEXGEN_DEFAULT,
                PRIM_TEXGEN, 3, PRIM_TEXGEN_PLANAR,
                PRIM_TEXGEN, 4, PRIM_TEXGEN_DEFAULT,
                PRIM_TEXGEN, 5, PRIM_TEXGEN_DEFAULT,
                PRIM_GLOW, ALL_SIDES, 0.000000,
                PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
            ] );
            llRemoveInventory( llGetScriptName() );
        } else {
            llOwnerSay( "Read the instructions" );
        }
    }
}</syntaxhighlight>
==== Clock Movement ====
<syntaxhighlight lang="lsl2">// V1 //
key hour_hand = "5102a720-437d-9a59-1523-2bbd8d74ceea"; // PNG texture of an hour hand on a transparent background.
key min_hand = "28c3f7ba-6edd-67e7-b387-52b0da37053f"; // PNG texture of a minute hand on a transparent background.
integer timezone = -8; // Offset in hours from GMT. -8 is SLT.
float update_rate = 60.0; // The number of seconds between each display update.
// It is kinder to the region running this script, to run the timer slower.
// Since there is no second hand, there's no need to update evry second.
// Set to 60.0, the hands update once a minute.
//////////////////////////////
////// System Variables //////
integer twelve_hours = 43200;
integer one_hour = 3600;
tick() {
    float seconds = llGetGMTclock() + timezone;
    llSetLinkPrimitiveParamsFast( LINK_THIS, [
        PRIM_TEXTURE, 3, min_hand, <1.0, 1.0, 0.0>, ZERO_VECTOR, ( seconds * -0.1 ) * DEG_TO_RAD,
        PRIM_TEXTURE, 0, hour_hand, <1.0, 1.0, 0.0>, <1.0, 0.0, 0.0>, ( seconds * -0.008333 ) * DEG_TO_RAD
    ] );
}
default {
    on_rez( integer param ) {
        llResetScript();
    }
    state_entry() {
        timezone *= one_hour;
        tick();
        llSetTimerEvent( update_rate );
    }
    timer() {
        tick();
    }
    touch_start( integer nd ) {
        while ( nd ) {
            if ( llDetectedKey( --nd ) == llGetOwner() ) {
                timezone += one_hour;
                if ( timezone == twelve_hours ) {
                    timezone = 0;
                }
                tick();
            }
        }
     }
     }
}</syntaxhighlight>
}</syntaxhighlight>

Revision as of 12:57, 9 March 2017

I get in-world very rarely these days. The knock-on effect of this, is that I am not in the best position to keep these scripts updated. Please message me in-world (forwarded to email) if you discover any bugs (that can't be simply fixed), and I'll do my best to find a solution.

My Contributions

If unsure about how to use these scripts

I have implemented a version number system to make it more obvious if a script is updated. The V# is a comment at the top of each script.

If you have any comments about the content of this page please post them HERE

All my scripts are written for compilation as MONO

More Scripts

Legal Stuff

The legal stuff about contributing to this wiki. (worth reading)

PJIRA Issue Tracker

The issues I have filed on the PJIRA

Tuition

Tuition scripts, notes, videos and screenshots etc. (hardly any content yet)

Free Scripts

Prim Property Scrubber ( V2 )

Just drop it onto/into the prim you want to clean of a property and choose from the menu which properties to remove either 1 at a time or all at once.

// V2 //

key owner;

integer passes = 0;

integer channel;

list properties = ["All",         // All the properties listed below.
                   "Text",        // Floating text. Used to display text typically above a prim.
                   "Particles",   // Used in "Poofers" for example.
                   "TextureAnim", // Texture Animation. Used to make textures on faces of prims move.
                   "Sit Target",  // Used in seats and poseballs. Sets an alternative sit position than the default.
                   "Mouselook",   // Forced Mouselook. Used to force an agents view to mouselook when sitting on the prim.
                   "Sit Text",    // Text other than the default "Sit Here" shown on the right click pie menu.
                   "Touch Text",  // Text other than the default "Touch" shown on the right click pie menu.
                   "Status's",    // There are many status's that can be set in prims. See the wiki (llSetStatus) for details.
                   "Sound",       // Looping sound emitting from the prim.
                   "Light"];      // Light emitting from the prim.

RP(integer i)
{
    ++passes;
    if(i == 1)
    llSetText("", <0.0,0.0,0.0>, 0.0);
    else if(i == 2)
    llParticleSystem([]);
    else if(i == 3)
    llSetTextureAnim(0, -1, 0, 0, 0.0, 0.0, 1.0);
    else if(i == 4)
    llSitTarget(<0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>);
    else if(i == 5)
    llForceMouselook(0);
    else if(i == 6)
    llSetSitText("");
    else if(i == 7)
    llSetTouchText("");
    else if(i == 8)
    {
        llSetStatus(14, 1);
        llSetStatus(251, 0);
    }
    else if(i == 9)
    llStopSound();
    else if(i == 10)
    llSetPrimitiveParams([23, 0, <0.0,0.0,0.0>, 0.0, 0.0, 0.0]);
}

RemoveProperty(integer i)
{
    if(!i)
    {
        while(i < 10)
        RP(++i);
        RemoveScript();
    }
    else
    RP(i);
    if(passes < 10)
    llDialog(owner, "\nRemove Properties", ["Finished"] +
    (properties = llListReplaceList(properties, ["-"], i, i)), channel);
    else
    RemoveScript();
}

RemoveScript()
{
    llRemoveInventory(llGetScriptName());
}

default
{
    state_entry()
    {
        owner = llGetOwner();
        llListen((channel = (llRound(llFrand(-10000000)) - 100000)), llKey2Name(owner), owner, "");
        llDialog(owner, "\nRemove Properties", ["Finished"] + properties, channel);
        llSetTimerEvent(60.0);
    }
    listen(integer chan, string name, key id, string msg)
    {
        llSetTimerEvent(60.0);
        integer index = 0;
        if((index = llListFindList(properties, [msg])) != -1)
        {
            if(msg != "-")
            RemoveProperty(index);
            else
            llDialog(owner, "\nRemove Properties", ["Finished"] + properties, channel);
        }
        else if(msg == "Finished")
        RemoveScript();
    }
    timer()
    {
        llOwnerSay("Removing script since you're not using it.");
        RemoveScript();
    }
}

Bling Scrubber ( V1 )

This is specifically for removing particles and the scripts that set them from objects. It will cure link_sets or single prims. If the option to scrub the scripts is chosen (as well as to scrub the particles) ALL the scripts in the whole object will be removed.

// V1 //

string instructions = "";

integer channel = -9865443;

string scrub = "SCRUB";

string no = "NO";

integer link_num;

Dialog(integer d)
{
    key owner = llGetOwner();
    llListen(channel, "", owner, "");
    if(d)
    llDialog(owner, "\n\n" + instructions + "ARE YOU SURE YOU WANT TO REMOVE ALL SCRIPTS?" + 
                    "CLICKING \"" + no +
                    "\" WILL STILL REMOVE ALL PARTICLES BUT, THEY MIGHT COME BACK.", [scrub, no], channel);
}

default
{
    on_rez(integer param)
    {
        Dialog(1);
    }
    state_entry()
    {
        if((link_num = llGetLinkNumber()) == 1)
        {
            integer i = 2;
            do
            llGiveInventory(llGetLinkKey(i), llGetScriptName());
            while((++i) <= llGetNumberOfPrims());
            instructions = "Open an edit on me and goto your viewer \"Tools\" menu.\n" +
                           "Near the bottom of the menu click \"Set Scripts Running in Selection\".\n" +
                           "Once ALL the scripts are set running, click the \"" + scrub + "\" button.\n\n";
            llOwnerSay("Take then rez me. Follow the instructions given on rez.");
        }
        else if(!link_num)
        Dialog(1);
        else
        Dialog(0);
    }
    listen(integer chan, string name, key id, string msg)
    {
        chan = 0;
        if(msg == scrub)
        {
            string name;
            while((llGetInventoryNumber(INVENTORY_SCRIPT) - 1))
            {
                if((name = llGetInventoryName(INVENTORY_SCRIPT, chan)) != llGetScriptName())
                llRemoveInventory(name);
                else
                chan = 1;
            }
        }
        if(((chan = link_num) == 1))
        {
            do
            llLinkParticleSystem(chan, []);
            while((++chan) <= llGetNumberOfPrims());
        }
        else
        llParticleSystem([]);
        if(link_num < 2)
        llOwnerSay("All done!");
        llRemoveInventory(llGetScriptName());
    }
}

Basic Notecard Readers

Two simple methods of reading from a notecard in the prim contents with one of these scripts.

Cyclically Sequential Lines ( V1 )

// V1 //

key iq;

integer line;

GetLine(integer i)
{
    iq = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD, 0), i);
}

default
{
    dataserver(key q, string data)
    {
        if(q == iq)
        {
            ++line;
            if(data != EOF)
            {
                if(data != "")
                llSay(0, data);
                else
                GetLine(line);
            }
            else
            GetLine((line = 0));
        }
    }
    touch_start(integer nd)
    {
        if(llGetInventoryNumber(INVENTORY_NOTECARD))
        GetLine(line);
    }
}

Random Lines ( V1 )

// V1 //

key iq;

key qi;

integer line;

integer lines;

GetLine(integer i)
{
    iq = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD, 0), i);
}

default
{
    changed(integer change)
    {
        if(change & CHANGED_INVENTORY)
        llResetScript();
    }
    state_entry()
    {
        if(llGetInventoryNumber(INVENTORY_NOTECARD))
        qi = llGetNumberOfNotecardLines(llGetInventoryName(INVENTORY_NOTECARD, 0));
    }
    dataserver(key q, string data)
    {
        if(q == qi)
        lines = (((integer)data) - 1);
        else if(q == iq)
        {
            if(data != "")
            llSay(0, data);
            else
            GetLine((++line));
        }
    }
    touch_start(integer nd)
    {
        if(llGetInventoryNumber(INVENTORY_NOTECARD))
        GetLine((line = llRound(llFrand(((float)lines)))));
    }
}

CamHUD ( V1 )

Simple two function scripted camera controller. When turned on, the camera position locks in whatever place it was at the time of activation. To change the camera position, turn the HUD off...move the camera to the desired position...turn the HUD back on.

  • There are two buttons - One marked "Track" and another marked "Power".
    • "Power" (I think) has a fairly obvious function.
    • "Track" switches on and off, tracking of the owner. With tracking off the camera is locked solid. With tracking on the camera position is locked but it rotates to follow you around if you move.

The usefulness of this is up to you to decide.

Create the Object

To create the object use the following script. Just drop it onto/into a fresh prim. The resulting prim is quite small since it is designed to be a low impact HUD.

// V1 //

default
{
    state_entry()
    {
        llSetObjectName("CamHUD"); // You can change this after if you want.
        llSetPrimitiveParams([7, <0.01, 0.05, 0.025>,
                              8, <1.0, 0.0, 0.0, 0.0>,
                              9, 0, 0, <0.125, 0.625, 0.0>, 0.1, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>,
                              17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
        llRemoveInventory(llGetScriptName()); // Done its job so self deletes.
    }
}

CamHUD Script

Drop this script into the prim you just created. Wear the object as a HUD. If you do not see two distinct buttons separated by a black line, it is probably back to front or something.

// V1 //

integer perms;

integer track;

integer on;

vector red = <1.0,0.0,0.0>;

vector green = <0.0,1.0,0.0>;

SetCameraParams(integer o, integer t)
{
    list focus = [];
    llClearCameraParams();
    if(t)
    focus = [CAMERA_FOCUS, llGetPos()];
    else
    focus = [CAMERA_FOCUS_LOCKED, TRUE];
    llSetCameraParams([CAMERA_ACTIVE, o, CAMERA_POSITION_LOCKED, TRUE] + focus);
}

default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    state_entry()
    {
        if(llGetAttached())
        llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_CONTROL_CAMERA)
        {
            perms = TRUE;
            llSetText("   Track | Power", <1.0,1.0,1.0>, 1.0);
            llSetLinkPrimitiveParamsFast(-1, [PRIM_COLOR, -1, <0.0,0.0,0.0>, 1.0,
                                              PRIM_COLOR, 6, red, 1.0,
                                              PRIM_COLOR, 7, red, 1.0]);
        }
    }
    touch_start(integer nd)
    {
        if(perms)
        {
            integer face;
            vector color;
            if((face = llDetectedTouchFace(0)) == 6)
            {
                SetCameraParams((on = (!on)), track);
                if(on)
                color = green;
                else
                color = red;
            }
            else if(face == 7)
            {
                SetCameraParams(on, (track = (!track)));
                if(track)
                color = green;
                else
                color = red;
            }
            llSetLinkPrimitiveParamsFast(-1, [PRIM_COLOR, face, color, 1.0]);
        }
    }
}

Simple Profit Share Vendor ( V1 )

  • THIS SCRIPT WILL ASK FOR DEBIT PERMISSIONS. THEY MUST BE GRANTED FOR THE SCRIPT TO FUNCTION. L$ WILL BE TAKEN FROM THE OBJECT OWNERS ACCOUNT.

Sell the contents of an object (if in a link_set (multiple prim object) place in the root) for another creator. They get paid their cut and you get yours. You may provide a collection of inventory including LM's and/or NC's along with the main product. The script will pay the percentage to the creator named; The inventory may be created by multiple agents. If the creator named did not create anything in the inventory the script will ask that you start again.

// V1 //

integer price = 5; // Price of inventory. Must be greater than zero.

integer percentage = 50; // Percentage to pay creator of inventory.

string creator_to_pay = "Fred Gandt"; // Name of creator to pay percentage. Case Sensitive.

string folder_name = "Folder of Stuffs"; // The name of the folder as it appears in the buyers inventory.

/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////// DON'T EDIT BELOW THIS POINT UNLESS YOU KNOW WHAT YOU'RE DOING //////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////

key creator_to_pay_key = NULL_KEY;

key name_iq = NULL_KEY;

key owner = NULL_KEY;

list inventory = [];

integer search = 0;

list creators = [];

default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    changed(integer change)
    {
        if(change & (CHANGED_OWNER | CHANGED_INVENTORY))
        llResetScript();
    }
    state_entry()
    {
        llSetClickAction(CLICK_ACTION_TOUCH);
        owner = llGetOwner();
        if(percentage > 100)
        percentage = 100;
        llOwnerSay("\nClick this object when you have fully loaded the inventory." +
                   "\nYou will be asked to grant permissions." +
                   "\nYou MUST grant them for this script to function.");
    }
    touch_start(integer nd)
    {
        while(nd)
        {
            if(llDetectedKey(--nd) == owner)
            llRequestPermissions(owner, PERMISSION_DEBIT);
        }
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_DEBIT)
        {
            llSetPayPrice(PAY_HIDE, [price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
            llSetClickAction(CLICK_ACTION_PAY);
            integer in = llGetInventoryNumber(INVENTORY_ALL);
            key creator_key = NULL_KEY;
            integer count = 0;
            string name = "";
            do
            {
                if((name = llGetInventoryName(INVENTORY_ALL, count)) != llGetScriptName())
                {
                    inventory += [name];
                    if(llListFindList(creators, [(creator_key = llGetInventoryCreator(name))]) == -1)
                    creators += [creator_key];
                }
            }
            while((++count) < in);
            if(llGetListLength(inventory))
            name_iq = llRequestAgentData(llList2Key(creators, (search = 0)), DATA_NAME);
            else
            llOwnerSay("\nThere is nothing to sell.\nYou'll need to add some inventory.");
        }
        else
        {
            llOwnerSay("\nYou MUST grant permissions for this script to function.");
            llRequestPermissions(owner, PERMISSION_DEBIT);
        }
    }
    dataserver(key q, string data)
    {
        if(q == name_iq)
        {
            if(data == creator_to_pay)
            {
                creator_to_pay_key = llList2Key(creators, search);
                creators = [];
                state shop;
            }
            else if((llGetListLength(creators) - 1) > search)
            name_iq = llRequestAgentData(llList2Key(creators, (++search)), DATA_NAME);
            else
            llOwnerSay("\nThe creator to pay does not match any of the creators of the inventory." +
                       "\nPlease adjust the script appropriately.");
        }
    }
}
state shop
{
    on_rez(integer param)
    {
        llResetScript();
    }
    changed(integer change)
    {
        if(change & (CHANGED_OWNER | CHANGED_INVENTORY))
        llResetScript();
    }
    money(key id, integer amount)
    {
        if(amount >= price)
        {
            if(amount > price)
            llGiveMoney(id, (amount - price));
            integer cut = llFloor((((float)amount) / 100.0) * ((float)percentage));
            if(percentage && cut)
            llGiveMoney(creator_to_pay_key, cut);
            llGiveInventoryList(id, folder_name, inventory); // Last operation because of its 3 second script delay.
        }
        else
        {
            llGiveMoney(id, amount);
            llInstantMessage(id, ("\nYou paid too little.\nThe cost of this item is " + ((string)price) + "L$"));
        }
    }
}

Preloading Texture Displayer ( V1 )

Use to display a texture to the public while displaying on a hidden face the next texture to display. Perfect for presentations that require a slideshow. Touch triggered, the textures will be displayed incrementally in alphabetical/numerical order. The script reads the textures from the inventory of the object and reacts only to the owners touch.

// V1 //

integer display_face = 0; // Face to display the texture on.

integer hidden_face = 1; // A face that is hidden that displays the texture to be preloaded to all local viewers.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////NO NEED TO EDIT ANYTHING BELOW HERE///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

key owner;

integer tex;

integer noi;

default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    changed(integer change)
    {
        if(change & (CHANGED_INVENTORY | CHANGED_OWNER))
        llResetScript();
    }
    state_entry()
    {
        owner = llGetOwner();
        if((noi = llGetInventoryNumber(INVENTORY_TEXTURE)))
        {
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, (tex = 0)), display_face);
            if(noi > 1)
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, (++tex)), hidden_face);
        }
    }
    touch_start(integer nd)
    {
        while(nd)
        {
            if((llDetectedKey(--nd) == owner) && (noi > 1))
            {
                llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, tex), display_face);
                if((++tex) == noi)
                tex = 0;
                llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, tex), hidden_face);
            }
        }
    }
}

Analog Clock ( V2 )

Analog clock with hourly chimes (if desired) that by default shows SLT but can, by simply clicking the object, be adjusted to show any global timezone.

  • The first script is used to build the object.
  • The second script runs the clock.

Clock Maker

  • Create a link_set of 5 prims.
  • Drop this script on it.
// V2 //

default {
    state_entry() {
        if ( llGetObjectPrimCount( llGetKey() ) == 5 ) {
            llSetLinkPrimitiveParamsFast( 5, [
                    PRIM_MATERIAL, PRIM_MATERIAL_METAL,
                    PRIM_PHYSICS, FALSE,
                    PRIM_TEMP_ON_REZ, FALSE,
                    PRIM_PHANTOM, TRUE,
                    PRIM_SIZE, <0.090000, 0.08000, 0.080000>,
                    PRIM_TYPE, PRIM_TYPE_SPHERE, PRIM_HOLE_DEFAULT, <0.000000, 1.000000, 0.000000>, 0.000000, ZERO_VECTOR, <0.500000, 1.000000, 0.000000>,
                    PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                    PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                    PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
                    PRIM_NAME, "Spindle",
                    PRIM_DESC, "",
                    PRIM_ROT_LOCAL, <0.000000, 0.707107, 0.000000, 0.707107>,
                    PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                    PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                    PRIM_POS_LOCAL, <0.000000, 0.000000, 0.010000>,
                    PRIM_SLICE, <0.500000, 1.000000, 0.000000>,
                    PRIM_ALLOW_UNSIT, TRUE,
                    PRIM_SCRIPTED_SIT_ONLY, FALSE,
                    PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                    PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <3.100000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_COLOR, ALL_SIDES, <0.215686, 0.227451, 0.250980>, 1.000000,
                    PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_LOW, PRIM_BUMP_SIDING,
                    PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                    PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
                    PRIM_GLOW, ALL_SIDES, 0.000000,
                    PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                    PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
                ] + [ PRIM_LINK_TARGET, 4,
                    PRIM_MATERIAL, PRIM_MATERIAL_PLASTIC,
                    PRIM_PHYSICS, FALSE,
                    PRIM_TEMP_ON_REZ, FALSE,
                    PRIM_PHANTOM, TRUE,
                    PRIM_SIZE, <0.020000, 0.800000, 0.020000>,
                    PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.375000, 0.875000, 0.000000>, 0.000000, ZERO_VECTOR, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR,
                    PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                    PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                    PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
                    PRIM_NAME, "Minute hand",
                    PRIM_DESC, "",
                    PRIM_ROT_LOCAL, ZERO_ROTATION,
                    PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                    PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                    PRIM_POS_LOCAL, <0.000000, 0.000000, 0.030000>,
                    PRIM_SLICE, <0.400000, 0.600000, 0.000000>,
                    PRIM_ALLOW_UNSIT, TRUE,
                    PRIM_SCRIPTED_SIT_ONLY, FALSE,
                    PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                    PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 1.000000,
                    PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_LOW, PRIM_BUMP_NONE,
                    PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                    PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
                    PRIM_GLOW, ALL_SIDES, 0.000000,
                    PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                    PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
                ] + [ PRIM_LINK_TARGET, 3,
                    PRIM_MATERIAL, PRIM_MATERIAL_PLASTIC,
                    PRIM_PHYSICS, FALSE,
                    PRIM_TEMP_ON_REZ, FALSE,
                    PRIM_PHANTOM, TRUE,
                    PRIM_SIZE, <0.010000, 0.700000, 0.020000>,
                    PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.375000, 0.875000, 0.000000>, 0.000000, ZERO_VECTOR, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR,
                    PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                    PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                    PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
                    PRIM_NAME, "Second hand",
                    PRIM_DESC, "",
                    PRIM_ROT_LOCAL, ZERO_ROTATION,
                    PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                    PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                    PRIM_POS_LOCAL, <0.000000, 0.000000, 0.040000>,
                    PRIM_SLICE, <0.400000, 0.600000, 0.000000>,
                    PRIM_ALLOW_UNSIT, TRUE,
                    PRIM_SCRIPTED_SIT_ONLY, FALSE,
                    PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                    PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_COLOR, ALL_SIDES, <0.501961, 0.000000, 0.000000>, 1.000000,
                    PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_LOW, PRIM_BUMP_NONE,
                    PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                    PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
                    PRIM_GLOW, ALL_SIDES, 0.000000,
                    PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                    PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
                ] + [ PRIM_LINK_TARGET, 2,
                    PRIM_MATERIAL, PRIM_MATERIAL_PLASTIC,
                    PRIM_PHYSICS, FALSE,
                    PRIM_TEMP_ON_REZ, FALSE,
                    PRIM_PHANTOM, TRUE,
                    PRIM_SIZE, <0.040000, 0.600000, 0.020000>,
                    PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.375000, 0.875000, 0.000000>, 0.000000, ZERO_VECTOR, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR,
                    PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                    PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                    PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
                    PRIM_NAME, "Hour hand",
                    PRIM_DESC, "",
                    PRIM_ROT_LOCAL, ZERO_ROTATION,
                    PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                    PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                    PRIM_POS_LOCAL, <0.000000, 0.000000, 0.020000>,
                    PRIM_SLICE, <0.400000, 0.600000, 0.000000>,
                    PRIM_ALLOW_UNSIT, TRUE,
                    PRIM_SCRIPTED_SIT_ONLY, FALSE,
                    PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                    PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 1.000000,
                    PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_LOW, PRIM_BUMP_NONE,
                    PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                    PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
                    PRIM_GLOW, ALL_SIDES, 0.000000,
                    PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                    PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
                ] + [ PRIM_LINK_TARGET, 1,
                    PRIM_MATERIAL, PRIM_MATERIAL_METAL,
                    PRIM_PHYSICS, FALSE,
                    PRIM_TEMP_ON_REZ, FALSE,
                    PRIM_PHANTOM, TRUE,
                    PRIM_SIZE, <1.000000, 1.000000, 0.020000>,
                    PRIM_ROTATION, <0.707107, -0.000000, -0.000000, 0.707107>,
                    PRIM_TYPE, PRIM_TYPE_CYLINDER, PRIM_HOLE_DEFAULT, <0.000000, 1.000000, 0.000000>, 0.000000, ZERO_VECTOR, <0.950000, 0.950000, 0.000000>, ZERO_VECTOR,
                    PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                    PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                    PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
                    PRIM_NAME, "Analog clock",
                    PRIM_DESC, "4 prim analog clock with hourly chimes",
                    PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                    PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                    PRIM_SLICE, <0.000000, 1.000000, 0.000000>,
                    PRIM_ALLOW_UNSIT, TRUE,
                    PRIM_SCRIPTED_SIT_ONLY, FALSE,
                    PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                    PRIM_TEXTURE, 0, "ecf785e7-4cf6-9f95-6292-40061bdddeed", <0.700000, 0.700000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_TEXTURE, 1, TEXTURE_BLANK, <50.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_TEXTURE, 2, TEXTURE_BLANK, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_COLOR, 0, <0.674510, 0.674510, 0.725490>, 1.000000,
                    PRIM_COLOR, 1, ZERO_VECTOR, 1.000000,
                    PRIM_COLOR, 2, ZERO_VECTOR, 1.000000,
                    PRIM_BUMP_SHINY, 0, PRIM_SHINY_HIGH, PRIM_BUMP_BRIGHT,
                    PRIM_BUMP_SHINY, 1, PRIM_SHINY_LOW, PRIM_BUMP_NONE,
                    PRIM_BUMP_SHINY, 2, PRIM_SHINY_LOW, PRIM_BUMP_NONE,
                    PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                    PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
                    PRIM_GLOW, ALL_SIDES, 0.000000,
                    PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                    PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                    PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
                ] );
            llRemoveInventory( llGetScriptName() );
        } else {
            llOwnerSay( "Read the instructions" );
        }
    }
}

Clock Movement

  • Drop this script onto the clock object.
  • As soon as the script runs it will start displaying the time SLT (unless you change the timezone value).
  • If a UUID has been set for chimes it will chime the hour, on the hour each hour.
  • To set the time to another timezone simply touch the clock and the time will increment by one hour.
  • Enjoy!
// V2 //

key chime_sound = "79cdaa3c-43e9-63e7-d3c3-af6a14239452"; // UUID. If empty no chime will sound.

float chime_volume = 1.0; // Volume of chime.

integer timezone = -8; // SLT. Zero will be GMT/UTC.

///////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////// IF YOU EDIT BELOW THIS LINE THE SCRIPT WILL EXPLODE ////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////

string build_advice = "This script requires that the object has at least 4 prims.
There should be 3 child prims named: \"Hour hand\", \"Minute hand\" and \"Second hand\",
and at least one other prim that is the root.";

integer second_hand_link; 
integer minute_hand_link; 
integer hour_hand_link;

integer twelve_hours = 43200;
integer one_hour = 3600;

key owner;

tick() {
    integer seconds = ( integer )llGetGMTclock() + timezone; // Seconds equals seconds past midnight GMT/UTC plus timezone offset.
    if ( seconds > twelve_hours ) { // If it's past noon,
        seconds -= twelve_hours; // turn back time by twelve hours.
    }
    llSetLinkPrimitiveParamsFast( second_hand_link, [ PRIM_ROT_LOCAL, llEuler2Rot( <0.0, 0.0, ( seconds * -6.0 )> * DEG_TO_RAD ),
                PRIM_LINK_TARGET, minute_hand_link,   PRIM_ROT_LOCAL, llEuler2Rot( <0.0, 0.0, ( seconds * -0.1 )> * DEG_TO_RAD ),
                PRIM_LINK_TARGET, hour_hand_link,     PRIM_ROT_LOCAL, llEuler2Rot( <0.0, 0.0, ( seconds * -0.008333 )> * DEG_TO_RAD ) ] );
    if ( chime_sound ) { // If there's a chime sound UUID,
        if ( ( seconds % one_hour ) < ( seconds / one_hour ) ) { // and the current second is less than the current hour.
            llPlaySound( chime_sound, chime_volume ); // Chime!
        }
    }
}

default {
    changed( integer change ) {
        if ( change & ( CHANGED_LINK | CHANGED_OWNER ) ) {
            llResetScript(); // if the way the object is built or the owner has changed.
        }
    }
    state_entry() {
        owner = llGetOwner();
        integer nol = llGetObjectPrimCount( llGetKey() );
        if ( nol > 3 ) { // If the object has at least four prims,
            string link_name;
            while ( nol > 1 ) { // ignoring the root,
                link_name = llGetLinkName( nol ); // and by reading their names,
                if ( link_name == "Second hand" ) {
                    second_hand_link = nol; // establish which prims are the hands.
                } else if ( link_name == "Minute hand" ) {
                    minute_hand_link = nol;
                } else if ( link_name == "Hour hand" ) {
                    hour_hand_link = nol;
                }
                --nol;
            }
            if ( hour_hand_link && minute_hand_link && second_hand_link ) { // If the object is built correctly:
                timezone *= one_hour; // Convert timezone hours to seconds,
                llSetTimerEvent( 1.0 ); // and start the clock.
            } else {
                llOwnerSay( build_advice ); // Otherwise, tell the owner what's wrong.
            }
        } else {
            llOwnerSay( build_advice ); // Otherwise, tell the owner what's wrong.
        }
    }
    touch_start( integer nd ) {
        while ( nd ) {
            if ( llDetectedKey( --nd ) == owner ) { // Only if the clock's owner is touching it,
                timezone += one_hour; // advance timezone by one hour.
                if ( timezone == twelve_hours ) { // If timezone equals +twelve hours,
                    timezone = 0; // timezone equals zero.
                }
            }
        }
    }
    timer() {
        tick(); // We never tock :-(
    }
}

One Prim Analog Clock ( V1 )

  • Basically the same instructions as above, except use only one prim.
  • No chimes or second hand.

Clock Maker

// V1 //

default {
    state_entry() {
        if ( llGetObjectPrimCount( llGetKey() ) == 1 ) {
            llSetLinkPrimitiveParamsFast( LINK_ROOT, [
                PRIM_MATERIAL, PRIM_MATERIAL_WOOD,
                PRIM_PHYSICS, FALSE,
                PRIM_TEMP_ON_REZ, FALSE,
                PRIM_PHANTOM, FALSE,
                PRIM_SIZE, <0.010000, 0.500000, 0.500000>,
                PRIM_ROTATION, <0.006886, -0.006422, 0.682003, 0.731288>,
                PRIM_TYPE, PRIM_TYPE_TUBE, PRIM_HOLE_DEFAULT, <0.000000, 1.000000, 0.000000>, 0.870000, ZERO_VECTOR, <1.000000, 0.500000, 0.000000>, ZERO_VECTOR, <0.260000, 1.000000, 0.000000>, ZERO_VECTOR, 1.000000, 0.000000, 0.000000,
                PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
                PRIM_NAME, "One prim analog clock",
                PRIM_DESC, "",
                PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                PRIM_SLICE, <0.260000, 1.000000, 0.000000>,
                PRIM_ALLOW_UNSIT, TRUE,
                PRIM_SCRIPTED_SIT_ONLY, FALSE,
                PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                PRIM_TEXTURE, 0, "6d4b097d-a29e-df77-1ff3-1b6beb505f83", <1.000000, 1.000000, 0.000000>, <1.000000, 0.000000, 0.000000>, 0.000000,
                PRIM_TEXTURE, 1, TEXTURE_PLYWOOD, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_TEXTURE, 2, "f99cd171-c605-920f-2d1a-4ffcfb35664a", <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_TEXTURE, 3, "42bf069c-ec10-1965-6238-935c3ff16db8", <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_TEXTURE, 4, "f99cd171-c605-920f-2d1a-4ffcfb35664a", <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_TEXTURE, 5, "a25bebc8-4739-453d-d44e-fc522cf95488", <0.052000, 2.800000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_COLOR, 0, ZERO_VECTOR, 1.000000,
                PRIM_COLOR, 1, <1.000000, 1.000000, 1.000000>, 1.000000,
                PRIM_COLOR, 2, <1.000000, 1.000000, 1.000000>, 1.000000,
                PRIM_COLOR, 3, ZERO_VECTOR, 1.000000,
                PRIM_COLOR, 4, <1.000000, 1.000000, 1.000000>, 1.000000,
                PRIM_COLOR, 5, <1.000000, 1.000000, 1.000000>, 1.000000,
                PRIM_BUMP_SHINY, 0, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 1, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 2, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 3, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 4, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
                PRIM_BUMP_SHINY, 5, PRIM_SHINY_MEDIUM, PRIM_BUMP_NONE,
                PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                PRIM_TEXGEN, 0, PRIM_TEXGEN_PLANAR,
                PRIM_TEXGEN, 1, PRIM_TEXGEN_DEFAULT,
                PRIM_TEXGEN, 2, PRIM_TEXGEN_DEFAULT,
                PRIM_TEXGEN, 3, PRIM_TEXGEN_PLANAR,
                PRIM_TEXGEN, 4, PRIM_TEXGEN_DEFAULT,
                PRIM_TEXGEN, 5, PRIM_TEXGEN_DEFAULT,
                PRIM_GLOW, ALL_SIDES, 0.000000,
                PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
            ] );
            llRemoveInventory( llGetScriptName() );
        } else {
            llOwnerSay( "Read the instructions" );
        }
    }
}

Clock Movement

// V1 //

key hour_hand = "5102a720-437d-9a59-1523-2bbd8d74ceea"; // PNG texture of an hour hand on a transparent background.
key min_hand = "28c3f7ba-6edd-67e7-b387-52b0da37053f"; // PNG texture of a minute hand on a transparent background.

integer timezone = -8; // Offset in hours from GMT. -8 is SLT.

float update_rate = 60.0; // The number of seconds between each display update.
// It is kinder to the region running this script, to run the timer slower.
// Since there is no second hand, there's no need to update evry second.
// Set to 60.0, the hands update once a minute.

//////////////////////////////
////// System Variables //////

integer twelve_hours = 43200;
integer one_hour = 3600;

tick() {
    float seconds = llGetGMTclock() + timezone;
    llSetLinkPrimitiveParamsFast( LINK_THIS, [
        PRIM_TEXTURE, 3, min_hand, <1.0, 1.0, 0.0>, ZERO_VECTOR, ( seconds * -0.1 ) * DEG_TO_RAD,
        PRIM_TEXTURE, 0, hour_hand, <1.0, 1.0, 0.0>, <1.0, 0.0, 0.0>, ( seconds * -0.008333 ) * DEG_TO_RAD
    ] );
}
 
default {
    on_rez( integer param ) {
        llResetScript();
    }
    state_entry() {
        timezone *= one_hour;
        tick();
        llSetTimerEvent( update_rate );
    }
    timer() {
        tick();
    }
    touch_start( integer nd ) {
        while ( nd ) {
            if ( llDetectedKey( --nd ) == llGetOwner() ) {
                timezone += one_hour;
                if ( timezone == twelve_hours ) {
                    timezone = 0;
                }
                tick();
            }
        }
    }
}

Shutter Door ( V2 )

Retracting door. Acts like a security shutter. The textures are offset to follow the movement so as the shutter folds away or folds out the texture stays in the correct place. This first version may be a little ropey but I got bored testing. I'll work on an update later.

Create Basic Shutter

Drop this script on a fresh prim to create a basic shutter shape with a simple shutter texturing provided by using the "Siding" bump map.

// V1 //

default
{
    state_entry()
    {
        llSetPrimitiveParams([7, <4.0, 6.0, 0.01>,
                              8, <0.0, 0.707107, -0.707107, 0.0>,
                              9, 0, 0, <0.375, 0.875, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>,
                              17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <6.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.570796,
                              18, -1, <1.0, 1.0, 1.0>, 1.0,
                              19, 0, 1, 13,
                              19, 1, 1, 0,
                              19, 2, 1, 0,
                              19, 3, 1, 0,
                              19, 4, 1, 13,
                              19, 5, 1, 0,
                              19, 6, 1, 0,
                              25, -1, 0.02]);
        llRemoveInventory(llGetScriptName()); // Self deleting script.
    }
}

Shutter Script

This script actually operates the door (by touch).

// V2 //

float delay = 10.0; // Seconds before auto closure. Set to zero to disable.

float volume = 1.0; // Volume for sounds. 0.0 to 1.0

float speed = 0.02; // Speed of shutter action. The larger the figure the faster the action.

key texture = TEXTURE_BLANK; // UUID of the texture to use on the two most prominent faces.

key start = "03127ba7-9dbb-b6ab-0622-dcf8f1cd841a"; // UUID of initializing sound.

key loop = "55fc1f41-9b74-bc66-8ad5-89b6c489851c"; // UUID of retraction loop sound.

key end = "c7579f2c-6a23-f2b6-8d82-84a052b1bc30"; // UUID of termination sound.

integer open;

float rot;

float Y;

OperateDoor(integer i)
{
    vector v = llGetScale();
    float y = v.y;
    llTriggerSound(start, volume);
    llLoopSound(loop, volume);
    if(i)
    {
        Y = y;
        float o = 1.0;
        while(y > speed)
        {
            llSetLinkPrimitiveParamsFast(-4, [PRIM_SIZE, <v.x, (y -= speed), v.z>,
                                              PRIM_TEXTURE, 4, texture, <y,1.0,0.0>, <(o -= (speed / 2)),0.0,0.0>, rot,
                                              PRIM_TEXTURE, 0, texture, <y,1.0,0.0>, <(-o),0.0,0.0>, rot]);
            if(o < (-1.0 + (speed / 2)))
            o = 1.0;
        }
        llSetTimerEvent(delay);
    }
    else
    {
        llSetTimerEvent(0.0);
        float o = 0.0;
        while(y < Y)
        {
            llSetLinkPrimitiveParamsFast(-4, [PRIM_SIZE, <v.x, (y += speed), v.z>,
                                              PRIM_TEXTURE, 4, texture, <y,1.0,0.0>, <(o += (speed / 2)),0.0,0.0>, rot,
                                              PRIM_TEXTURE, 0, texture, <y,1.0,0.0>, <(-o),0.0,0.0>, rot]);
            if(o > (1 - (speed / 2)))
            o = 0.0;
        }
    }
    llPlaySound(end, volume);
}

default
{
    state_entry()
    {
        rot = (90.0 * DEG_TO_RAD);
    }
    touch_start(integer nd)
    {
        OperateDoor((open = (!open)));
    }
    timer()
    {
        OperateDoor((open = 0));
    }
}

More Scripts...

If you have any comments about the content of this page please post them HERE