Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDie

Myeia Boa
Registered User
Join date: 18 Jul 2008
Posts: 9
07-18-2008 04:53
Hey guys

I am trying to make an object rezzed by another object die after 30 seconds. I am using a very simple script . My problem is that the object never seems to last more than 18 seconds.
could someone tell me what i am doing wrong ?



here is the script

default
{
state_entry()
{
llSetTimerEvent(30.0);
}

timer()
{
llDie();
}
}
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
07-18-2008 06:53
Things in state_entry happen when the script is compiled or reset (unless your script has more than one state, and yours does not). So the timer is running while you save the script and insert the object into your rezzer object etc.

To fix it, make a new event handler for on_rez and move your llSetTimerEvent there.

Good concise example of what you're trying to do here:

http://www.lslwiki.net/lslwiki/wakka.php?wakka=on_rez
_____________________
Designer of sensual, tasteful couple's animations - for residents who take their leisure time seriously. ;)

http://slurl.com/secondlife/Brownlee/203/110/109/

Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
07-18-2008 09:49
What Anti said. To clarify, the timer is running while the object is inworld, after saving/resetting the script, and before you take it. When you rez it, the timer resumes ticking down. So evidently it was 12 seconds between when you saved the script and took the item into inventory.

Another tip: use the rez argument to tell whether you dragged it out (to work on it), or it was rezzed by the other object's script. Only set the timer in the latter case. That way it won't vanish while you're working on it.

CODE
 
on_rez(integer arg) {
if (arg) {
llSetTimerEvent(30.0);
}
}


In your script that rezzes the object, be sure to pass a nonzero value for the rez argument.

To see my code with indentation intact, hit the REPLY button for this post.
Myeia Boa
Registered User
Join date: 18 Jul 2008
Posts: 9
07-18-2008 11:04
thank you so much