Jump to content

How to workaround PERMISSION_ATTACH request for rez Object


chrixbed
 Share

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

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

Recommended Posts

Hi, 

How to workaround that:

image.png.9b283979fa9334e600522d263d3be738.png

 

Context:

I'm building a rezzer for my avatar which attach and detach multiple objects from llRegionSay() calls. I get the authorisation windows every times and I try to find a workaround to automatically authorise my avatar to accept the Request for PERMISSION_ATTACH. Any ugly hardcoding in FireStorm or other way are welcome !

Note: I know "Experiences" are the way to go to have this done automatically but I want a temporary workaround to test my stuff first.

Here is the code in my Rezzer:

integer listen_handle;
default
{
    state_entry()
    {
        listen_handle = llListen(-12, "", NULL_KEY, "");
    }
 
    listen( integer channel, string name, key id, string message )
    {
	// Example of call llRegionSay(-12, "ObjectName");
    	if(llGetInventoryType(message)==INVENTORY_OBJECT)
        	llRezObject(strObject, llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
    }
}

Here is the code in my objects:

integer listen_handle;
integer DETACH_Flag = FALSE;
default
{
    state_entry()
    {
        listen_handle = llListen(-11, "", NULL_KEY, "");
    }
 
    run_time_permissions( integer vBitPermissions )
    {
        if ( vBitPermissions & PERMISSION_ATTACH ){
            if (DETACH_Flag){
                llDetachFromAvatar( );
                llListenRemove(listen_handle);
                llDie();
            }
            else  llAttachToAvatarTemp( ATTACH_LHAND );     
        }
        else     
            llOwnerSay( "Permission to attach denied" );
    }
 
    on_rez(integer rez)
    {
        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
    }
    
    listen( integer channel, string name, key id, string message )
    {
	// Call to detach ex: llRegionSay(-11, "Detach");
    	if (message == "Detach") {
	      	DETACH_Flag = TRUE ;
      		llRequestPermissions(llGetOwner(), PERMISSION_ATTACH );
        }
    }
}

Thanks !

Link to comment
Share on other sites

The trick in this scenario is to grant PERMISSION_ATTACH to the attachment object before you place it into the rezzer's inventory. That way, each new instance will be a copy of the object who already has the permission given. The state_entry event won't trigger when the object is rezzed from the rezzer, only the on_rez event.

A simple proof of concept for the attachment script:

default
{
    state_entry()
    {
        //request permission when script is first started
        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
    }
    
    run_time_permissions( integer vBitPermissions )
    {
        if ( vBitPermissions & PERMISSION_ATTACH )
        {
            llOwnerSay("Granted");     //simply verify we have permission
        }
        else
        {   
            llOwnerSay( "Permission to attach denied" );
        }
    }

    on_rez(integer rez)
    {
        llAttachToAvatarTemp( ATTACH_LHAND );   //attach when object is rezzed
    }
}

Note that this example lacks error checking. It would be a good idea to do a double-check just before we attach to make sure we still have permissions. And perhaps another check to see if we were rezzed from player inventory or the rezzer. That can help for making future edits and whatnot.

Edited by Fenix Eldritch
  • Like 4
Link to comment
Share on other sites

41 minutes ago, Fenix Eldritch said:

The trick in this scenario is to grant PERMISSION_ATTACH to the attachment object before you place it into the rezzer's inventory. That way, each new instance will be a copy of the object who already has the permission given. The state_entry event won't trigger when the object is rezzed from the rezzer, only the on_rez event.

A simple proof of concept for the attachment script:

Thanks Fenix, that exactly what I was trying to do and work perfectly !

Link to comment
Share on other sites

29 minutes ago, KT Kingsley said:

Also consider RLV, which can attach objects to you directly from your inventory, completely bypassing the permissions issue.

RLV, than an interesting idea which I did not think about; I will look at it as well!

Thanks!

Link to comment
Share on other sites

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