Advertisement
Edie_Shoreland

Simple image changing frame

Feb 17th, 2019
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Roz's Single Prim Autoframe Image Swapper Script
  2.  
  3. float change = 20.0; //Number of seconds before image changes.
  4.  
  5. // Create a box.  Put the photos and textures you'd like to display
  6. // with your frame inside the box's inventory.  Once all photos are
  7. // in the box's inventory, create a new script, cut and paste this
  8. // information to the script and put it in the box's inventory.
  9.  
  10. // Once the script is running, the prim can be resized and edited
  11.  
  12. // CAUTION: THIS SCRIPT WILL AUTOMATICALLY CHANGE THE SHAPE, SIZE AND
  13. // TEXTURE OF THE PRIM YOU PLACE IT IN.
  14.  
  15. list frames = ["a25bebc8-4739-453d-d44e-fc522cf95488","c58be669-fd49-8a07-7836-4c97a4a4058c","a0ce8c4d-74d1-a38c-53c0-0819c24b32b4","8ab138f4-248a-3884-a1de-e4124032c18c"];
  16. string image;
  17. integer toggle;
  18. integer next;
  19. integer photos;
  20.  
  21. default
  22. {
  23.     state_entry()
  24.     {
  25.         llSetTimerEvent(change);
  26.         photos = llGetInventoryNumber(INVENTORY_TEXTURE);
  27.         next = photos - 1;
  28.  
  29.         //Q: Roz, where did that hideously ugly frame come from?
  30.         //A: From right here...
  31.         llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_BOX,PRIM_HOLE_SQUARE,<0.0,1.0,0.0>,0.0,ZERO_VECTOR,<0.8,0.8,0.0>,ZERO_VECTOR,PRIM_SIZE,<0.5,0.5,0.015>,PRIM_TEXTURE,ALL_SIDES,llList2Key(frames,(integer)llFrand(4)),<1.0,1.0,0.0>,ZERO_VECTOR,0.0,PRIM_TEXTURE,5,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0,1.0,0.0>,ZERO_VECTOR,0.0,PRIM_TEXTURE,0,llGetInventoryName(INVENTORY_TEXTURE, next),<1.0,1.0,0.0>,ZERO_VECTOR,0.0]);
  32.         //So yes, sure the frame is pretty ugly, but you can always
  33.         //link your image swapping prim to a much nicer frame later
  34.         //on, right?
  35.     }
  36.    
  37.     timer()
  38.     {  
  39.         next++;
  40.         if (next >= photos) next = 0;
  41.         llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, next), 0);
  42.     }
  43.  
  44.     //Q: Roz, what if I'd like to just display an image without it
  45.     //   changing every 20 seconds or so?
  46.     //A: Touch the prim to stop the images from cycling, touch it
  47.     //   again to restart the cycle.
  48.     touch_start(integer total_photos)
  49.     {
  50.         toggle = !toggle;
  51.         if (toggle == TRUE) llSetTimerEvent(0.0);
  52.         else llSetTimerEvent(change);
  53.     }
  54.  
  55.     //Q: But Roz, what if I want to add more pictures to my frame
  56.     //   later on?
  57.     //A: Here you go...
  58.     changed(integer change)
  59.     {
  60.         if (change & CHANGED_INVENTORY) photos = llGetInventoryNumber(INVENTORY_TEXTURE);
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement