ArchipelisBase.lsl 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // :CATEGORY:Prim Animator
  2. // :NAME:Archipelis scripts for prim animator
  3. // :AUTHOR:Ferd Frederix
  4. // :CREATED:2013-09-06
  5. // :EDITED:2013-09-18 15:38:48
  6. // :ID:52
  7. // :NUM:76
  8. // :REV:1
  9. // :WORLD:Second Life
  10. // :DESCRIPTION:
  11. // Archipelis script to replace the buggy one that comes with Archipelis 2.0.
  12. // It removes the extra images, leaving behind the one that is needed, and removes itself after making the Archipelis prims
  13. // :CODE:
  14. // With the courtesy of BestMomo Lagan.
  15. // remove extra textures, script, and allow re-linked prim animation by Ferd Frederix
  16. string generate_index(integer i)
  17. {
  18. if (i < 10)
  19. return "0" + (string)i;
  20. return (string)i;
  21. }
  22. // remove all textures except the one on this prim.
  23. clean(string index)
  24. {
  25. string texture = "texture_" + index;
  26. string geometry = "geometry_" + index;
  27. integer j = llGetInventoryNumber(INVENTORY_TEXTURE);
  28. integer i;
  29. for (i=0; i<j; i++)
  30. {
  31. string inventory = llGetInventoryName(INVENTORY_TEXTURE,i);
  32. if ( inventory != texture && inventory != geometry)
  33. llRemoveInventory(inventory);
  34. }
  35. llSetObjectName(index); // rename to allow re-linkable prim animation
  36. llRemoveInventory(llGetScriptName()); // delete this script, too
  37. }
  38. default
  39. {
  40. on_rez(integer start_param)
  41. {
  42. if (start_param == 0)
  43. return;
  44. string message = (string)start_param;
  45. integer message_size = llStringLength(message);
  46. string index;
  47. string the_scale;
  48. if (message_size == 9)
  49. {
  50. index = llGetSubString(message, 0, 1);
  51. the_scale = "0." + llGetSubString(message, 2, 8);
  52. }
  53. else if (message_size == 8)
  54. {
  55. index = "0" + llGetSubString(message, 0, 0);
  56. the_scale = "." + llGetSubString(message, 1, 7);
  57. }
  58. else
  59. {
  60. index = "00";
  61. the_scale = "." + llGetSubString(message, 0, 6);
  62. }
  63. index = generate_index(((integer)index) - 1);
  64. rotation the_rotation = llEuler2Rot(<90.0 * DEG_TO_RAD, .0, .0>);
  65. llSetRot(the_rotation);
  66. float the_scale_value = (float)the_scale * 2.0 * 10.0;
  67. llSetScale(<the_scale_value, the_scale_value, the_scale_value>);
  68. string geometry = "geometry_" + index;
  69. llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, geometry, PRIM_SCULPT_TYPE_SPHERE]);
  70. string texture = "texture_" + index;
  71. if(llGetInventoryType(texture) != INVENTORY_NONE)
  72. llSetTexture(texture, ALL_SIDES);
  73. clean(index); // remove all but the necessary textures
  74. }
  75. }