Free Script: Generate Linkset List Details

Creating scripts
Post Reply
User avatar
Mike Lorrey
Posts: 365
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 72 times
Been thanked: 275 times

Free Script: Generate Linkset List Details

Post by Mike Lorrey »

This script will generate a list of a linksets links in order by link number, with link name, size, link local position and local rotation, and save it to a notecard in the object inventory. This is useful because the edit dialog does not accurately tell you the link number of any given link in a linkset other than the root, and especially to provide you with link local position and rotation, rather than global position and rotation, so you can manipulate each link with script functions.

Code: Select all

default
{
    state_entry()
    {
        llSay(0, "Script running");
        integer link;
        integer links;
        string linkname;
        vector linksize;
        vector linkpos;
        rotation linkrot;
        list linklist=[];
        integer i=1;
        links = llGetNumberOfPrims();
        while (i <= links)
        {
          linkname = llGetLinkName(i);
          linksize = llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_SIZE]),0);
          linkpos = llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0);
          linkrot = llList2Rot(llGetLinkPrimitiveParams(i,[PRIM_ROT_LOCAL]),0);
      llSay(0,"Link Number: " + (string)i + " ,  Link Name: " + linkname + " , Link Size: " + (string)linksize + " ,  Link Position: " + (string)linkpos + " ,  Link Rotation: " + (string)linkrot );
          linklist = linklist + llParseString2List("Link Number: " + (string)i + " ,  Link Name: " + linkname + " , Link Size: " + (string)linksize + " ,  Link Position: " + (string)linkpos + " ,  Link Rotation: " + (string)linkrot ,"","");
            i = i+1;   
        }
       // llSay(0,(string)linklist);
       //NOTE: The osMakeNotecard function ONLY works for you if you are running it in an region you are either the estate owner or manager. If that is not the case where you are, simply comment the next line out with the two slashy characters like I did this comment.
        osMakeNotecard(llGetLinkName(1),linklist);
        llGiveInventory(llGetLinkName(i),llGetOwnerKey(llGetKey()));
        
    }
}
}
Last edited by Mike Lorrey on Tue Aug 17, 2021 2:26 am, edited 1 time in total.
These users thanked the author Mike Lorrey for the post (total 6):
Ilan TochnerTess JuelChristine NynGraham MillsZed deTremontMichael Timeless
User avatar
Mike Lorrey
Posts: 365
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 72 times
Been thanked: 275 times

Re: Free Script: Generate Linkset List Details

Post by Mike Lorrey »

Note I just edited it to add link size as well.
User avatar
Christine Nyn
Posts: 74
Joined: Sat Mar 07, 2020 10:20 pm
Has thanked: 245 times
Been thanked: 135 times

Re: Free Script: Generate Linkset List Details

Post by Christine Nyn »

Nice script Mike! I'm sure people will find many uses for it.

Would it be worth including a comment in the script to the effect that osMakeNotecard() will normally only work for a region owner or estate manager?
That aspect of the script would fail on the Kitely Merchants Sandbox for instance.
User avatar
Mike Lorrey
Posts: 365
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 72 times
Been thanked: 275 times

Re: Free Script: Generate Linkset List Details

Post by Mike Lorrey »

Christine Nyn wrote:
Tue Aug 17, 2021 1:03 am
Nice script Mike! I'm sure people will find many uses for it.

Would it be worth including a comment in the script to the effect that osMakeNotecard() will normally only work for a region owner or estate manager?
That aspect of the script would fail on the Kitely Merchants Sandbox for instance.
Oh well yes, I supposed that comment should be added. This is also why I have it spamming the data into open chat.
Post Reply