Ackley Bing Posted November 30, 2012 Share Posted November 30, 2012 I have a script that asks for permission to attach but I have no idea why it won't attach when the permission is given. default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS | PERMISSION_ATTACH); } run_time_permissions(integer perms) { if ( perms==PERMISSION_TAKE_CONTROLS ) llTakeControls(CONTROL_BACK, FALSE, TRUE); if ( perms==PERMISSION_ATTACH ) llAttachToAvatar(35); } } What am I doing wrong? Any help or feedback appreciated! Thank you. :) Link to comment Share on other sites More sharing options...
Innula Zenovka Posted November 30, 2012 Share Posted November 30, 2012 Try this -- it's a bitwise comparison: default{ state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS | PERMISSION_ATTACH); } run_time_permissions(integer perms) { if ( perms & PERMISSION_TAKE_CONTROLS ) llTakeControls(CONTROL_BACK, FALSE, TRUE); if ( perms & PERMISSION_ATTACH ) llAttachToAvatar(ATTACH_HUD_CENTER_1); }} 2 Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 30, 2012 Share Posted November 30, 2012 In addition to Innula's observation, both permissions will be granted in a single operation, so you can save on one if test by combining them..... run_time_permissions (integer perms){ if (perms & (PERMISSION_TAKE_CONTROLS | PERMISSION_ATTACH)) { llTakeControls(CONTROL_BACK, FALSE, TRUE); llAttachToAvatar (35); }} 1 Link to comment Share on other sites More sharing options...
Dora Gustafson Posted November 30, 2012 Share Posted November 30, 2012 Is there a guaranty that both requests will be granted in the same event? If yes, your suggestion should work fine:smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 30, 2012 Share Posted November 30, 2012 If you request both permissions at the same time, the user gets a permission window that asks if s/he wants to grant permission to do both. As far as I know, there's no way for the user to grant some of the requested permissions. Link to comment Share on other sites More sharing options...
Dora Gustafson Posted November 30, 2012 Share Posted November 30, 2012 Yes I know but I have no idea how the server handles requests, if it collects them in one event or generates separate events. Innula's approach will work in both cases and her approach is the one I use for the same reason Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 30, 2012 Share Posted November 30, 2012 Hmmm... That's a good question. I wonder if anyone knows for sure? Link to comment Share on other sites More sharing options...
Ela Talaj Posted December 1, 2012 Share Posted December 1, 2012 My understanding would be that those permissions requiring user input would generate a separate event on each user click as in case of more than one permission such input is always asynchronous. In case of auto-granted permissions I would assume they are returned in the same event regardless of how many are asked for. Link to comment Share on other sites More sharing options...
Rolig Loon Posted December 1, 2012 Share Posted December 1, 2012 That seems to be the consensus among those who responded over in SLU when I asked too. So it really is safer to test each permission separately, at least if you're dealing with ones that aren't granted automatically. That's worth knowing. Thanks Dora, for pointing out the potential problem, and Ela, for helping to confirm 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