Madi Madrigal Posted August 23, 2023 Share Posted August 23, 2023 I may be just missing this (I hope.) Is there a way to detect detach of an attachment? Not sure if it's an event you can detect or not in LSL as I cannot find anything on it. I would like to do something in a script if someone detaches. Thanks in advance! Link to comment Share on other sites More sharing options...
Quistess Alpha Posted August 23, 2023 Share Posted August 23, 2023 (edited) 13 minutes ago, Madi Madrigal said: I may be just missing this (I hope.) Is there a way to detect detach of an attachment? Not sure if it's an event you can detect or not in LSL as I cannot find anything on it. I would like to do something in a script if someone detaches. Thanks in advance! Actually, yes, but if the script is in the detached object, it may or may not have enough time to do whatever useful thing you want it to do. from inside the attachment: default { attach(key ID) { if(ID) { llSay(0,"This object was just attached."); }else { llSay(0,"This object was just detached."); // anything more placed here may or may not happen the next time this object is attached, before any other events. } } } for anything more complicated than saying a message, you should expect that some of the code may run during the next attach. see https://wiki.secondlife.com/wiki/Attach From another object, you'd need to iterate through llGetAttachedList() on a timer. Edited August 23, 2023 by Quistess Alpha 1 Link to comment Share on other sites More sharing options...
Fenix Eldritch Posted August 23, 2023 Share Posted August 23, 2023 The attach event will be called when you detach the object - though in that scenario, the id parameter will be NULL_KEY. And like Quistess says, you will have a very limited amount of time to do anything before it's derzzed back to inventory, so don't try to do anything complicated. Additionally, if the object was temp attached, it won't trigger the attach event on detach and will just delete itself immediately. 1 Link to comment Share on other sites More sharing options...
Madi Madrigal Posted August 23, 2023 Author Share Posted August 23, 2023 Ahhh! I didn't think to look into the attach functionality. I only want to change the texture on all faces on detach, so nothing crazy. If that would fail due to timing, I have a line to set it correctly on the next attach so either way would be fine. Thank you both so much for taking the time to reply. 😁 Link to comment Share on other sites More sharing options...
KT Kingsley Posted August 23, 2023 Share Posted August 23, 2023 Any code in the attach event that isn't executed before being derezzed gets executed when the object is next rezzed, and before the attach event is is triggered for the reattachment. 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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