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

From Second Life Wiki
Jump to navigation Jump to search
m
(minor tidy of shutter door scripts)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL Header}}
{{User:Fred Gandt/Template|content=
 
[[Image:Fredgandt icon 1024 jpg.jpg|thumb|right]]
 
{{RightToc|right;}}
 
== My Contributions ==
 
'''[[User:Fred_Gandt#How_to_Collect_These_Scripts | If unsure about how to use these scripts]]'''
 
I have implemented a V# system to make it more obvious if a script is updated. '''The V# forms part of the title of each script.'''
 
If you have any comments about the content of this page please post them '''[[User_talk:Fred_Gandt/Scripts/Continued_5 | HERE]]'''
 
All my scripts are written for compilation as '''[[Mono|MONO]]'''
 
=== More Pages ===
 
'''[[User:Fred_Gandt#Direct_Links_to_Scripts | Direct Links To All Individual Scripts]]'''
 
'''[[User:Fred_Gandt/Scripts| Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Continued_1| More Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Continued_2| Even More Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Continued_3| Even More More Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Continued_4| Even More More More Free Scripts]]''' (content constantly updating)
 
'''Even More More More More Free Scripts''' (this page)
 
'''[[User:Fred_Gandt/Scripts/Continued_6| Even More More More More More Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Vehicles/Car| Car Type Land Vehicle Scripts]]''' (Working on it...)
 
'''[[User:Fred_Gandt/Scripts/Functions| Functions For Specific Tasks]]'''
 
=== Legal Stuff ===
 
'''[[Project:Contribution Agreement| The legal stuff about contributing to this wiki.]]''' (worth reading)
 
=== PJIRA Issue Tracker ===
 
'''[https://jira.secondlife.com/secure/IssueNavigator!executeAdvanced.jspa?jqlQuery=reporter+%3D+%22Fred+Gandt%22&runQuery=true&clear=true The issues I have filed on the PJIRA]'''
 
== Tuition ==
 
'''[[User:Fred_Gandt/Tuition| Tuition scripts, notes, videos and screenshots etc.]]''' (hardly any content yet)


== Free Scripts ==
== Free Scripts ==
 
=== Prim Property Scrubber ===
{{Anchor|Prim Property Scrubber}}
=== Prim Property Scrubber ( V2 ) ===
 
Just drop it onto/into the prim you want to clean of a '''[[Prim#Properties|property]]''' and choose from the menu which properties to remove either 1 at a time or all at once.
Just drop it onto/into the prim you want to clean of a '''[[Prim#Properties|property]]''' and choose from the menu which properties to remove either 1 at a time or all at once.


<lsl>// V2 //
<syntaxhighlight lang="lsl2">// V2 //


key owner;
key owner;
Line 154: Line 103:
         RemoveScript();
         RemoveScript();
     }
     }
}</lsl>
}</syntaxhighlight>
 
{{Anchor|Bling Scrubber}}
=== Bling Scrubber ( V1 ) ===


=== Bling Scrubber ===
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.
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.


<lsl>// V1 //
<syntaxhighlight lang="lsl2">// V1 //


string instructions = "";
string instructions = "";
Line 233: Line 180:
         llRemoveInventory(llGetScriptName());
         llRemoveInventory(llGetScriptName());
     }
     }
}</lsl>
}</syntaxhighlight>
 
{{Anchor|Basic Notecard Readers}}


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


==== Cyclically Sequential Lines ( V1 ) ====
==== Cyclically Sequential Lines ====
 
<syntaxhighlight lang="lsl2">// V1 //
<lsl>// V1 //


key iq;
key iq;
Line 277: Line 220:
         GetLine(line);
         GetLine(line);
     }
     }
}</lsl>
}</syntaxhighlight>


==== Random Lines ( V1 ) ====
==== Random Lines ====
 
<syntaxhighlight lang="lsl2">// V1 //
<lsl>// V1 //


key iq;
key iq;
Line 325: Line 267:
         GetLine((line = llRound(llFrand(((float)lines)))));
         GetLine((line = llRound(llFrand(((float)lines)))));
     }
     }
}</lsl>
}</syntaxhighlight>
 
{{Anchor|CamHUD}}
=== CamHUD ( V1 ) ===


=== CamHUD ===
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.
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".
*There are two buttons - One marked "Track" and another marked "Power".
Line 337: Line 277:


==== Create the Object ====
==== 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.
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.


<lsl>// V1 //
<syntaxhighlight lang="lsl2">// V1 //


default
default
Line 353: Line 292:
         llRemoveInventory(llGetScriptName()); // Done its job so self deletes.
         llRemoveInventory(llGetScriptName()); // Done its job so self deletes.
     }
     }
}</lsl>
}</syntaxhighlight>


==== CamHUD Script ====
==== 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.
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.


<lsl>// V1 //
<syntaxhighlight lang="lsl2">// V1 //


integer perms;
integer perms;
Line 429: Line 367:
         }
         }
     }
     }
}</lsl>
}</syntaxhighlight>
 
{{Anchor|Simple Profit Share Vendor}}
=== Simple Profit Share Vendor ( V1 ) ===


=== Simple Profit Share Vendor ===
*'''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.'''
*'''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.
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.


<lsl>// V1 //
<syntaxhighlight lang="lsl2">// V1 //


integer price = 5; // Price of inventory. Must be greater than zero.
integer price = 5; // Price of inventory. Must be greater than zero.
Line 570: Line 506:
         }
         }
     }
     }
}</lsl>
}</syntaxhighlight>
 
{{Anchor|Preloading Texture Displayer}}
=== Preloading Texture Displayer ( V1 ) ===


=== Preloading Texture Displayer ===
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.
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.


<lsl>// V1 //
<syntaxhighlight lang="lsl2">// V1 //


integer display_face = 0; // Face to display the texture on.
integer display_face = 0; // Face to display the texture on.
Line 627: Line 561:
         }
         }
     }
     }
}</lsl>
}</syntaxhighlight>
 
{{Anchor|Analog Clock}}
=== Analog Clock ( V1 ) ===


Simple analog clock with hourly chimes (if desired) that by default shows GMT but can by simply clicking the object be adjusted by hour to show any global timezone.
=== Analog Clock ===
*The first script is used to build the object. Some manual prim editing is required but very little. This includes the naming of the hands.
Analog clock with hourly chimes (if desired) and [https://en.wikipedia.org/wiki/Westminster_Quarters Westminster Quarters] (also if desired) that by default shows SLT but can, by simply clicking the object, be adjusted to show any global timezone.
*The second script runs the clock.
* To change the timezone by touching the clock (not editing the script):
** Touch the right sade of the face to increment the time by 15 minutes.
** Touch the left side of the face to decrement the time by 15 minutes.
* The first script is used to build the object.
* The second script runs the clock.


==== Clock Maker ====
==== Clock Maker ====
* Create a link_set of 5 prims.
* Drop this script on it.


*Create a link_set of 6 prims.
<syntaxhighlight lang="lsl2">// V2 //
*Drop this script on it.
 
<lsl>// V2 //


default
default {
{
     state_entry() {
     state_entry()
         if ( llGetObjectPrimCount( llGetKey() ) == 5 ) {
    {
             llSetLinkPrimitiveParamsFast( 5, [
         if(llGetObjectPrimCount(llGetKey()) == 6)
                    PRIM_MATERIAL, PRIM_MATERIAL_METAL,
        {
                    PRIM_PHYSICS, FALSE,
             llSetLinkPrimitiveParamsFast(1, [5,1,7,<1.0, 1.0, 0.02>,
                    PRIM_TEMP_ON_REZ, FALSE,
                                            8,<0.0, 0.0, 0.0, 1.0>,
                    PRIM_PHANTOM, TRUE,
                                            9,0,0,<0.0, 1.0, 0.0>,0.0,<0.0, 0.0, 0.0>,<0.95, 0.95, 0.0>,<0.0, 0.0, 0.0>,
                    PRIM_SIZE, <0.090000, 0.08000, 0.080000>,
                                            17,0,"ecf785e7-4cf6-9f95-6292-40061bdddeed",<0.7, 0.7, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    PRIM_TYPE, PRIM_TYPE_SPHERE, PRIM_HOLE_DEFAULT, <0.000000, 1.000000, 0.000000>, 0.000000, ZERO_VECTOR, <0.500000, 1.000000, 0.000000>,
                                            17,1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                                            17,2,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                                            17,3,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
                                            17,4,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    PRIM_NAME, "Spindle",
                                            17,5,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    PRIM_DESC, "",
                                            18,-1,<0.6745, 0.6745, 0.7255>,1.0,
                    PRIM_ROT_LOCAL, <0.000000, 0.707107, 0.000000, 0.707107>,
                                            19,0,3,1,
                    PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                                            19,1,3,0,
                    PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                                            19,2,3,0,
                    PRIM_POS_LOCAL, <0.000000, 0.000000, 0.010000>,
                                            19,3,3,0,
                    PRIM_SLICE, <0.500000, 1.000000, 0.000000>,
                                            19,4,3,0,
                    PRIM_ALLOW_UNSIT, TRUE,
                                            19,5,3,0,
                    PRIM_SCRIPTED_SIT_ONLY, FALSE,
                                            20,0,1,
                    PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                                            20,1,0,
                    PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <3.100000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                                            20,2,0,
                    PRIM_COLOR, ALL_SIDES, <0.215686, 0.227451, 0.250980>, 1.000000,
                                            20,3,0,
                    PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_LOW, PRIM_BUMP_SIDING,
                                            20,4,0,
                    PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
                                            20,5,1,
                    PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
                                            25,-1,0.012]);
                    PRIM_GLOW, ALL_SIDES, 0.000000,
            llSetLinkPrimitiveParamsFast(2, [6, <0.0,0.0,0.01>, 7,<0.16, 0.91, 0.91>,
                    PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                                            8,<0.0, 0.707107, 0.0, 0.707107>,
                    PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                                            9,3,0,<0.0, 1.0, 0.0>,0.0,<0.0, 0.0, 0.0>,<0.5, 1.0, 0.0>,
                    PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
                                            17,-1,"e97cf410-8e61-7005-ec06-629eba4cd1fb",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                ] + [ PRIM_LINK_TARGET, 4,
                                            18,-1,<1.0, 1.0, 1.0>,1.0,
                    PRIM_MATERIAL, PRIM_MATERIAL_PLASTIC,
                                            19,-1,2,0]);
                    PRIM_PHYSICS, FALSE,
            llSetLinkPrimitiveParamsFast(3, [6, <0.0,0.0,0.02>, 7,<0.04, 0.6, 0.02>,
                    PRIM_TEMP_ON_REZ, FALSE,
                                            8,<0.0, 0.0, 0.0, 1.0>,
                    PRIM_PHANTOM, TRUE,
                                            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>,
                    PRIM_SIZE, <0.020000, 0.800000, 0.020000>,
                                            17,-1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    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,
                                            18,-1,<0.0, 0.0, 0.0>,1.0,
                    PRIM_FLEXIBLE, FALSE, FALSE, 0.000000, 0.000000, 0.000000, 0.000000, ZERO_VECTOR,
                                            19,-1,1,0,
                    PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.000000, 0.000000, 0.000000,
                                            25,-1,0.012]);
                    PRIM_TEXT, "", ZERO_VECTOR, 1.000000,
            llSetLinkPrimitiveParamsFast(4, [6, <0.0,0.0,0.06>, 7,<0.02, 0.4, 0.02>,
                    PRIM_NAME, "Minute hand",
                                            8,<0.0, 0.0, 0.0, 1.0>,
                    PRIM_DESC, "",
                                            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>,
                    PRIM_ROT_LOCAL, ZERO_ROTATION,
                                            17,-1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                                            18,-1,<0.5, 0.0, 0.0>,1.0,
                    PRIM_OMEGA, ZERO_VECTOR, 0.000000, 0.000000,
                                            19,-1,1,0,
                    PRIM_POS_LOCAL, <0.000000, 0.000000, 0.030000>,
                                            25,-1,0.012]);
                    PRIM_SLICE, <0.400000, 0.600000, 0.000000>,
            llSetLinkPrimitiveParamsFast(5, [6, <0.0,0.0,0.04>, 7,<0.02, 0.8, 0.02>,
                    PRIM_ALLOW_UNSIT, TRUE,
                                            8,<0.0, 0.0, 0.0, 1.0>,
                    PRIM_SCRIPTED_SIT_ONLY, FALSE,
                                            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>,
                    PRIM_SIT_TARGET, FALSE, ZERO_VECTOR, ZERO_ROTATION,
                                            17,-1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                    PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                                            18,-1,<0.0, 0.0, 0.0>,1.0,
                    PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 1.000000,
                                            19,-1,1,0,
                    PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_LOW, PRIM_BUMP_NONE,
                                            25,-1,0.012]);
                    PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
            llSetLinkPrimitiveParamsFast(6, [6, <0.0,0.0,0.01>, 7,<0.12, 0.06, 0.06>,
                    PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
                                            8,<0.0, 0.707107, 0.0, 0.707107>,
                    PRIM_GLOW, ALL_SIDES, 0.000000,
                                            9,3,0,<0.0, 1.0, 0.0>,0.0,<0.0, 0.0, 0.0>,<0.5, 1.0, 0.0>,
                    PRIM_SPECULAR, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000, <1.000000, 1.000000, 1.000000>, 51, FALSE,
                                            17,-1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.25, 0.0, 0.0>,0.0,
                    PRIM_NORMAL, ALL_SIDES, NULL_KEY, <1.000000, 1.000000, 0.000000>, ZERO_VECTOR, 0.000000,
                                            18,-1,<0.675, 0.675, 0.7255>,1.0,
                    PRIM_ALPHA_MODE, ALL_SIDES, TRUE, FALSE
                                            19,0,3,0,19,1,3,0,19,2,3,0,
                ] + [ PRIM_LINK_TARGET, 3,
                                            25,-1,0.012]);
                    PRIM_MATERIAL, PRIM_MATERIAL_PLASTIC,
            llSetLinkPrimitiveParamsFast(1, [8,<0.707107, 0.0, 0.0, 0.707107>]);
                    PRIM_PHYSICS, FALSE,
            llRemoveInventory(llGetScriptName());
                    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" );
         }
         }
        else
        llOwnerSay("Read the instructions");
     }
     }
}</lsl>
}</syntaxhighlight>


*When it has run, open an edit on the object and check the "Edit Linked Parts" checkbox.
==== Clock Movement ====
*Select the clear dome covering the face and path cut it to give easier editing access to the hands.
* Drop this script onto the clock object.
*Select each hand one at a time and set the slice parameter to <code>B : 0.400 E : 0.600</code>
* As soon as the script runs it will start displaying the time SLT (unless you change the timezone value).
*As you have the edit open for each, also name each hand as follows -
**'''Hour Hand''' - is the shorter of the two black hands.
**'''Minute Hand''' - is the longer of the two black hands.
**'''Second Hand''' - is the shortest.
***'''NAME THE HANDS EXACTLY AS THEY ARE WRITTEN HERE. Mind the capitals and spaces etc.'''
*When those steps are complete, select the dome prim again and remove the path cutting.
*The object is complete.


==== Clock Movement ====
<syntaxhighlight lang="lsl2">// V4 //
 
// The UUIDs of chime sounds at 4 different pitches.
key bell_b = "729a4e57-0628-f253-bb34-ec649b896b77";
key bell_e = "2cfd2002-abc9-f5eb-e137-1b2cc6c2f3bb";
key bell_f_sharp = "6b8f3015-c4c7-83d5-3429-2e1fd2ebd577";
key bell_g_sharp = "cdab652c-6488-2ead-7abc-c52351bef11d";
 
// Volume of chime. 1.0 is maximum.
float chime_volume = 1.0;


*Drop this script onto the clock object.
// Set to FALSE for no chimes.
*As soon as the script runs it will start displaying the time GMT.
integer chimes = TRUE;
*If a UUID has been set for chimes it will chime the hour (even if not zero minutes past) but from then on will only chime 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!


<lsl>// V1 //
// Set to FALSE for no quarterly chimes.
integer quarterly_chimes = TRUE;


key chime = "79cdaa3c-43e9-63e7-d3c3-af6a14239452"; // Chime sound UUID. If empty no chime will sound.
// PDT. PST is -8.0 and 0.0 will be GMT/UTC.
float timezone = -7.0;


float volume = 1.0; // Volume of chime.
///////////////////////// IF YOU EDIT BELOW THIS LINE THE SCRIPT WILL EXPLODE ///////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////
// Said to the owner if the object isn't built correctly.
///////////////////////////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.";


// Used to store the link number's of the hands.
integer second_hand_link;
integer second_hand_link;
integer minute_hand_link;
integer hour_hand_link;


integer minute_hand_link;
// A few numerical values that are repeatedly used.
integer twelve_hours = 43200;
integer one_hour = 3600;
integer fifteen_minutes = 900;
 
// Used to store the timezone offset converted to seconds.
integer tz;
 
// The full order in which the Westminster Quarters are played.
list westminster_quarters = [ bell_g_sharp, bell_f_sharp, bell_e, bell_b,
                              bell_e, bell_g_sharp, bell_f_sharp, bell_b,
                              bell_e, bell_f_sharp, bell_g_sharp, bell_e,
                              bell_g_sharp, bell_e, bell_f_sharp, bell_b,
                              bell_b, bell_f_sharp, bell_g_sharp, bell_e,
// Plus one null key used to rest between each part of each quarter.
                              NULL_KEY ];


integer hour_hand_link;
// The seconds past each hour at which each quarter is played.
list quarters_lookup = [ fifteen_minutes, 1800, 2700, 3585 ];


float twelve = 43200.0;
// The parts of the Westminster Quarters to play each quarter.
list quarters_lookdown = [ "0, 1, 2, 3",
                          "4, 5, 6, 7, 20, 8, 9, 10, 11",
                          "12, 13, 14, 15, 20, 16, 17, 18, 19, 20, 0, 1, 2, 3",
                          "4, 5, 6, 7, 20, 8, 9, 10, 11, 20, 12, 13, 14, 15, 20, 16, 17, 18, 19" ];


integer last = -1;
// Used to remember the above parts when converted from strings to lists.
list quartermaster;


integer offset;
// Several variables used to monitor the flow of the Westminster Quarters.
integer tock;
integer qm_length;
integer westmindex;
integer current_quarter;
integer hung_drawn_and_quartered = FALSE;


integer chimes;
// Used to store the owner's UUID.
key owner;


integer hour;
// Function to handle all chiming.
chime( integer secs ) {
    integer current_second = secs % one_hour; // Temporarily store the seconds past the hour,
    integer current_hour = secs / one_hour; // and the current hour.
    if ( quarterly_chimes ) { // If quarterly chimes are to be played,
        if ( hung_drawn_and_quartered ) { // and the necessary groundwork has been done,
            if ( westmindex < qm_length ) { // and we're supposed to be playing a sound:
                // Work out which sound we're supposed to be playing, based on the current data,
                key bell = llList2Key( westminster_quarters, llList2Integer( quartermaster, westmindex++ ) );
                if ( bell ) { // and if it's a bell sound, and not a rest,
                    llTriggerSound( bell, chime_volume ); // chime!
                }
            } else { // If we're not supposed to be playing a sound,
                hung_drawn_and_quartered = FALSE; // we must have finished this quarter,
                llSetTimerEvent( 1.0 ); // so go back to normal speed.
            }
        } else { // If the necessary groundwork has not been done:
            // Establish if we should be playing a quarter by comparing the current second
            current_quarter = llListFindList( quarters_lookup, [ current_second ] ); // to the seconds at each quarter.
            if ( ~current_quarter ) { // and if we should be playing a quarter:
                // Fetch the appropriate string of indexes, and convert it to a list,
                quartermaster = llCSV2List( llList2String( quarters_lookdown, current_quarter ) );
                qm_length = llGetListLength( quartermaster ); // establish how long that list is,
                hung_drawn_and_quartered = TRUE; // switch on our indicator that we should be playing quarters,
                westmindex = 0; // reset our counter,
                llSetTimerEvent( 0.5 ); // and speed up the clock's movement.
            }
        }
    }
    if ( current_second < current_hour ) { // If the current second is less than the current hour.
        llTriggerSound( bell_b, chime_volume ); // Chime!
    }
}


default
// Function called per timer event.
{
tick() {
     on_rez(integer param)
     integer seconds = ( integer )llGetGMTclock() + tz; // Seconds equals seconds past midnight GMT/UTC plus timezone offset.
     {
    // If the clock movement has been sped up to play the Westminster Quarters, only move the hands every other tick.
         llResetScript();
    if ( !hung_drawn_and_quartered || ( tock = !tock ) ) {
        if ( seconds > twelve_hours ) { // If it's past noon,
            seconds -= twelve_hours; // turn back time by twelve hours.
        }
        // Rotate all the hands to show the current time.
        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 ( chimes ) { // If we should be playing chimes,
         chime( seconds ); // call the chime function and tell it what the time is.
     }
     }
    changed(integer change)
}
     {
 
        if(change & CHANGED_LINK)
// Function to convert a negative timezone into a positive one.
         llResetScript();
backToTheFuture() {
     if ( tz < 0 ) { // If tz is negative,
         tz += twelve_hours; // make it positive.
     }
     }
    state_entry()
}
    {
 
        integer nol = (llGetObjectPrimCount(llGetKey()) + 1);
default {
        string link_name = "";
    // Triggered when many different things that affect the object or script are changed.
        while(--nol)
    changed( integer change ) {
         {
         if ( change & ( CHANGED_LINK | CHANGED_OWNER ) ) {
            if((link_name = llGetLinkName(nol)) == "Second Hand")
             llResetScript(); // if the way the object is built or the owner has changed.
            second_hand_link = nol;
             else if(link_name == "Minute Hand")
            minute_hand_link = nol;
            else if(link_name == "Hour Hand")
            hour_hand_link = nol;
         }
         }
        llSetTimerEvent(1.0);
     }
     }
     timer()
     // Triggered when we enter our parent state.
    {
    state_entry() {
         float seconds = (llGetGMTclock() + ((float)offset));
         owner = llGetOwner(); // Store the owner's UUID.
         rotation root_rot = llGetRootRotation();
         integer nol = llGetObjectPrimCount( llGetKey() ); // Establish how many prims are in the object,
        llSetLinkPrimitiveParamsFast(second_hand_link, [8, (llEuler2Rot(<0.0,0.0,(seconds * -6.0)> * DEG_TO_RAD) / root_rot)]);
         if ( nol > 3 ) { // and if the object has at least four prims,
         llSetLinkPrimitiveParamsFast(minute_hand_link, [8, (llEuler2Rot(<0.0,0.0,(seconds * -0.1)> * DEG_TO_RAD) / root_rot)]);
            string link_name; // use this to remember their names,
        llSetLinkPrimitiveParamsFast(hour_hand_link, [8, (llEuler2Rot(<0.0,0.0,(seconds * -0.008333)> * DEG_TO_RAD) / root_rot)]);
             while ( nol > 1 ) { // whilst ignoring the root,
        if(chime)
                 link_name = llGetLinkName( nol ); // and by reading their names,
        {
                 if ( link_name == "Second hand" ) {
             if((!chimes))
                     second_hand_link = nol; // establish which prims are the hands.
            {
                 } else if ( link_name == "Minute hand" ) {
                 if(seconds > twelve)
                     minute_hand_link = nol;
                 {
                } else if ( link_name == "Hour hand" ) {
                    if((seconds -= twelve) > twelve)
                     hour_hand_link = nol;
                     seconds -= twelve;
                 }
                if((hour = llFloor((seconds / 3600.0))) != last)
                {
                     last = hour;
                    if((!hour))
                     hour = 12;
                    chimes = hour;
                 }
                 }
                --nol; // Count backwards from the last link.
             }
             }
             if(chimes)
             if ( hour_hand_link && minute_hand_link && second_hand_link ) { // If the object is built correctly:
            {
                 tz = ( integer )( timezone * one_hour ); // Convert timezone hours to seconds,
                 llPlaySound(chime, volume);
                backToTheFuture(); // Make sure the timezone is positive.
                 --chimes;
                llSetTimerEvent( 1.0 ); // Start the clock.
            } else { // Otherwise,
                 llOwnerSay( build_advice ); // tell the owner what's wrong.
             }
             }
        } else { // Otherwise,
            llOwnerSay( build_advice ); // tell the owner what's wrong.
         }
         }
     }
     }
     touch_start(integer nd)
    // Triggered when a touch (mouse click or menu selected) is started on the object containing this script.
    {
     touch_start( integer nd ) {
         while(nd)
         while ( nd ) { // For every detected touch,
        {
             if ( llDetectedKey( --nd ) == owner ) { // check if the clock's owner is touching it,
             if(llDetectedKey((--nd)) == llGetOwner())
                // and if the clock's face was touched,
            {
                if ( llDetectedLinkNumber( nd ) == 1 && !llDetectedTouchFace( nd ) ) {
                llSetTimerEvent(0.0);
                    vector UV = llDetectedTouchUV( nd ); // find out where the face was touched.
                if((offset += 3600) == ((integer)twelve))
                    if ( UV.x > 0.5 ) { // If the right side was touched,
                offset = 0;
                        tz += fifteen_minutes; // increase timezone by quarter of an hour.
                chimes = 0;
                    } else { // Otherwise,
                llSetTimerEvent(1.0);
                        tz -= fifteen_minutes; // decrease timezone by quarter of an hour.
                    }
                    if ( tz == twelve_hours ) { // If timezone equals +twelve hours,
                        tz = 0; // reset timezone to zero.
                    }
                    backToTheFuture(); // Make sure the timezone is positive.
                }
             }
             }
         }
         }
     }
     }
}</lsl>
    // Triggered at whatever interval was last set by a call to llSetTimerEvent().
    timer() {
        tick(); // Call the function that handles our ticks.
    }
}</syntaxhighlight>
 
=== One Prim Analog Clock ===
* 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_THIS, [
                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 //


{{Anchor|Shutter Door}}
key hour_hand = "5102a720-437d-9a59-1523-2bbd8d74ceea"; // PNG texture of an hour hand on a transparent background.
=== Shutter Door ( V2 ) ===
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>


=== Shutter Door ===
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.
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 ====
==== 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.
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.


<lsl>// V1 //
<syntaxhighlight lang="lsl2">// V2 //


default
default {
{
     state_entry() {
     state_entry()
         llSetLinkPrimitiveParamsFast( LINK_THIS, [ PRIM_NAME, "Shutter door",
    {
                                                  PRIM_DESC, "",
         llSetPrimitiveParams([7, <4.0, 6.0, 0.01>,
                                                  PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.375, 0.875, 0.0>, 0.0, ZERO_VECTOR, <1.0, 1.0, 0.0>, ZERO_VECTOR,
                              8, <0.0, 0.707107, -0.707107, 0.0>,
                                                  PRIM_SIZE, <4.0, 6.0, 0.01>,
                              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>,
                                                  PRIM_ROTATION, <0.0, 0.70711, -0.70711, 0.0>,
                              17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <6.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.570796,
                                                  PRIM_SLICE, <0.0, 1.0, 0.0>,
                              18, -1, <1.0, 1.0, 1.0>, 1.0,
                                                  PRIM_MATERIAL, PRIM_MATERIAL_METAL,
                              19, 0, 1, 13,
                                                  PRIM_PHYSICS, FALSE,
                              19, 1, 1, 0,
                                                  PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                              19, 2, 1, 0,
                                                  PRIM_PHANTOM, FALSE,
                              19, 3, 1, 0,
                                                  PRIM_TEMP_ON_REZ, FALSE,
                              19, 4, 1, 13,
                                                  PRIM_FLEXIBLE, FALSE, FALSE, 0.0, 0.0, 0.0, 0.0, ZERO_VECTOR,
                              19, 5, 1, 0,
                                                  PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,
                              19, 6, 1, 0,
                                                  PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <6.0, 1.0, 0.0>, ZERO_VECTOR, 1.570796,
                              25, -1, 0.02]);
                                                  PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
         llRemoveInventory(llGetScriptName()); // Self deleting script.
                                                  PRIM_BUMP_SHINY, 0, PRIM_SHINY_LOW, PRIM_BUMP_SIDING,
                                                  PRIM_BUMP_SHINY, 4, PRIM_SHINY_LOW, PRIM_BUMP_SIDING ] );
         llRemoveInventory( llGetScriptName() ); // Self deleting script.
     }
     }
}</lsl>
}</syntaxhighlight>


==== Shutter Script ====
==== Shutter Script ====
This script actually operates the door (by touch).
This script actually operates the door (by touch).


<lsl>// V2 //
<syntaxhighlight lang="lsl2">// V3 //


float delay = 10.0; // Seconds before auto closure. Set to zero to disable.
float delay = 10.0; // Seconds before auto closure. Set to zero to disable.
Line 883: Line 1,100:


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


integer open;
integer open;
float rot;
float rot;
float Y;
float Y;


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


default
default {
{
     state_entry() {
     state_entry()
         rot = 90.0 * DEG_TO_RAD;
    {
         rot = (90.0 * DEG_TO_RAD);
     }
     }
     touch_start(integer nd)
     touch_start( integer nd ) {
    {
         operateDoor( open = !open );
         OperateDoor((open = (!open)));
     }
     }
     timer()
     timer() {
    {
         operateDoor( open = FALSE );
         OperateDoor((open = 0));
     }
     }
}</lsl>
}</syntaxhighlight>}}
 
== More Scripts... ==
 
'''[[User:Fred_Gandt/Scripts| Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Continued_1| More Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Continued_2| Even More Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Continued_3| Even More More Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Continued_4| Even More More More Free Scripts]]''' (content constantly updating)
 
'''Even More More More More Free Scripts''' (this page)
 
'''[[User:Fred_Gandt/Scripts/Continued_6| Even More More More More More Free Scripts]]''' (content constantly updating)
 
'''[[User:Fred_Gandt/Scripts/Vehicles/Car| Car Type Land Vehicle Scripts]]''' (Working on it...)
 
If you have any comments about the content of this page please post them '''[[User_talk:Fred_Gandt/Scripts/Continued_5 | HERE]]'''

Latest revision as of 12:12, 25 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

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

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 //

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 //

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

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

  • 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

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

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

  • To change the timezone by touching the clock (not editing the script):
    • Touch the right sade of the face to increment the time by 15 minutes.
    • Touch the left side of the face to decrement the time by 15 minutes.
  • 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).
// V4 //

// The UUIDs of chime sounds at 4 different pitches.
key bell_b = "729a4e57-0628-f253-bb34-ec649b896b77";
key bell_e = "2cfd2002-abc9-f5eb-e137-1b2cc6c2f3bb";
key bell_f_sharp = "6b8f3015-c4c7-83d5-3429-2e1fd2ebd577";
key bell_g_sharp = "cdab652c-6488-2ead-7abc-c52351bef11d";

// Volume of chime. 1.0 is maximum.
float chime_volume = 1.0;

// Set to FALSE for no chimes.
integer chimes = TRUE;

// Set to FALSE for no quarterly chimes.
integer quarterly_chimes = TRUE;

// PDT. PST is -8.0 and 0.0 will be GMT/UTC.
float timezone = -7.0;

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

// Said to the owner if the object isn't built correctly.
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.";

// Used to store the link number's of the hands.
integer second_hand_link;
integer minute_hand_link;
integer hour_hand_link;

// A few numerical values that are repeatedly used.
integer twelve_hours = 43200;
integer one_hour = 3600;
integer fifteen_minutes = 900;

// Used to store the timezone offset converted to seconds.
integer tz;

// The full order in which the Westminster Quarters are played.
list westminster_quarters = [ bell_g_sharp, bell_f_sharp, bell_e, bell_b,
                              bell_e, bell_g_sharp, bell_f_sharp, bell_b,
                              bell_e, bell_f_sharp, bell_g_sharp, bell_e,
                              bell_g_sharp, bell_e, bell_f_sharp, bell_b,
                              bell_b, bell_f_sharp, bell_g_sharp, bell_e,
// Plus one null key used to rest between each part of each quarter.
                              NULL_KEY ];

// The seconds past each hour at which each quarter is played.
list quarters_lookup = [ fifteen_minutes, 1800, 2700, 3585 ];

// The parts of the Westminster Quarters to play each quarter.
list quarters_lookdown = [ "0, 1, 2, 3",
                           "4, 5, 6, 7, 20, 8, 9, 10, 11",
                           "12, 13, 14, 15, 20, 16, 17, 18, 19, 20, 0, 1, 2, 3",
                           "4, 5, 6, 7, 20, 8, 9, 10, 11, 20, 12, 13, 14, 15, 20, 16, 17, 18, 19" ];

// Used to remember the above parts when converted from strings to lists.
list quartermaster;

// Several variables used to monitor the flow of the Westminster Quarters.
integer tock;
integer qm_length;
integer westmindex;
integer current_quarter;
integer hung_drawn_and_quartered = FALSE;

// Used to store the owner's UUID.
key owner;

// Function to handle all chiming.
chime( integer secs ) {
    integer current_second = secs % one_hour; // Temporarily store the seconds past the hour,
    integer current_hour = secs / one_hour; // and the current hour.
    if ( quarterly_chimes ) { // If quarterly chimes are to be played,
        if ( hung_drawn_and_quartered ) { // and the necessary groundwork has been done,
            if ( westmindex < qm_length ) { // and we're supposed to be playing a sound:
                // Work out which sound we're supposed to be playing, based on the current data,
                key bell = llList2Key( westminster_quarters, llList2Integer( quartermaster, westmindex++ ) );
                if ( bell ) { // and if it's a bell sound, and not a rest,
                    llTriggerSound( bell, chime_volume ); // chime!
                }
            } else { // If we're not supposed to be playing a sound,
                hung_drawn_and_quartered = FALSE; // we must have finished this quarter,
                llSetTimerEvent( 1.0 ); // so go back to normal speed.
            }
        } else { // If the necessary groundwork has not been done:
            // Establish if we should be playing a quarter by comparing the current second
            current_quarter = llListFindList( quarters_lookup, [ current_second ] ); // to the seconds at each quarter.
            if ( ~current_quarter ) { // and if we should be playing a quarter:
                // Fetch the appropriate string of indexes, and convert it to a list,
                quartermaster = llCSV2List( llList2String( quarters_lookdown, current_quarter ) );
                qm_length = llGetListLength( quartermaster ); // establish how long that list is,
                hung_drawn_and_quartered = TRUE; // switch on our indicator that we should be playing quarters,
                westmindex = 0; // reset our counter,
                llSetTimerEvent( 0.5 ); // and speed up the clock's movement.
            }
        }
    }
    if ( current_second < current_hour ) { // If the current second is less than the current hour.
        llTriggerSound( bell_b, chime_volume ); // Chime!
    }
}

// Function called per timer event.
tick() {
    integer seconds = ( integer )llGetGMTclock() + tz; // Seconds equals seconds past midnight GMT/UTC plus timezone offset.
    // If the clock movement has been sped up to play the Westminster Quarters, only move the hands every other tick.
    if ( !hung_drawn_and_quartered || ( tock = !tock ) ) {
        if ( seconds > twelve_hours ) { // If it's past noon,
            seconds -= twelve_hours; // turn back time by twelve hours.
        }
        // Rotate all the hands to show the current time.
        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 ( chimes ) { // If we should be playing chimes,
        chime( seconds ); // call the chime function and tell it what the time is.
    }
}

// Function to convert a negative timezone into a positive one.
backToTheFuture() {
    if ( tz < 0 ) { // If tz is negative,
        tz += twelve_hours; // make it positive.
    }
}

default {
    // Triggered when many different things that affect the object or script are changed.
    changed( integer change ) {
        if ( change & ( CHANGED_LINK | CHANGED_OWNER ) ) {
            llResetScript(); // if the way the object is built or the owner has changed.
        }
    }
    // Triggered when we enter our parent state.
    state_entry() {
        owner = llGetOwner(); // Store the owner's UUID.
        integer nol = llGetObjectPrimCount( llGetKey() ); // Establish how many prims are in the object,
        if ( nol > 3 ) { // and if the object has at least four prims,
            string link_name; // use this to remember their names,
            while ( nol > 1 ) { // whilst 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; // Count backwards from the last link.
            }
            if ( hour_hand_link && minute_hand_link && second_hand_link ) { // If the object is built correctly:
                tz = ( integer )( timezone * one_hour ); // Convert timezone hours to seconds,
                backToTheFuture(); // Make sure the timezone is positive.
                llSetTimerEvent( 1.0 ); // Start the clock.
            } else { // Otherwise,
                llOwnerSay( build_advice ); // tell the owner what's wrong.
            }
        } else { // Otherwise,
            llOwnerSay( build_advice ); // tell the owner what's wrong.
        }
    }
    // Triggered when a touch (mouse click or menu selected) is started on the object containing this script.
    touch_start( integer nd ) {
        while ( nd ) { // For every detected touch,
            if ( llDetectedKey( --nd ) == owner ) { // check if the clock's owner is touching it,
                // and if the clock's face was touched,
                if ( llDetectedLinkNumber( nd ) == 1 && !llDetectedTouchFace( nd ) ) {
                    vector UV = llDetectedTouchUV( nd ); // find out where the face was touched.
                    if ( UV.x > 0.5 ) { // If the right side was touched,
                        tz += fifteen_minutes; // increase timezone by quarter of an hour.
                    } else { // Otherwise,
                        tz -= fifteen_minutes; // decrease timezone by quarter of an hour.
                    }
                    if ( tz == twelve_hours ) { // If timezone equals +twelve hours,
                        tz = 0; // reset timezone to zero.
                    }
                    backToTheFuture(); // Make sure the timezone is positive.
                }
            }
        }
    }
    // Triggered at whatever interval was last set by a call to llSetTimerEvent().
    timer() {
        tick(); // Call the function that handles our ticks.
    }
}

One Prim Analog Clock

  • 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_THIS, [
                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

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.

// V2 //

default {
    state_entry() {
        llSetLinkPrimitiveParamsFast( LINK_THIS, [ PRIM_NAME, "Shutter door",
                                                   PRIM_DESC, "",
                                                   PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.375, 0.875, 0.0>, 0.0, ZERO_VECTOR, <1.0, 1.0, 0.0>, ZERO_VECTOR,
                                                   PRIM_SIZE, <4.0, 6.0, 0.01>,
                                                   PRIM_ROTATION, <0.0, 0.70711, -0.70711, 0.0>,
                                                   PRIM_SLICE, <0.0, 1.0, 0.0>,
                                                   PRIM_MATERIAL, PRIM_MATERIAL_METAL,
                                                   PRIM_PHYSICS, FALSE,
                                                   PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM,
                                                   PRIM_PHANTOM, FALSE,
                                                   PRIM_TEMP_ON_REZ, FALSE,
                                                   PRIM_FLEXIBLE, FALSE, FALSE, 0.0, 0.0, 0.0, 0.0, ZERO_VECTOR,
                                                   PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,
                                                   PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <6.0, 1.0, 0.0>, ZERO_VECTOR, 1.570796,
                                                   PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
                                                   PRIM_BUMP_SHINY, 0, PRIM_SHINY_LOW, PRIM_BUMP_SIDING,
                                                   PRIM_BUMP_SHINY, 4, PRIM_SHINY_LOW, PRIM_BUMP_SIDING ] );
        llRemoveInventory( llGetScriptName() ); // Self deleting script.
    }
}

Shutter Script

This script actually operates the door (by touch).

// V3 //

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 scale = llGetScale();
    float y = scale.y;
    float f = 1.0;
    llTriggerSound( start, volume );
    llLoopSound( loop, volume );
    if ( i ) {
        Y = y;
        while ( y > speed ) {
            llSetLinkPrimitiveParamsFast( LINK_THIS, [ PRIM_SIZE, <scale.x, ( y -= speed ), scale.z>,
                                                       PRIM_TEXTURE, 4, texture, <y, 1.0, 0.0>, <( f -= ( speed / 2 ) ), 0.0, 0.0>, rot,
                                                       PRIM_TEXTURE, 0, texture, <y, 1.0, 0.0>, <-f, 0.0, 0.0>, rot ] );
            if ( f < ( -1.0 + ( speed / 2 ) ) ) {
                f = 1.0;
            }
        }
        llSetTimerEvent( delay );
    } else {
        llSetTimerEvent( 0.0 );
        f = 0.0;
        while ( y < Y ) {
            llSetLinkPrimitiveParamsFast( LINK_THIS, [ PRIM_SIZE, <scale.x, ( y += speed ), scale.z>,
                                                       PRIM_TEXTURE, 4, texture, <y, 1.0, 0.0>, <( f += ( speed / 2 ) ), 0.0, 0.0>, rot,
                                                       PRIM_TEXTURE, 0, texture, <y, 1.0, 0.0>, <-f, 0.0, 0.0>, rot ] );
            if ( f > ( 1 - ( speed / 2 ) ) ) {
                f = 0.0;
            }
        }
    }
    llPlaySound( end, volume );
}

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

More Scripts...

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