User:Kerik Rau/Simple Slide Show

From Second Life Wiki
Jump to navigation Jump to search

Dumb slide show: simply rez a cube, throw in the script and textures and instant slide show. Ya, boring isn't it?

<lsl> integer Face = 2; float Delay = 25.0;

list Textures; integer TextureNum;

BuildDB() {

   Textures = [];
   integer NumTextures = llGetInventoryNumber(INVENTORY_TEXTURE);
   
   while(NumTextures--)
       Textures += llGetInventoryName(INVENTORY_TEXTURE, NumTextures);
       
   llOwnerSay("Loaded Textures: " + llDumpList2String(Textures, ", "));

}

default {

   state_entry()
   {
       BuildDB();
       llSetTimerEvent(Delay);
   }
   
   changed(integer change)
   {
       if(change & CHANGED_INVENTORY)
           BuildDB();   
   }
   
   timer()
   {
       llSetTexture(llList2String(Textures, TextureNum), Face);
       
       if(++TextureNum >= llGetListLength(Textures))
           TextureNum = 0;
   }

} </lsl>