littlepinkpie Posted July 21, 2016 Share Posted July 21, 2016 Hello, I recently noticed some different huds having a X button which detach them from your screen.So far I knew that there isnt a non permissioned llDetachFromAvatar, now how is this possible?Thank you! Link to comment Share on other sites More sharing options...
wherorangi Posted July 21, 2016 Share Posted July 21, 2016 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 More sharing options...
littlepinkpie Posted July 21, 2016 Author Share Posted July 21, 2016 But these huds never asked for my permissions. Link to comment Share on other sites More sharing options...
Ruthven Ravenhurst Posted July 21, 2016 Share Posted July 21, 2016 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. 1 Link to comment Share on other sites More sharing options...
littlepinkpie Posted July 21, 2016 Author Share Posted July 21, 2016 Ok guys, understood, thank you. Link to comment Share on other sites More sharing options...
Ruthven Ravenhurst Posted July 22, 2016 Share Posted July 22, 2016 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 More sharing options...
Nova Convair Posted July 22, 2016 Share Posted July 22, 2016 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 llRequestPermissions to allow llDetachFromAvatar 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 More sharing options...
Ruthven Ravenhurst Posted July 23, 2016 Share Posted July 23, 2016 Right, I meant to add/imply that. I was still waking up at that moment lol. Link to comment Share on other sites More sharing options...
GloriaGlitter Posted May 31, 2020 Share Posted May 31, 2020 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 More sharing options...
GloriaGlitter Posted May 31, 2020 Share Posted May 31, 2020 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 More sharing options...
KT Kingsley Posted May 31, 2020 Share Posted May 31, 2020 (edited) 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 May 31, 2020 by KT Kingsley 1 Link to comment Share on other sites More sharing options...
GloriaGlitter Posted May 31, 2020 Share Posted May 31, 2020 KT - 'touch_end' did the trick thanks. Made the other edit you suggested as well. Thanks again for fast reply. 1 Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted June 1, 2020 Share Posted June 1, 2020 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 More sharing options...
Kyrah Abattoir Posted June 1, 2020 Share Posted June 1, 2020 @Lucia NightfireFunny thing is, at some point i wanted to move all my scripts to use touch_end, like a proper UI. Then a realized that it felt very "wrong" because using touch_start kinda masks some of the latency. Not directly related to the issue at hand but i thought i'd mention it. 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