Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

object lifecycle

Lev Kamenev
Registered User
Join date: 1 May 2006
Posts: 2
05-04-2006 11:26
Hi!

I am new to SL. One thing I could not figure out is object life cycle. I have script which starts when object is created and does something. What happens if i 'take' object? Does scipt stops? What happens if I put it somewhere? What happens if I give it to somebody? What happens if I take a copy of an object?

I will appreciate if somebody can clarify this for me.

Thanks!

Lev.
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
05-04-2006 12:15
From: Lev Kamenev
Hi!

I am new to SL. One thing I could not figure out is object life cycle. I have script which starts when object is created and does something. What happens if i 'take' object? Does scipt stops? What happens if I put it somewhere? What happens if I give it to somebody? What happens if I take a copy of an object?

I will appreciate if somebody can clarify this for me.

Thanks!

Lev.


When you take an object, the script just goes into "deep freeze" and takes off when rezzed again in world right where it is left off with the addition of the on_rez() event firing. When you give it to someone, the same thing happens, only this time in addition to the on_rez() event the changed() event should fire also (please see wiki for the appropriate constants, I think it is CHANGED_OWNER). Taking a copy is just that, you take a copy that freezes as if it's the orig. the object itself has no idea that it's a copy.
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
05-04-2006 13:33
That's also why it's common practice by scripters to use the llResetScript() function inside the on_rez event in their scripts. That way, objects canl behave as if they were just compiled even when re-rezzed anew.

Keep in mind that using llResetScript() will reset any variable data the script may have been using.
Lev Kamenev
Registered User
Join date: 1 May 2006
Posts: 2
05-04-2006 14:44
Thanks everybody for explanations! What is common practice of dealing with XML-RPC channels on deep freeze? The ones created with llOpenRemoteDataChannel()?

Another question I have is about taking a copy of an object. I understand that creates new instance of the object, running in parallel with existing one?
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-04-2006 18:03
I'm not sure about XML-RPC, but when you take a copy, it's like you clone the object and then deep-freeze it-- the scripts of the take copy item are in the exact same state as if you had taken the item, but the original remains.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
05-05-2006 01:16
Although not intuitive, if you reset a script that has an xmlrpc channel open it reopens the same channel, or maybe that number doesn't get reset because it's stored elsewhere?