These forums are CLOSED. Please visit the new forums HERE
on_un_rez? |
|
Oclee Hornet
Registered User
Join date: 14 Feb 2005
Posts: 19
|
07-31-2005 08:00
This might be a stupid newbie question, but please indulge me. Is there any way to detect an "un_rez/de_rez" event? If not, wouldn't it be a very useful addition to LSL?
|
Reitsuki Kojima
Witchhunter
![]() Join date: 27 Jan 2004
Posts: 5,328
|
07-31-2005 08:07
I suspect it's deliberatly non-existant... Otherwise it would be very easy to create an un-delete-able object.
_____________________
I am myself indifferent honest; but yet I could accuse me of such things that it were better my mother had not borne me: I am very proud, revengeful, ambitious, with more offenses at my beck than I have thoughts to put them in, imagination to give them shape, or time to act them in. What should such fellows as I do crawling between earth and heaven? We are arrant knaves, all; believe none of us.
|
Malachi Petunia
Gentle Miscreant
![]() Join date: 21 Sep 2003
Posts: 3,414
|
07-31-2005 08:11
There is not an on_unrez() or anything like it. When an object it taken into inventory, its script stops executing, if it Dies, there is no script to execute.
I'm guessing you are looking for something like a C++ destructor to do some clean up or perhaps a Java-like "finally" block. Alas, there is no such event. However, as scripts do preserve state throught take/rez cycles, you could do something like integer gDirty; default { on_rez() { if(gDirty) cleanup(); gDirty = true; } // stuff that could clear gDirty } If you say what you are trying to do, I might be able to give you more targeted help. _____________________
|
Oclee Hornet
Registered User
Join date: 14 Feb 2005
Posts: 19
|
07-31-2005 08:19
I'm trying to establish whether an object exists (is "active"
![]() [EDIT] Yes a deconsturctor would be bliss... ![]() [/EDIT] |
Malachi Petunia
Gentle Miscreant
![]() Join date: 21 Sep 2003
Posts: 3,414
|
07-31-2005 08:23
The I would recommend the tried-and-true exponential backoff. The idea being if I haven't been able to contact you in 10 seconds I'll wait 20, if 20 fails, I'll wait 40 seconds, with some upper bound, of course.
This algorithm is based on the belief that a down system will likely remain so. _____________________
|
Blain Candour
Registered User
Join date: 17 Jun 2005
Posts: 83
|
08-01-2005 15:37
If it is an attachment you can use the attach call to know when it is unattached. Also since you are checking for existance if this is going to be a low population item (onyl a few items, not a mass sold thing) you might want to consider a push instead of a pull. Have the item email you every so often and when it stops emailing.. well.. it is not there.
|