From Second Life Wiki
Jump to: navigation, search

In order for the attach() event to trigger while detaching, it must delay the detach long enough for it to process its contents.

There are a few things, such as processing time and certain functions, that will cause the detach to happen immediately while processing detach events. The next time the object is rezzed or attached, it will continue mid-event until it finishes, then begin the next event in the queue: on_rez(), then attach() (if it was attached).

What are the details of detach delay? I know that calling llSleep() while detaching will immediately stop the execution and detach the object. I've also noticed that calling llStartAnimation() and llStopAnimation() with an invalid animation will result in a script error, a script delay, and immediately stop further processing.

Is it as simple as "anything with a script delay causes immediate detachment"?

--Stickman Ingmann 20:24, 20 June 2008 (PDT)

I would have said that if the event took longer then 0.1 (I'm guessing) seconds to run then it would pause execution of the event and detach. -- Strife Onizuka 06:38, 21 June 2008 (PDT)

I'm noticing that even with attach not doing much, it does not run at all when an avatar is logging out. Is this a new and permenant behaviour? --Hoichi Soulstar 17:57, 19 January 2010 (PST)

It never was a reliable logout event. It ran on some versions but mostly no. --Cerise Sorbet 02:32, 20 January 2010 (UTC)

Found a way to distinguish detach to inventory from drop: <lsl> default {

   attach( key id )
       if ( id == NULL_KEY )
           if ( llGetLocalPos() == llGetPos() ) llOwnerSay( "Dropped" );
           else llOwnerSay( "Detached" );

} </lsl> The only case this wouldn't work would be when the avatar is at the region position of the same vector of the local position. ----Gregory Maurer 23:57, 18 September 2010 (UTC)

Triggers on log out?

This page says attach should trigger when the avatar wearing the object logs out. Although it would be really convenient if it did just that, this is obviously false. Should I fix this page?

--Satomi Ahn 14:16, 1 November 2010 (UTC)

I cheated, to make it say that it does not happen but maybe it could. Then scripters won't be too astonished if some server code changes and it suddenly starts working. --Cerise Sorbet 18:15, 1 November 2010 (UTC)
Could have sworn it trigged on logout, I guess I'm wrong. I like your solution to the situation btw. Keep up the good work. -- Strife (talk|contribs) 04:11, 2 November 2010 (UTC)

Temp attachments do trigger Attach

I just did a test with temporary attachments, detaching it by hand and by replacing outfits and in both instances does it trigger the attach event and is able to execute a llRegionSayTo function. If some more people can confirm it works in all occasions we can update the wiki. Frans Charming 14:20, 7 February 2013 (PST)