Files
LSL-Scripts/TGAO/AttachScript.lsl

33 lines
864 B
Plaintext
Raw Normal View History

2023-02-14 12:08:06 -06:00
integer DefaultAttachPoint = ATTACH_HUD_CENTER_2;
default
{
state_entry()
{
llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
}
run_time_permissions( integer vBitPermissions )
{
if ( vBitPermissions & PERMISSION_ATTACH )
llAttachToAvatar( DefaultAttachPoint );
else
llOwnerSay( "Permission to attach denied" );
}
on_rez(integer rez)
{
if (!llGetAttached()) //reset the script if it's not attached.
llResetScript();
}
attach(key id)
{
// The attach event is called on both attach and detach, but 'id' is only valid on attach
if (id){
llOwnerSay( "The object is attached to " + llKey2Name(id) );
}else {
llOwnerSay( "The object is not attached");
}
}
}