Difference between revisions of "User:Kephra Nurmi/lsDisplay"

From Second Life Wiki
Jump to: navigation, search
(Created page with 'The simple lsDisplay is a random picture cycler with a preloader on the inside of the prim. Just drop the script into a prim, resize X, and drop your pictures into the prims cont...')
(No difference)

Revision as of 12:55, 9 August 2009

The simple lsDisplay is a random picture cycler with a preloader on the inside of the prim. Just drop the script into a prim, resize X, and drop your pictures into the prims content.

Script .lsDisplay simple 09221

<lsl> // .lsDisplay simple 09221 (c) Kephra Nurmi 2007 // published under Creative Commons Attribution-Share Alike 3.0 License

string name = "";

tick() {

   if (name != "") {
       llSetTexture(name, 1);
       llSetTexture(name, 3);
   }
   integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
   if (!number) return;
   float rand = llFrand(number);
   integer choice = (integer)rand;
   name = llGetInventoryName(INVENTORY_TEXTURE, choice);
   if (name != "") llSetTexture(name, 5);

}

reshape() {

   vector size = llGetScale();
   llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_SQUARE, <0.0, 1.0, 0.0>, 0.95, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);
   llSetScale(<size.x, 0.01, size.x*2/3>);
   llSetTexture(TEXTURE_BLANK, ALL_SIDES);

}

default {

   state_entry() {
       reshape();
       llSetText("", <0,1,0>,1);
       tick();
       tick();
       llSetTimerEvent(60.0);
   }
   timer() {
       tick();
   }
   changed(integer change) {
       if (change & CHANGED_SCALE) reshape();
       if (change & CHANGED_INVENTORY) tick();
   }

} </lsl>