|
RaH Wollongong
Registered User
Join date: 11 Jul 2006
Posts: 19
|
01-03-2007 10:58
I had asked a question earlier concerning my use of llResetScript(). I have followed the suggestion and gone with a state for getting the new owner my problem is that now the new owner has to double click the object to get the script to recognize them as the owne, is there anyway around having to have a state similar to state ChangeOwner { on_rez(integer start_param) { llResetScript(); } touch_start(integer total_number) { newOwner = TRUE; state default; } state_exit() { llOwnerSay(0, "You are now set as the new owner."); } }
when i have tried to remove newOwner = TRUE; and state default to either the on_rez or state exit nothing happens. Is there another way so i don't have to use touch_start Could I just use state_start and still have that execute even after a script reset?
|
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
01-03-2007 12:22
Are you sure this object is in the ChangeOwner state when it's rezzed? You could try: key LastOwner; ... state default { state_entry() { LastOwner=llGetOwner(); // ... }
on_rez(integer n) { if ( llGetOwner() != LastOwner ) llResetScript(); }
}
Keep in mind it's hard to ensure that a script will be in a specific state when detatched, so you may have to put that on_rez() event handler into ALL your states to make sure it fires when the object is rezzed by a new owner.
_____________________
* 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!
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
01-03-2007 12:24
It doesn't seem like there is enough info here to answer the question. Perhaps a link to the original thread would help, or the code for the default{} state.
|
|
Wicc Cunningham
Registered User
Join date: 25 Jun 2004
Posts: 52
|
01-03-2007 13:44
If you are looking to reset the script when it changes owner, such as someone buys your product you might try adding a changed section to your main script so you don't have to use a seperate state. It sounds like you are experiencing what I have had happen with some of my scripts. Even though I have it call llGetOwner() to set the new owner of the item it doesn't seem to apply that call and thinks I'm still the owner of the item. I've used this addition to my scripts to get rid of that problem. default {
changed(integer changed) { if (changed == CHANGED_OWNER) { llResetScript(); } }
}
|
|
RaH Wollongong
Registered User
Join date: 11 Jul 2006
Posts: 19
|
01-04-2007 02:27
No even in the default state in inventory when the new owner wears them it does an llGetOwner() so if im correct I can set a var lastOwner set the var then in default state_entry compare the two if match ccontinue if no match set new owner. Its late ill play more with it tonight.
|