Jump to content

PERMISSION_ATTACH


Ackley Bing
 Share

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

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

Recommended Posts

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

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);    }}

 

  • Like 2
Link to comment
Share on other sites

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);    }}

 

 

  • Like 1
Link to comment
Share on other sites

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

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

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