mistythunder Posted April 14, 2021 Share Posted April 14, 2021 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 More sharing options...
Wulfie Reanimator Posted April 14, 2021 Share Posted April 14, 2021 (edited) 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 April 14, 2021 by Wulfie Reanimator Link to comment Share on other sites More sharing options...
KT Kingsley Posted April 14, 2021 Share Posted April 14, 2021 This does sound like RLV thinks the object shouldn't be allowed to be detached and thus reattaches it when it sees it has been detached. The RLV API page mentions this behaviour. Search for "reattach" there. Link to comment Share on other sites More sharing options...
mistythunder Posted April 17, 2021 Author Share Posted April 17, 2021 Would the RLV command sequence "@clear,detachme=force" make unnecessary the call to: llRequestPermissions() and the wait for the run_time_permissions() event? Link to comment Share on other sites More sharing options...
Quistess Alpha Posted April 17, 2021 Share Posted April 17, 2021 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 More sharing options...
Recommended Posts
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