Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Event sequence

Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
08-16-2007 03:54
If an object contains on_rez and changed event handlers which is started first?
The changed handler is filtered only for a new owner.
I want to know into which to put code which will set some variable.
The object will be sold/given to a new owner. When they rezz it for the first time they need to do some simple steps to customise the content. This includes setting a variable which is used to distinguish between multiple occurrences of the object. I obviously need to initiate a dialog with the new owner but have to have the object set to respond correctly to their input.
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
08-16-2007 05:20
The wiki says that on_rez() is still triggered first.
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr

SL books http://astore.amazon.com/secondlife-sl-20/

Need a beta tester for quality assurance ?
Need a translator for English, French, Spanish ?
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
08-16-2007 06:22
You probably shouldn't count on the wiki as a language definition because it isn't and new versions of LSL have been known to change subtle features like this.

You should probably code a guard around it like this pseudo-code:

key newOwner = NULL # global

setNewOwner() { newOwner = llGetOwner() }

changed () { if (newOwner == NULL) setNewOwner(); ... }

on_rez() { setNewOwner(); ...}

and setNewOwner() might want to compare llGetOwner to your UUID before setting, otherwise you'll bump into problems taking it in and out of inventory.
_____________________
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
08-16-2007 10:17
From: Malachi Petunia
You probably shouldn't count on the wiki as a language definition because it isn't and new versions of LSL have been known to change subtle features like this.

You should probably code a guard around it like this pseudo-code:

key newOwner = NULL # global

setNewOwner() { newOwner = llGetOwner() }

changed () { if (newOwner == NULL) setNewOwner(); ... }

on_rez() { setNewOwner(); ...}

and setNewOwner() might want to compare llGetOwner to your UUID before setting, otherwise you'll bump into problems taking it in and out of inventory.

A good suggestion which will cater for both the new owner and the current owner rezzing the object.
Thank you.
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
08-16-2007 11:08
From: Simil Miles
The wiki says that on_rez() is still triggered first.
Could you provide a link to the exact page where it says this? I believe you but I want to explore a little furthe and I cant find it.
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
08-16-2007 11:17
http://rpgstats.com/wiki/index.php?title=Changed > CHANGED_OWNER
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr

SL books http://astore.amazon.com/secondlife-sl-20/

Need a beta tester for quality assurance ?
Need a translator for English, French, Spanish ?
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
08-16-2007 11:21
Thanks for the link. I didn't think to check the OLD Wiki.