User:Cherry Hainsworth

From Second Life Wiki
Jump to: navigation, search

Still figuring out how to work this Wiki.

My Example contribution:

<lsl> // Textures the prims in a linked set with their link numbers or face numbers. // Cherry Hainsworth, January 2008 // Free to copy.

integer listenkey; integer LinkNumber;

string nought = "05fff99d-c061-f4bc-3a73-794e4c764e71"; string one = "1589a23c-47a0-9326-b43e-971e21d27f54"; string two = "6015e61e-7f4b-1fc6-e92e-dd7f8737192d"; string three = "1f4c3534-8116-1b5f-1db0-455ade42d044"; string four = "138a986d-f1ef-a995-26b4-ec3014d613c3"; string five = "ba243aec-2f16-83a5-be6b-0ec45c735b31"; string six = "76ea1ef0-a78b-934f-4f74-f7eb3401ed6c"; string seven = "8fc340ec-398a-baa0-4e25-03ca1b7b909a"; string eight = "4dbffb7c-05b1-cd76-59d9-0bfeac4fd495"; string nine = "d02525d2-c17a-7f4f-9eb2-9cb24e53e262";


// ----------------------------------------------------

//function // ---------------------------------------------------- nameFaces() {

   llSetLinkColor(LINK_SET, <1.0,1.0,1.0>, ALL_SIDES);
   llSetLinkTexture(LINK_SET, nought, 0);
   llSetLinkTexture(LINK_SET, one, 1);
   llSetLinkTexture(LINK_SET, two, 2);
   llSetLinkTexture(LINK_SET, three, 3);
   llSetLinkTexture(LINK_SET, four, 4);
   llSetLinkTexture(LINK_SET, five, 5);
   llSetLinkTexture(LINK_SET, six, 6);
   llSetLinkTexture(LINK_SET, seven, 7);
   llSetLinkTexture(LINK_SET, eight, 8);
   llSetLinkTexture(LINK_SET, nine, 9);

} // ----------------------------------------------------

//function // ---------------------------------------------------- numberLinks() {

   LinkNumber = llGetLinkNumber();
   llSetLinkPrimitiveParams(LINK_SET, [PRIM_COLOR, ALL_SIDES, <1.0,1.0,0.0>, 1.0]);
   llSetLinkTexture(0, nought, ALL_SIDES);
   llSetLinkTexture(1, one, ALL_SIDES);
   llSetLinkTexture(2, two, ALL_SIDES);
   llSetLinkTexture(3, three, ALL_SIDES);
   llSetLinkTexture(4, four, ALL_SIDES);
   llSetLinkTexture(5, five, ALL_SIDES);
   llSetLinkTexture(6, six, ALL_SIDES);
   llSetLinkTexture(7, seven, ALL_SIDES);
   llSetLinkTexture(8, eight, ALL_SIDES);
   llSetLinkTexture(9, nine, ALL_SIDES);

}

// ----------------------------------------------------


default{

   touch_start( integer num )
   {
       if ( llDetectedKey(0) == llGetOwner() )
       {
           // dialog ~ Create random channel within range [-1000000000,-2000000000]
           integer channel = (integer)(llFrand(-1000000000.0) - 1000000000.0);

listenkey = llListen( channel, "", llGetOwner(), "" );

           llSetTimerEvent(60);
           llDialog( llDetectedKey(0), "Number Linked Prims :",
               [ "Name Faces", "Link Numbers" ], channel );
       }
   }
   timer()
   {
       llListenRemove( listenkey );
       llSetTimerEvent( 0 );
   }
   listen ( integer channel, string name, key id, string message )
   {
       llListenRemove( listenkey );
       if ( message == "Name Faces" )
       {
           llMessageLinked( LINK_SET, 0 , "Name Faces" , NULL_KEY );
           nameFaces();
       }
       else if ( message == "Link Numbers" )
       {
           llMessageLinked( LINK_SET, 0 , "Link Numbers" , NULL_KEY );
           numberLinks();
       }
   }

} </lsl>