Advertisement
Bugs_Larnia

LSL: Linked Texture Changer

Mar 1st, 2021
1,308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Linked Texture Changer
  2. Created 2020-07-01 by Bugs Larnia
  3. Please keep anotations
  4. */
  5.  
  6. //USER SETTINGS
  7. integer giTexturePrimNo = LINK_ALL_OTHERS;
  8. integer giTextureFaceNo = ALL_SIDES;
  9.  
  10. //Enter your texture keys in this list, separated by commas
  11. list glTextures =
  12. [
  13.     "a11c5aeb-5ec9-7178-2fb3-efc7347c18c5",
  14.     "7f4fd01d-08b6-ff8b-b0dc-2d785d3c9cb4",
  15.     "4045f426-4893-59be-c496-ffd471e1267e"
  16. ];
  17. //END USER SETTINGS
  18.  
  19. integer giIndex;
  20.  
  21. Init()
  22. {
  23.     if (GetImageCount() == 0)
  24.     {
  25.         return;
  26.     }
  27.     ResetIndex();
  28.     ShowImage();  
  29. }
  30.  
  31. ShowNextImage()
  32. {
  33.     integer iCount = GetImageCount();
  34.     if (iCount == 0)
  35.     {
  36.         return;
  37.     }
  38.     if (++giIndex >= iCount)
  39.     {
  40.         ResetIndex();
  41.     }    
  42.     ShowImage();
  43. }
  44.  
  45. ShowImage()
  46. {
  47.     llSetLinkTexture(giTexturePrimNo, llList2Key(glTextures, giIndex), giTextureFaceNo);
  48. }
  49.  
  50. integer GetImageCount()
  51. {
  52.     return llGetListLength(glTextures);
  53. }
  54.  
  55. ResetIndex()
  56. {
  57.     giIndex = 0;
  58. }
  59.  
  60. default
  61. {
  62.     state_entry()
  63.     {
  64.         Init();
  65.     }
  66.  
  67.     touch_start(integer piNum)
  68.     {
  69.         ShowNextImage();
  70.     }
  71.    
  72.     on_rez(integer piParam)
  73.     {
  74.         llResetScript();
  75.     }
  76. }
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement