Jump to content

Mysterious Re-attachment


mistythunder
 Share

You are about to reply to a thread that has been inactive for 1106 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

This is code snippet is where I handle detachments, when needed:
 

    listen(integer channel, string name, key id, string message)
    {   llOwnerSay( "Debug: listen() - called: listen(" + (string)channel + ", \"" + name + "\", " + (string)id + ", \"" + message + "\")" );
        key kAvatarKey;
        message = llStringTrim( message, STRING_TRIM );
        kAvatarKey = llGetOwner();
        if( kAvatarKey == llGetOwnerKey( id ) )				
        {    if( message == "@DetachPrimOnly" )
             {
                  llOwnerSay( "Debug: listen() 7: detaching" );
                  if( llGetPermissions() & PERMISSION_ATTACH ) 
	              {    llOwnerSay( "Debug: listen() 7a: calling: llDetachFromAvatar();" );
	                   llDetachFromAvatar();
	              }
	              else
	              {   llOwnerSay( "Debug: listen() 7b: calling: llRequestPermissions( " + (string)llGetOwner() + ", " + (string)PERMISSION_ATTACH + " )"  );
	                  llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
	              }
              }
         }
     }
....

    run_time_permissions(integer perm)
    {   llOwnerSay( "Debug: called run_time_permissions():  perm = " + (string)perm  );       
        if( perm & PERMISSION_ATTACH )
        {   llOwnerSay( "Debug: run_time_permissions(): calling llDetachFromAvatar()");       
            llDetachFromAvatar();
        }
    }

    attach(key AvatarKey)
    {   llOwnerSay( "Debug: attach() called: gbConfigComplete =" + (string)gbConfigComplete + "    AvatarKey = " + (string)AvatarKey );
        if( AvatarKey == NULL_KEY )
        {   llOwnerSay( "Debug: attach(): Detachment detected:  gbDetachThis = " + (string)gbDetachThis );
            {    llOwnerSay( "Debug: attach(): calling ProcessAttachDetach()" );
                 ...
            }
        }else
        {   llOwnerSay( "Debug: attach(): Attachment detected" );
            ...
        }
    }

The llOwnerSay( ) debugging statements show that when the above coded executes the "llDetachFromAvatar();" statement this is followed by the attach() event being triggered, as expected. Then my Inventory shows it does detach, but then it attaches again a few seconds later. I have no idea why it re-attaches. The need is for it to remain detached.

The detachment happens when the script receives a detachment command from another prim, which is also attached to the same avatar.

Please suggest what might have caused this to go wrong.

Link to comment
Share on other sites

How do you detach the object, and do you own something else that handles attachments?

Objects/scripts can't attach themselves from inventory (the scripts can't run), it has to be done by something external, for example by an RLV command from another script.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

53 minutes ago, mistythunder said:

Would the RLV command sequence "@clear,detachme=force" make unnecessary the call to:


llRequestPermissions()

and the wait for the run_time_permissions() event?

Technically, yes, but IMO It's best practice to script things so that they are as functional as reasonably possible for people not using RLV, so while it's gratuitous I would personally  recommend doing both.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1106 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...