Jump to content

HUD detach


littlepinkpie
 Share

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

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

Recommended Posts

when a object has been manually attached from inventory then the avatar has by implication already given permission to attach/detach

the script can then ask for attach/detach permission and it is silently granted while the object is attached

have a look at the script example on the wiki to see how it works: http://wiki.secondlife.com/wiki/LlDetachFromAvatar

Link to comment
Share on other sites

it does, it just bypasses the dialog and is granted automatically. the same with how sitting on an object *automatically grants animation perms.

*assuming the script requesting permissions is in the same object being sat on.

Exceptions would be beds that rez poseballs, and things of that nature. You sit on the poseball, it communicates your identity to the bed, and then the bed has the animation scripts that ask permission. You're not sitting directly on the bed, so when it asks permission, it has to use the pop-up.

  • Like 1
Link to comment
Share on other sites

one other thing I figured out when making a demo item. I used llAttachToAvatarTemp and wanted it to detach after a time. My vendor would rez the item, ask for permissions to attach, it attaches, then when I tried to detach after the demo period, I realized it transfers ownership, and so the permissions to attach/detach didn't carry over. 

"When object ownership changes, any granted permissions are reset. After a successful attach, you will need a fresh call to llRequestPermissions to allow llDetachFromAvatar and other permission-required functions to work."

Link to comment
Share on other sites


Ruthven Willenov wrote:

one other thing I figured out when making a demo item. I used llAttachToAvatarTemp and wanted it to detach after a time. My vendor would rez the item, ask for permissions to attach, it attaches, then when I tried to detach after the demo period, I realized it transfers ownership, and so the permissions to attach/detach didn't carry over. 

"When object ownership changes, any granted permissions are reset. After a successful attach, you will need a fresh call to
to allow
and other permission-required functions to work."

Correct, you need to call llRequestPermissions again but the permissions are silently granted since the hud is worn at that moment. Check the example in the wiki.

Link to comment
Share on other sites

  • 3 years later...

Hello there - I found this thread when I was looking for a 'detach hud' script.  I have made a hud and have added a close button at top right.  In that prim, I have put a very simple script to detach the hud when touched.  I read that I have to have the llRequestPermmissions which assumes the permission is given since the avatar attached the hud before the llDetachFromAvatar will work.  So everything works fine except that an avatar has to click the close button twice before it detaches.  I think I need to make a slight adjustment to my script so that the button only needs to be clicked once to detach - grateful for advice.  Thanks..

This is my little script:

default
{
    touch_start(integer total_number)
    {
       llRequestPermissions( llDetectedKey(0), PERMISSION_ATTACH );
      llDetachFromAvatar( );
    }
}

 

Link to comment
Share on other sites

So I tried putting the detach command in run-time section but it still needed two clicks to detach.

default
{
    touch_start(integer n)
    {   
            llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
    }

    run_time_permissions(integer permission)
    {
        if(permission)
        {
            llDetachFromAvatar();
        }
    }
}   

Link to comment
Share on other sites

Replacing touch_start with touch_end seems to work for me. touch_start has a reputation for being a bit iffy sometimes.

Incidentally, to be properly proper, you should check that PERMISSION_ATTACH has actually been granted by checking with the function llGetPermissions, or in the run_time_permissions event

if (llGetPermissions () & PERMISSION_ATTACH) llDetachFromAvatar( );

or

run_time_permissions (integer permissions)
{
    if (permissions & PERMISSION_ATTACH) llDetachFromAvatar( );
}

Edited by KT Kingsley
  • Like 1
Link to comment
Share on other sites

It's a good idea to include owner checks with touches so click-happy people, noobs or people on illegal tpv's don't cause your attachments to do undesired things.

Also, depending on how critical the application is, when using touch_end() you might want to also include a check that llDetectedTouchPos() doesn't equal ZERO_VECTOR which can occur when you quickly or accidentally click something while moving your mouse off of the click surface/face. Again, this is only when touch_end() is used because it won't trigger until you release the mouse button, during which time, you're mouse touch icon could be anywhere else on your screen, even hovering over something else or nothing.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1424 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...