Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
1,402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. // Example
  2. // /2 curtain state1 - Will turn on all prims named "state1", and turn off all others not named "ignore"
  3.  
  4.  
  5. string IGNORE_STRING = "ignore"; // Name a prim this for it to be ignored.
  6. integer CHANNEL = 2;
  7. string CMD = "body";
  8.  
  9. //GAB NOTE for every part of the body you want to be toggleable add an integer with an appropriate name, no spaces allowed (E.G. "integer leftboob")
  10. integer head;
  11. integer torso;
  12. integer legs;
  13.  
  14. default
  15. {
  16. state_entry()
  17. {
  18. llListen(CHANNEL, "", "", "");
  19. }
  20.  
  21. listen(integer channel, string name, key id, string msg)
  22. {
  23. // Since we are not listening for our owner specifically, check to see if
  24. // the owner of the object speaking, is our owner. Used to allow HUDs.
  25. if( llGetOwnerKey(id) == llGetOwner() )
  26. {
  27. msg = llToLower(msg);
  28. // Cut the message into pieces at the spaces.
  29. list args = llParseString2List(msg, [" "], []);
  30.  
  31. string cmd = llList2String(args, 0);
  32. string arg = llList2String(args, 1);
  33. integer facenum = llList2Integer(args, 2);
  34.  
  35. // Check to see if the command's what we want.
  36. if(cmd == CMD)
  37. {
  38. // It is! Loop through every prim in the object.
  39. integer prims = llGetNumberOfPrims()+1;
  40. while(--prims > 1)
  41. {
  42.  
  43. string check = llGetLinkName(prims);
  44.  
  45. // And then check to see if it matches, and also check to see if the
  46. // This will be true if the ignore string isn't found in the prim name
  47. if(llSubStringIndex(check, IGNORE_STRING) == -1)
  48. {
  49. // This will be true if we find what we're looking for.
  50. if(check == arg){
  51. //the following chunk of code can be copied and pasted as many times as you want, once
  52. //for each face to be made invisible, just change the 4 places where it says "head", don't
  53. //mess with "facenum", it's what lets you specify which face of the object you're toggling
  54. /*
  55. if(arg == "head"){
  56. if(head){
  57. head = 0;
  58. llSetLinkAlpha(prims, 0.0, facenum);
  59. }
  60. else{
  61. head =1;
  62. llSetLinkAlpha(prims, 1.0, facenum);
  63. }
  64. }
  65. */
  66. if(arg == "head"){
  67. if(head){
  68. head = 0;
  69. llSetLinkAlpha(prims, 0.0, facenum);
  70. }
  71. else{
  72. head =1;
  73. llSetLinkAlpha(prims, 1.0, facenum);
  74. }
  75. }
  76. else if(arg == "torso"){
  77. if(torso){
  78. torso = 0;
  79. llSetLinkAlpha(prims, 0.0, facenum);
  80. }
  81. else{
  82. torso =1;
  83. llSetLinkAlpha(prims, 1.0, facenum);
  84. }
  85. }
  86. if(arg == "legs"){
  87. if(legs){
  88. legs = 0;
  89. llSetLinkAlpha(prims, 0.0, facenum);
  90. }
  91. else{
  92. legs =1;
  93. llSetLinkAlpha(prims, 1.0, facenum);
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement