Difference between revisions of "Category:LSL Link/Get"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 1: Line 1:
{{LSL Header|ml=*}}{{LSLC|Link}}{{LSLC|}}
{{LSL Header|ml=*}}{{LSLC|Link}}{{LSLC|}}
{{Box|Useful Snippets|2=
{{Box|Useful Snippets|2=
<lsl>key GetLinkCreator(integer link)
<lsl>list GetLinkDetails(integer link, list OBJECT_FLAGS)
{//simple wrapper
    return llGetObjectDetails(llGetLinkKey(link), OBJECT_FLAGS);
}
 
key GetLinkCreator(integer link)
{
{
     return llList2Key(llGetObjectDetails(llGetLinkKey(link), (list)OBJECT_CREATOR) + NULL_KEY, 0);
     return llList2Key(llGetObjectDetails(llGetLinkKey(link), (list)OBJECT_CREATOR) + NULL_KEY, 0);
Line 17: Line 22:


vector GetLinkLocalPos(integer link)
vector GetLinkLocalPos(integer link)
{//This function may not produce a perfect result, expect there to be some drift.
{//This function may not produce a perfect result, expect there to be some drift. This will not work in attachments.
     vector pos = llGetRootPosition();
     vector pos = llGetRootPosition();
     key k = llGetLinkKey(link);
     key k = llGetLinkKey(link);
Line 26: Line 31:
   
   
rotation GetLinkLocalRot(integer link)
rotation GetLinkLocalRot(integer link)
{//This function may not produce a perfect result, expect there to be some drift.
{//This function may not produce a perfect result, expect there to be some drift. This will not work in attachments.
     rotation rot = llGetRootRotation();
     rotation rot = llGetRootRotation();//There is no llGetAttachmentRot :(
     key k = llGetLinkKey(link);
     key k = llGetLinkKey(link);
     if(llGetLinkKey(!!llGetLinkNumber()) != k)
     if(llGetLinkKey(!!llGetLinkNumber()) != k)

Revision as of 23:03, 22 June 2009

Useful Snippets

<lsl>list GetLinkDetails(integer link, list OBJECT_FLAGS) {//simple wrapper

   return llGetObjectDetails(llGetLinkKey(link), OBJECT_FLAGS);

}

key GetLinkCreator(integer link) {

   return llList2Key(llGetObjectDetails(llGetLinkKey(link), (list)OBJECT_CREATOR) + NULL_KEY, 0);

}

key GetLinkGroup(integer link) {

   return llList2Key(llGetObjectDetails(llGetLinkKey(link), (list)OBJECT_GROUP) + NULL_KEY, 0);

}

string GetLinkDesc(integer link) {

   return (string)llGetObjectDetails(llGetLinkKey(link), (list)OBJECT_DESC);

}

vector GetLinkLocalPos(integer link) {//This function may not produce a perfect result, expect there to be some drift. This will not work in attachments.

   vector pos = llGetRootPosition();
   key k = llGetLinkKey(link);
   if(llGetLinkKey(!!llGetLinkNumber()) != k)
       return (llList2Vector(llGetObjectDetails(k, (list)OBJECT_POS) + pos, 0) - pos) / llGetRootRotation();
   return pos;

}

rotation GetLinkLocalRot(integer link) {//This function may not produce a perfect result, expect there to be some drift. This will not work in attachments.

   rotation rot = llGetRootRotation();//There is no llGetAttachmentRot :(
   key k = llGetLinkKey(link);
   if(llGetLinkKey(!!llGetLinkNumber()) != k)
       return llList2Rot(llGetObjectDetails(k, (list)OBJECT_ROT) + rot, 0) / rot;
   return rot;

}</lsl>

Pages in category "LSL Link/Get"

The following 5 pages are in this category, out of 5 total.