De DigiWiki.
//-- rez object on ground, drop in this script, it will request permissions to attach,
//-- and then attach to the left hand if permission is granted. if permission is denied,
//-- then the script complains.
default
{
state_entry()
{
llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
}
run_time_permissions( integer vBitPermissions )
{
if( vBitPermissions & PERMISSION_ATTACH )
{
llAttachToAvatar( ATTACH_LHAND );
}
else
{
llOwnerSay( "Permission to attach denied" );
}
}
on_rez(integer rez)
{
if(!llGetAttached())
{ //reset the script if it's not attached.
llResetScript();
}
}
attach(key AvatarKey)
{
if(AvatarKey)
{//event is called on both attach and detach, but Key is only valid on attach
integer test = llGetAttached();
if (test) {
llOwnerSay( "The object is attached" );
} else {
llOwnerSay( "The object is not attached");
}
}
}
}