Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to Reset script only on owner change

Lorathana Eldrich
Registered User
Join date: 6 Apr 2006
Posts: 45
01-30-2007 02:31
I want to have a script reset its self, but not on rez..

I want it to only reset when a new owner gets it..so it still works.

My problem is currently my script is working fine, but when ever I rez it anything set by the owner is reset back to the default state.

How would I go about this?
Daisy Rimbaud
Registered User
Join date: 12 Oct 2006
Posts: 764
01-30-2007 02:49
The change event can be used to track change of owner, I believe.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-30-2007 03:39
From: Lorathana Eldrich
I want to have a script reset its self, but not on rez..

I want it to only reset when a new owner gets it..so it still works.

My problem is currently my script is working fine, but when ever I rez it anything set by the owner is reset back to the default state.

How would I go about this?



Your current script is probably calling llResetScript in the on_rez event, you need to disable that.

As Daisy said, you can handle a change of owner in the changed event

CODE

changed(integer change)
{
if(change & CHANGED_OWNER)
{
llResetScript();
}

}
Midori Mikazuki
Registered User
Join date: 20 Sep 2006
Posts: 78
01-30-2007 06:54
The owner change event won't fire if I give an object to a friend via inventory transfer, will it? Or would it fire the fire time my friend rezzed the object?

If, as I believe, it won't fire due to inventory transfer, you may also need some code in the on_rez event to compare the current owner with the last known owner, and reset the script if they are different.
Lorathana Eldrich
Registered User
Join date: 6 Apr 2006
Posts: 45
01-30-2007 14:08
Thankyou very much :)

It works, and I tested it :)