Advertisement
Dorex

Linked Prim ID by Name

Feb 8th, 2016
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //#########################################################################################################
  2. //
  3. // return a link number by finding a prim with a given name
  4. // will only return the link number of the first matching name
  5. // returns -1 if the name is not found
  6. //
  7. //#########################################################################################################
  8. //
  9. integer getSingleLinkedPrimByName(string name)
  10. {
  11.     integer index=0;
  12.     while(index<=llGetNumberOfPrims()){
  13.         if (llGetLinkName(index)==name){
  14.             return index;
  15.         }
  16.         index++;
  17.     }
  18.     return -1;
  19. }
  20.  
  21. //#########################################################################################################
  22. //
  23. // return all link numbers for prims with a given name
  24. // will only return the link number of the first matching name
  25. // returns an empty list if the name is not found
  26. //
  27. //#########################################################################################################
  28. //
  29. list getAllLinkedPrimsByName(string name)
  30. {
  31.     list id[];
  32.     integer index=0;
  33.     while(index<=llGetNumberOfPrims()){
  34.         if (llGetLinkName(index)==name){
  35.             id+= index;
  36.         }
  37.         index++;
  38.     }
  39.     return id;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement