[Opensim-users] llBreakLink silently fails or reorders linkset in opensim

Kevin Buckley kevin at buckley70.freeserve.co.uk
Sun Nov 29 16:30:03 UTC 2009


I think there is a bug in llBreakLink() in Opensim (compared with the 2L
description, 2L actual behaviour and what would actually make sense!).

 

I am trying to do the following with a script inside a single prim:

 

- Rez an object (made from many prims) from prim inventory: llRezObject()

- Get permission for the script to link/unlink: llRequestPermissions()

- Link object to myself: llCreateLink()

- Do 'some stuff' with the linked parts

- Unlink myself from the object*: llBreakLink()

 

(*The script is in a single prim, so I unlink myself rather than trying to
unlink all the prims in the rezzed linkset, or getting the rezzed object to
delink me - which would require each newly rezzed object to call
llRequestPermissions() each time)

 

If I set 'parent' to TRUE in llCreateLink() - so the rezzer prim becomes the
root prim of the new linkset, then the subsequent llBreakLink() (used to
unlink myself from the linkset) changes which prim is the root prim in the
original rezzed object in some seemingly random way (this is no good! The
root prim is also scripted and needs to remain the root prim after this
process is finished).

 

If I set 'parent' to FALSE in llCreateLink() - so the root prim of the
rezzed object becomes the root prim of the linkset, then the subsequent
llBreakLink() silently fails (it doesn't unlink and so also doesn't trigger
a 'changed' event).

 

Below is a script you can use to test this - put it in a single prim which
also contains some multi-prim object called "Rez Thing".

 

Changing 'makeMeParent' determines the mode of operation: either the rezzer
prim is the root prim of the linked set (TRUE) or not (FALSE).

 

It reports its progress as it carries out the above actions - touching it
causes it to run again (after you have manually disposed of the rezzed
object).

 

It works just fine in 2L in both modes.

 

Any suggestions on how to fix this in Opensim would be most welcome (or if
it IS a bug, can someone familiar with the process report if officially?) -
Thanks, Kevin

 

============================================================================
============

 

integer makeMeParent = FALSE;

string objectName = "Rez Thing";

 

key objectKey;

 

default

{

    on_rez(integer channel)

    {

        llResetScript();

    }

    

    state_entry()

    {

        llSay(0, "Rezzing object");

        llRezObject(objectName, llGetPos() + <0,0,2>, ZERO_VECTOR,
ZERO_ROTATION , 0);

        llSay(0, "Get link/unlink perms");

        

    }

    

    object_rez(key _id)

    {

        llSay(0, "Object rezzed, key: " + (string)_id);

        objectKey = _id;

        

        llSay(0, "Getting link/unlink perms");        

        llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS);

    }

 

    run_time_permissions(integer _perm)

    {

        llSay(0, "run_time_permissions triggered with value: " +
(string)_perm);

        

        //Check we got permission

        if (_perm == PERMISSION_CHANGE_LINKS)

        {

            llSay(0, "Linking to me");

            llCreateLink(objectKey, makeMeParent);

        } else

        {//No - permission to link/unlink was not granted - error message &
halt

            llSay(0, "Permission to link was denied");

            state halted;

        }

    }

    

    changed(integer change)

    {

        llSay(0, "'changed' called with value: " + (string)change);

        if (change & CHANGED_INVENTORY )

        {

            llResetScript();

        } else if (change & CHANGED_LINK)

        {

            integer myLinkNumber = llGetLinkNumber();

            llSay(0, "My new link number is: "+(string)myLinkNumber);

            if (makeMeParent)

            {

                if (myLinkNumber < 2)//Root

                {

                    llSay(0, "Delinking self");

                    llBreakLink(myLinkNumber);

                }

            } else

            {

                if (myLinkNumber > 1)//Rezzed object is root

                {

                    llSay(0, "Delinking self");

                    llBreakLink(myLinkNumber);

                }

            }

        }

    }

    

    touch_end(integer num_detected)

    {

        llSay(0, "Rezzing new object");

        llRezObject(objectName, llGetPos() + <0,0,2>, ZERO_VECTOR,
ZERO_ROTATION , 0);

    }

}

 

state halted

{

    on_rez(integer channel)

    {

        llResetScript();

    }

    

    state_entry()

    {

        llSay(0, "Halted");

    }

    

    changed(integer _change)

    {

        llResetScript();

    }

}

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-users/attachments/20091129/e337f8b7/attachment.html>


More information about the Opensim-users mailing list