User:Fred Gandt/Scripts/Continued 5

From Second Life Wiki
< User:Fred Gandt‎ | Scripts
Revision as of 14:19, 11 July 2010 by Fred Gandt (talk | contribs) (→‎Shutter Door ( V1 ): Minor improvement. will do for now)
Jump to navigation Jump to search
FG jpg.jpg

My Contributions

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 HERE

All my scripts are written for compilation as MONO

More Pages

Direct Links To All Individual Scripts

Free Scripts (content constantly updating)

More Free Scripts (content constantly updating)

Even More Free Scripts (content constantly updating)

Even More More Free Scripts (content constantly updating)

Even More More More Free Scripts (content constantly updating)

Even More More More More Free Scripts (this page)

Functions For Specific Tasks

Legal Stuff

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

PJIRA Issue Tracker

The issues I have filed on the PJIRA

Tuition

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

Free Scripts

Prim Property Scrubber ( V2 )

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

<lsl>// 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();
   }

}</lsl>

Basic Notecard Readers

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

Cyclically Sequential Lines ( V1 )

<lsl>// 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);
   }

}</lsl>

Random Lines ( V1 )

<lsl>// 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)))));
   }

}</lsl>

CamHUD ( V1 )

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

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

The usefulness of this is up to you to decide.

Create the Object

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

<lsl>// 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.
   }

}</lsl>

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.

<lsl>// 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]);
       }
   }

}</lsl>

Simple Profit Share Vendor ( V1 )

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

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

<lsl>// 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$"));
       }
   }

}</lsl>

Preloading Texture Displayer ( V1 )

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

<lsl>// 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);
           }
       }
   }

}</lsl>

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.

  • 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.
  • The second script runs the clock.

Clock Maker

  • Create a link_set of 6 prims.
  • Drop this script on it.
  • When it has run, open an edit on the object and check the "Edit Linked Parts" checkbox.
  • Select the clear dome covering the face and path cut it to give easier editing access to the hands.
  • Select each hand one at a time and set the slice parameter to B : 0.400 E : 0.600
  • 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.

<lsl>// V2 //

default {

   state_entry()
   {
       if(llGetObjectPrimCount(llGetKey()) == 6)
       {
           llSetLinkPrimitiveParamsFast(1, [5,1,7,<1.0, 1.0, 0.02>,
                                            8,<0.0, 0.0, 0.0, 1.0>,
                                            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>,
                                            17,0,"ecf785e7-4cf6-9f95-6292-40061bdddeed",<0.7, 0.7, 0.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,
                                            17,2,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                                            17,3,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                                            17,4,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                                            17,5,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                                            18,-1,<0.6745, 0.6745, 0.7255>,1.0,
                                            19,0,3,1,
                                            19,1,3,0,
                                            19,2,3,0,
                                            19,3,3,0,
                                            19,4,3,0,
                                            19,5,3,0,
                                            20,0,1,
                                            20,1,0,
                                            20,2,0,
                                            20,3,0,
                                            20,4,0,
                                            20,5,1,
                                            25,-1,0.012]);
           llSetLinkPrimitiveParamsFast(2, [6, <0.0,0.0,0.01>, 7,<0.16, 0.91, 0.91>,
                                            8,<0.0, 0.707107, 0.0, 0.707107>,
                                            9,3,0,<0.0, 1.0, 0.0>,0.0,<0.0, 0.0, 0.0>,<0.5, 1.0, 0.0>,
                                            17,-1,"e97cf410-8e61-7005-ec06-629eba4cd1fb",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                                            18,-1,<1.0, 1.0, 1.0>,1.0,
                                            19,-1,2,0]);
           llSetLinkPrimitiveParamsFast(3, [6, <0.0,0.0,0.02>, 7,<0.04, 0.6, 0.02>,
                                            8,<0.0, 0.0, 0.0, 1.0>,
                                            9,0,0,<0.375, 0.875, 0.0>,0.0,<0.0, 0.0, 0.0>,<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,
                                            17,-1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                                            18,-1,<0.0, 0.0, 0.0>,1.0,
                                            19,-1,1,0,
                                            25,-1,0.012]);
           llSetLinkPrimitiveParamsFast(4, [6, <0.0,0.0,0.06>, 7,<0.02, 0.4, 0.02>,
                                            8,<0.0, 0.0, 0.0, 1.0>,
                                            9,0,0,<0.375, 0.875, 0.0>,0.0,<0.0, 0.0, 0.0>,<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,
                                            17,-1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                                            18,-1,<0.5, 0.0, 0.0>,1.0,
                                            19,-1,1,0,
                                            25,-1,0.012]);
           llSetLinkPrimitiveParamsFast(5, [6, <0.0,0.0,0.04>, 7,<0.02, 0.8, 0.02>,
                                            8,<0.0, 0.0, 0.0, 1.0>,
                                            9,0,0,<0.375, 0.875, 0.0>,0.0,<0.0, 0.0, 0.0>,<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,
                                            17,-1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,0.0,
                                            18,-1,<0.0, 0.0, 0.0>,1.0,
                                            19,-1,1,0,
                                            25,-1,0.012]);
           llSetLinkPrimitiveParamsFast(6, [6, <0.0,0.0,0.01>, 7,<0.12, 0.06, 0.06>,
                                            8,<0.0, 0.707107, 0.0, 0.707107>,
                                            9,3,0,<0.0, 1.0, 0.0>,0.0,<0.0, 0.0, 0.0>,<0.5, 1.0, 0.0>,
                                            17,-1,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0, 1.0, 0.0>,<0.25, 0.0, 0.0>,0.0,
                                            18,-1,<0.675, 0.675, 0.7255>,1.0,
                                            19,0,3,0,19,1,3,0,19,2,3,0,
                                            25,-1,0.012]);
           llSetLinkPrimitiveParamsFast(1, [8,<0.707107, 0.0, 0.0, 0.707107>]);
           llRemoveInventory(llGetScriptName());
       }
       else
       llOwnerSay("Read the instructions");
   }

}</lsl>

Clock Movement

  • Drop this script onto the clock object.
  • As soon as the script runs it will start displaying the time GMT.
  • 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 //

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

float volume = 1.0; // Volume of chime.

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

integer second_hand_link;

integer minute_hand_link;

integer hour_hand_link;

float twelve = 43200.0;

integer last = -1;

integer offset;

integer chimes;

integer hour;

default {

   on_rez(integer param)
   {
       llResetScript();
   }
   changed(integer change)
   {
       if(change & CHANGED_LINK)
       llResetScript();
   }
   state_entry()
   {
       integer nol = (llGetObjectPrimCount(llGetKey()) + 1);
       string link_name = "";
       while(--nol)
       {
           if((link_name = llGetLinkName(nol)) == "Second Hand")
           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()
   {
       float seconds = (llGetGMTclock() + ((float)offset));
       rotation root_rot = llGetRootRotation();
       llSetLinkPrimitiveParamsFast(second_hand_link, [8, (llEuler2Rot(<0.0,0.0,(seconds * -6.0)> * DEG_TO_RAD) / root_rot)]);
       llSetLinkPrimitiveParamsFast(minute_hand_link, [8, (llEuler2Rot(<0.0,0.0,(seconds * -0.1)> * DEG_TO_RAD) / root_rot)]);
       llSetLinkPrimitiveParamsFast(hour_hand_link, [8, (llEuler2Rot(<0.0,0.0,(seconds * -0.008333)> * DEG_TO_RAD) / root_rot)]);
       if(chime)
       {
           if((!chimes))
           {
               if(seconds > twelve)
               {
                   if((seconds -= twelve) > twelve)
                   seconds -= twelve;
               }
               if((hour = llFloor((seconds / 3600.0))) != last)
               {
                   last = hour;
                   if((!hour))
                   hour = 12;
                   chimes = hour;
               }
           }
           if(chimes)
           {
               llPlaySound(chime, volume);
               --chimes;
           }
       }
   }
   touch_start(integer nd)
   {
       while(nd)
       {
           if(llDetectedKey((--nd)) == llGetOwner())
           {
               llSetTimerEvent(0.0);
               if((offset += 3600) == ((integer)twelve))
               offset = 0;
               chimes = 0;
               llSetTimerEvent(1.0);
           }
       }
   }

}</lsl>

Shutter Door ( V2 )

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

Create Basic Shutter

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

<lsl>// V1 //

default {

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

}</lsl>

Shutter Script

This script actually operates the door (by touch).

<lsl>// V2 //

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

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

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

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

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

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

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

integer open;

float rot;

float Y;

OperateDoor(integer i) {

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

}

default {

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

}</lsl>

More Scripts...

Free Scripts (content constantly updating)

More Free Scripts (content constantly updating)

Even More Free Scripts (content constantly updating)

Even More More Free Scripts (content constantly updating)

Even More More More Free Scripts (content constantly updating)

Even More More More More Free Scripts (this page)

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