Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

On Delete Action ??

Sparkly Rainbow
Registered User
Join date: 2 Jan 2006
Posts: 54
03-02-2008 10:15
Hello,

My scripting knowledge is very limited and I do not even know if what I want to do is possible but ...

I know that you can have a script do things when an object is rezzed. Is there any way to get a script to do something when the containing object is deleted? I looked in the scripting resources and could not find anything that sounded like it would allow that.

Thanks,
Sparkly
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-02-2008 11:55
unfortunately, no, for things that get taken back to inventory you can use the on rez event to take care of any script cleanup you might have wanted to occur when it's taken (it instead delays till the next rez) but don't expect to fire any inworld effects before it's derezzed.

in attachments you can get some code to fire when it taken off (or dropped) in the attach event (since it fires on both attach and detach) by checking the id (should be null).
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
03-02-2008 13:43
If you must... there are two alternative ways to handle this:

1) Have the prim do whatever it is you're need it to... and THEN issue the llDie() function that causes it to de-rez, and add some event controller so that you can tell it to self-destruct. (use llDetach() for attachments instead of llDie() )

2) Have another prim very nearby that does a slow llSensorRepeat() looking for the prim in question. When the no_sensor() event responds because the watched object is gone, the watcher does whatever you wanted done and then kills itself off as well. (won't work with attachments)

Neither are very elegant, and both can add a little bit of lag, but it might get you in the ballpark.
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources.
Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas.
-
Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-02-2008 15:49
this question came up to me recently for huds, beware of detach, because you can't llDie() attachments, so the next best thing is to self delete the scripts that make it work when/if you need to.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -