Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to change attachment point?

LostInKgp Kanik
Registered User
Join date: 23 May 2008
Posts: 10
07-08-2008 23:15
I have an object attached to Avtar at left hand. When i send a message to this object, i want it to attach to right hand without permission message. Is it possible?
-------------------------------------------------------
integer x;
default {
state_entry() {
llListen(7, "","","";);
}
listen(integer channel, string name, key id, string message)
{
if(message=="attach";)
{
llRequestPermissions(llGetOwner(),PERMISSION_ATTACH);
llSleep(1);
x=llGetPermissions();
if(x & PERMISSION_ATTACH)
{
llAttachToAvatar(ATTACH_RHAND);
llOwnerSay("Kit1 is attached to right hand";);
}
else
{
llOwnerSay("no attach permission";);
}
}
}
}
------------------------------------------------------------
In this script i m sending "attach" message on channel 7. But after receiving correct message object doesnt change its attach position.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-09-2008 10:40
No. The only way (currently) for an object to attach to a specific location is from in-world. An object can only DEtach to resident inventory (where its script will pause). The best you can do if you want to require the object to be attached to a specific location is to output an informative message (telling the resident to attach to the required point and/or maybe rez the object in-world for automatic attaching) and detach it. The best you can do if you want the object to appear in a new location dynamically is to have two attachments and change texture/alpha values to make the correct one visible and hide the other (this is a very old problem for weapons that sheath/unsheath).

As for permissions, you can get them without the dialog only while the object is attached, though you can retain them (so long as the object is not transferred to another resident) after that for times when the object is in-world and you want to attach. You'll want to check the values of llGetPermissions()&PERMISSION_ATTACH and llGetPermissionsKey() to see if your script already has useful permissions granted.