MantisBT - opensim
View Issue Details
0004404opensim[REGION] Script Functionspublic2009-11-29 12:082012-09-30 22:17
kevinbuckley70 
 
normalmajoralways
acknowledgedopen 
 
 
11301
Standalone (Multiple Regions)
ODE
.NET / Windows32
None
0004404: llBreakLink() after llCreateLink() silently fails or reorders linkset
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). It is possible maybe, that it is the llCreateLink() which reorders the original linkset in the case where 'parent' is set to TRUE.

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).

Also attached as additional information is a script you can use to test this – put it in a single prim which also contains any 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.
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();
    }
}
No tags attached.
Issue History
2009-11-29 12:08kevinbuckley70New Issue
2009-11-29 12:08kevinbuckley70Git Revision => 11301
2009-11-29 12:08kevinbuckley70SVN Revision => 0
2009-11-29 12:08kevinbuckley70Run Mode => Standalone (Multiple Regions)
2009-11-29 12:08kevinbuckley70Physics Engine => ODE
2009-11-29 12:08kevinbuckley70Environment => .NET / Windows32
2009-11-29 12:08kevinbuckley70Mono Version => None
2011-08-15 01:29makopoppoNote Added: 0019578
2011-08-15 01:29makopoppoStatusnew => acknowledged
2011-11-25 18:15justinccNote Added: 0020394
2012-09-30 22:17Kim MinuetNote Added: 0022757
2012-09-30 22:18Kim MinuetNote Edited: 0022757bug_revision_view_page.php?bugnote_id=22757#r688

Notes
(0019578)
makopoppo   
2011-08-15 01:29   
This is still an issue in OpenSim 0.7.2-dev.

To say more simple, llBreakLink() itself will silently fail if it is called by child prim.
You can reproduce it by putting this script in root/child prim and clicking it.

---
default
{
    touch_start(integer number)
    {
        llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS);
    }
    
    run_time_permissions(integer _perm)
    {
        if (_perm == PERMISSION_CHANGE_LINKS)
        {
            llBreakLink(llGetLinkNumber());
        }
    }
}
(0020394)
justincc   
2011-11-25 18:15   
Is this still true in current git master with the most recent linkset change?
(0022757)
Kim Minuet   
2012-09-30 22:17   
(edited on: 2012-09-30 22:18)
I had trouble getting llBreakLink() to work today in OpenSim 0.7.4 local and also in OSGrid. Any idea when this might be addressed?

Edit: exact same script (from the llBreakLink() Wiki page executes as expected in SL.