Advertisement
Gayngel

Links by primname

Apr 13th, 2018 (edited)
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer x; // the for loop counter. gets the link number of the prim in the linkset
  2. integer mesh; // a variable to store the link in the linkset
  3. integer mesh2; // a variable to store the link in the linkset
  4. integer switch; // a variable to store the link in the linkset
  5. integer allsides; // a variable to store the link in the linkset
  6. integer detach; // a variable to store the link in the linkset
  7. string primname;  // the name of the prim in the linkset
  8.  
  9. default
  10. {
  11.  
  12.     on_rez(integer start_param)
  13.     {
  14.  
  15.      llResetScript();
  16.  
  17.     }
  18.  
  19.     state_entry()
  20.     {
  21.  
  22.     integer total = llGetNumberOfPrims(); // gets the total number of prims in the linkset.
  23.    
  24.     for(x = 0; x < total; ++x)  // start at link 0 do the below process. Check the next link of the linkset and de the below process until all prims in the linkset are checked and processed.
  25.       {
  26.  
  27.  
  28.           primname = llToLower(llGetLinkName(x)); // get the name of the link in the linkset
  29.  
  30.           if(primname == "mesh")
  31.             {
  32.           mesh = x;   // if the name of the current prim being dealt with is called "mesh" set the mesh variable to the counter/link number.
  33.          
  34.             }
  35.           else if(primname == "mesh2")
  36.           {
  37.           mesh2 = x; // or if the name of the current prim being dealt with is called "mesh2" set the mesh2 variable to the counter/link number.
  38.          
  39.           }
  40.           else if (primname == "switch")
  41.           {
  42.           switch = x; // or if the name of the current prim being dealt with is called "switch" set the switch variable to the counter/link number.
  43.           }
  44.  
  45.  
  46.           else if(primname == "all sides")
  47.           {
  48.           allsides = x;  // etc
  49.           }
  50.  
  51.           else if(primname == "detach")
  52.           {
  53.           detach = x; //etc
  54.           }
  55.  
  56.         }
  57.        
  58.     }
  59.  
  60.     touch_end(integer num)
  61.     {
  62.        
  63.         integer link = llDetectedLinkNumber(0); // check the link number of the prim touched.
  64.        
  65.         if(link == mesh)
  66.         {
  67.            // if the link touched is the same as the stored variable "mesh" do this
  68.         }
  69.  
  70.         else if(link == mesh2)
  71.         {
  72.             // if the link touched is the same as the stored variable "mesh2" do that
  73.         }
  74.  
  75.         else if(link == switch)
  76.         {
  77.             // if the link touched is the same as the stored variable "switch" do this thing
  78.         }
  79.  
  80.         else if(link == allsides)
  81.         {
  82.             //etc
  83.            // Do that thing
  84.         }
  85.  
  86.         else if(link == detach)
  87.         {
  88.             //etc
  89.            // Do the next thing
  90.         }
  91.  
  92.     }
  93.  
  94. changed(integer change)
  95.     {
  96.         if (change & CHANGED_OWNER | CHANGED_INVENTORY|CHANGED_LINK) // if the owner changes or another link is added to the prim set.
  97.         llResetScript();
  98.     }
  99.  
  100. }
  101.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement