salahzar

Automatic_GIF_to_SL_script Ferd

Apr 13th, 2014
258
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // :CATEGORY:Special Effects
  2. // :NAME:Automatic_GIF_to_SL_script
  3. // :AUTHOR:Ferd Frederix
  4. // :KEYWORDS:
  5. // :CREATED:2011-06-21 20:30:18.273
  6. // :EDITED:2014-02-07 19:09:12
  7. // :ID:67
  8. // :NUM:94
  9. // :REV:1.0
  10. // :WORLD:Second Life
  11. // :DESCRIPTION:
  12. // DESCRIPTION: Automatic_GIF_to_SL_script
  13. // :CODE:
  14. // Put any texture converted by gif_2_SL_animation_v0.6.exe into a prim with this script to get it to play back automatically as a movie
  15.  
  16.  
  17.  
  18.  
  19.  
  20. integer animOn = TRUE; //Set to FALSE and call initAnim() again to stop the animation.
  21.  
  22. //Effect parameters: (can be put in list together, to make animation have all of said effects)
  23.  
  24. //LOOP - loops the animation
  25.  
  26. //SMOOTH - plays animation smoothly
  27.  
  28. //REVERSE - plays animation in reverse
  29.  
  30. //PING_PONG - plays animation in one direction, then cycles in the opposite direction
  31.  
  32. list effects = [LOOP];  // LOOP for GIF89 movies
  33.  
  34. //Movement parameters (choose one):
  35.  
  36. //ROTATE - Rotates the texture
  37.  
  38. //SCALE - Scales the texture
  39.  
  40. //Set movement to 0 to slide animation in the X direction, without any special movement.
  41.  
  42. integer movement = 0;
  43.  
  44. integer face = ALL_SIDES; //Number representing the side to activate the animation on.
  45.  
  46. integer sideX = 1; //Represents how many horizontal images (frames) are contained in your texture.
  47.  
  48. integer sideY = 1; //Same as sideX, except represents vertical images (frames).
  49.  
  50. float start = 0.0; //Frame to start animation on. (0 to start at the first frame of the texture)
  51.  
  52. float length = 0.0; //Number of frames to animate, set to 0 to animate all frames.
  53.  
  54. float speed = 10.0; //Frames per second to play.
  55.  
  56. initAnim() //Call this when you want to change something in the texture animation.
  57.  
  58. {
  59.  
  60.     if(animOn)
  61.  
  62.     {
  63.  
  64.         integer effectBits;
  65.  
  66.         integer i;
  67.  
  68.         for(i = 0; i < llGetListLength(effects); i++)
  69.  
  70.         {
  71.  
  72.             effectBits = (effectBits | llList2Integer(effects,i));
  73.  
  74.         }
  75.  
  76.         integer params = (effectBits|movement);
  77.  
  78.         llSetTextureAnim(ANIM_ON|params,face,sideX,sideY,     start,length,speed);
  79.  
  80.     }
  81.  
  82.     else
  83.  
  84.     {
  85.  
  86.         llSetTextureAnim(0,face,sideX,sideY, start,length,speed);
  87.  
  88.     }
  89.  
  90. }
  91.  
  92.  
  93.  
  94. fetch()
  95.  
  96. {
  97.  
  98.      string texture = llGetInventoryName(INVENTORY_TEXTURE,0);
  99.  
  100.             llSetTexture(texture,ALL_SIDES);
  101.  
  102.             list data  = llParseString2List(texture,[";"],[]);
  103.  
  104.             llOwnerSay( llDumpList2String(data ,","));
  105.  
  106.             string X = llList2String(data,1);
  107.  
  108.             string Y = llList2String(data,2);
  109.  
  110.             string Z = llList2String(data,3);
  111.  
  112.            
  113.  
  114.             // llOwnerSay("X=" + X + " Y=" + Y + " Z = " + (string) Z);
  115.  
  116.            
  117.  
  118.             sideX = (integer) X;
  119.  
  120.             sideY = (integer) Y;
  121.  
  122.             speed = (float) Z;
  123.  
  124.             if (speed)
  125.  
  126.                 initAnim();
  127.  
  128. }
  129.  
  130.  
  131.  
  132. default
  133.  
  134. {
  135.  
  136.     state_entry()
  137.  
  138.     {
  139.  
  140.         fetch();
  141.  
  142.     }
  143.  
  144.     changed(integer what)
  145.  
  146.     {
  147.  
  148.         if (what & CHANGED_INVENTORY)
  149.  
  150.         {
  151.  
  152.             fetch();
  153.  
  154.         }
  155.  
  156.     }
  157.  
  158. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×